Compare commits

...

60 Commits

Author SHA1 Message Date
Sukchan Lee
3531166d38 Rollback ogs-app timer 2022-11-18 23:27:20 +09:00
Sukchan Lee
25f8c9a03e Update document for v2.5.6 2022-11-18 23:03:53 +09:00
Sukchan Lee
148ea44562 Release v2.5.6 2022-11-18 22:45:25 +09:00
Sukchan Lee
d5b34322f3 Fixed crash after 48 hours of running (#1893) 2022-11-18 21:30:33 +09:00
Sukchan Lee
517bb6ad85 Follow-up on #1886 2022-11-10 15:14:01 +09:00
lost_res
3730db615e Update 01-quickstart.md
Change S1AP bind address for external eNB.
2022-11-10 15:11:12 +09:00
Yarin Sergey
935f50bb24 Build WebUI from local source
Use local copy of source code to build WebUI,
instead of downloading the code from Github.
2022-11-08 23:02:46 +09:00
Bostjan Meglic
ba8a7ce1af [AMF] Add implicit_unsubscribe field to SDMSubscription 2022-11-08 15:57:21 +09:00
Sukchan Lee
4106207150 Rollback WebUI (#1882) 2022-11-07 22:57:33 +09:00
Yarin Sergey
4091484215 Build webui from local source
Use local copy of source code to build webui,
instead of downloading the code from Github.
2022-11-07 22:47:59 +09:00
Sukchan Lee
ddf09f270a [SMF] Fixed PTI when PDU Session Reject 2022-11-07 16:51:51 +09:00
Sukchan Lee
95459f8376 [WebUI] Change installation script (#1824) 2022-11-06 20:11:24 +09:00
Sukchan Lee
77c92eb37b Release v2.5.5 2022-11-04 20:39:19 +09:00
Sukchan Lee
0d4cd88379 Fixed the WebUI installation 2022-11-04 17:55:32 +09:00
Sukchan Lee
0a9f2e5c40 Fix the WebUI installation bug 2022-11-04 17:52:23 +09:00
Sukchan Lee
1cc6736fa8 Squashed commit of the following:
commit 5070c19a5469269d036bf243ebdb2740aefc7b8d
Author: Sukchan Lee <acetcom@gmail.com>
Date:   Fri Nov 4 15:46:35 2022 +0900

    updte it

commit e49107f46152ff6dce5658b48cfb2c31df61724a
Author: Sukchan Lee <acetcom@gmail.com>
Date:   Fri Nov 4 11:03:37 2022 +0900

    update it

commit a55b977e044b1d74ccc8a19f1dbf8194c3cd7daa
Author: Sukchan Lee <acetcom@gmail.com>
Date:   Fri Nov 4 10:50:41 2022 +0900

    update it

commit 0ff0930d99bfeb91134271dae0941b4c454d1a3d
Author: Sukchan Lee <acetcom@gmail.com>
Date:   Fri Nov 4 10:09:35 2022 +0900

    update it

commit 8cb5038b66d4a605446c6fc200b77f645f7ad328
Author: Sukchan Lee <acetcom@gmail.com>
Date:   Fri Nov 4 09:39:08 2022 +0900

    update it

commit 0a6829dfb6470f3d9b786363d49387fdc688e33b
Author: Sukchan Lee <acetcom@gmail.com>
Date:   Fri Nov 4 09:06:22 2022 +0900

    update it

commit ea85035300d9a42cc5f8f7ee300d28cd055f0f1c
Author: Sukchan Lee <acetcom@gmail.com>
Date:   Thu Nov 3 21:36:17 2022 +0900

    update it

commit e86ba621de332d3f712569cf0580fc8a5321adbd
Author: Sukchan Lee <acetcom@gmail.com>
Date:   Thu Nov 3 17:39:27 2022 +0900

    update it

commit 2c05df84eabeba7c277c622e5d810768b2895961
Author: Sukchan Lee <acetcom@gmail.com>
Date:   Thu Nov 3 16:20:47 2022 +0900

    update it

commit 43c88aed3f2001fdbc28ce0f11cc21dfcdc5906f
Author: Sukchan Lee <acetcom@gmail.com>
Date:   Wed Nov 2 22:17:37 2022 +0900

    update it

commit b374db4e02e7dd153944f5a6fdc2a50c434dfa09
Author: Sukchan Lee <acetcom@gmail.com>
Date:   Wed Nov 2 22:05:53 2022 +0900

    update it
2022-11-04 17:39:29 +09:00
Sukchan Lee
fa35b06963 Follow-up on #1876 2022-11-04 14:58:47 +09:00
Bostjan Meglic
00a86c5a73 [SBI] Do not send empty arrays when registering to NRF
OpenAPI dictates that certain arrays should have at least one item,
otherwise they should not be present.
This includes lists for IPv4/v6 addresses, TAI/TAC lists, ...

Add a check if there is at least 1 item, before creating an array.
Also move variable declarations to inner blocks, to prevent some
accidental usage out of wanted scope.
2022-11-04 14:58:33 +09:00
Sukchan Lee
406e3f07dc Release v2.5.4 2022-11-01 21:22:09 +09:00
EugeneBogush
5fd4fe9379 added open5gs-scp 2022-11-01 21:04:00 +09:00
Sukchan Lee
e9db0b0889 Release v2.5.3 2022-10-31 07:26:52 +09:00
EugeneBogush
2a2d5c5cfa fix for scp daemon (#1872)
* fix

* fix2

* fix
2022-10-31 07:14:53 +09:00
Sukchan Lee
9a7b75eb3b Release v2.5.2 2022-10-30 14:24:37 +09:00
Sukchan Lee
15e3c1f166 Fix to avoid port (7777) conflicts on Mac OS X 2022-10-30 13:58:28 +09:00
Sukchan Lee
cca53fb8e8 SCP had a serioud memory problem and fixed it 2022-10-30 13:35:25 +09:00
Sukchan Lee
243bf9850a [NAS] Discard message if Integrity failed (#1848) 2022-10-29 21:31:18 +09:00
Sukchan Lee
78359374ab Document update for v2.5.1 2022-10-29 12:47:04 +09:00
Sukchan Lee
3e22805941 Release v2.5.1 2022-10-29 12:41:27 +09:00
Sukchan Lee
0df2cba257 Support SMF Security Indication IE (#1851) 2022-10-29 12:26:09 +09:00
Sukchan Lee
f1c0b6d239 Fixed a bug WebUI for production build (#1824) 2022-10-28 14:44:06 +09:00
mitmitmitm
b9f6432e54 [AMF] Support REREGISTRATION_REQUIRED in dereg notify 2022-10-26 14:40:41 +09:00
Sukchan Lee
ead6f8e973 Update document for v2.5.0 2022-10-25 23:30:08 +09:00
Sukchan Lee
5ef88fcd01 Release v2.5.0 2022-10-25 22:49:28 +09:00
Sukchan Lee
67dd7d8633 Added missing files(SCP for systemd) 2022-10-25 22:35:58 +09:00
Sukchan Lee
844ec8a810 Release v2.5.0 2022-10-25 21:29:12 +09:00
Sukchan Lee
e3ba32c85d Fixed the bug of SGW-C session deletion (#1825) 2022-10-25 21:22:14 +09:00
Sukchan Lee
b151642fa1 SCP is added in Debian package 2022-10-25 21:20:09 +09:00
Sukchan Lee
e81265f015 Fixed the WebUI to Support MongoDB 6.0(#1824) 2022-10-25 21:15:44 +09:00
Sukchan Lee
ec4acd4eca remove warning in MacOSX (#1797) 2022-10-25 21:14:53 +09:00
Sukchan Lee
5ccb5f0f99 SCP(Model D) is now the default setting. 2022-10-22 11:26:04 +09:00
Sukchan Lee
7a14f2c505 Update README.md 2022-10-18 22:34:38 +09:00
Sukchan Lee
24e20f2503 Follow-up on #1827 2022-10-13 17:52:02 +09:00
jmasterfunk84
8fb85db310 [DBI] Disable Change Streams with mongo Version
Support for change stream is only available in mongoc >=1.9.0
- Disabled related functions in dbi.
Support for bson to json used in debug statement only in libbson >=1.7.0
- Simple debug message in lower versions
2022-10-13 17:33:35 +09:00
Sukchan Lee
0daef1686a Follow-up on #1827 2022-10-11 17:50:41 +09:00
Sukchan Lee
82863653eb Follow-up on #1828 2022-10-11 17:44:55 +09:00
Bostjan Meglic
395707831a [AMF] Reject registration requests when pool for UE contexts is empty
AMF does not crash anymore when a new UE registration request arrives,
and there is no available space left in UE context pool. Now it just
rejects the request with an error.
2022-10-11 17:35:50 +09:00
Bostjan Meglic
b019dce982 [AMF] Increase size of TMSI pool
Each UE context has 'current' and 'next' TMSI values. AMF first
allocates the 'next' value, before confirming it and releasing the
'previous'. This means that we potentially need pool size of 2x the
amount of maximum configured UE.

Without this change, AMF would crash in case that there are 'x'
configured maximum amount of UE, and there are already 'x' registered
UE.

[gmm] INFO: Registration request (../src/amf/gmm-sm.c:135)
[gmm] INFO: [suci-0-001-01-1234-0-1-1000000000]    SUCI (../src/amf/gmm-handler.c:149)
[gmm] DEBUG:     OLD TSC[UE:0,AMF:0] KSI[UE:7,AMF:0] (../src/amf/gmm-handler.c:179)
[gmm] DEBUG:     NEW TSC[UE:0,AMF:0] KSI[UE:7,AMF:0] (../src/amf/gmm-handler.c:186)
[amf] FATAL: amf_m_tmsi_alloc: Assertion `m_tmsi' failed. (../src/amf/context.c:2160)
[core] FATAL: backtrace() returned 13 addresses (../lib/core/ogs-abort.c:37)
2022-10-11 17:35:38 +09:00
Sukchan Lee
704fe72d11 Updated SBI module
- Introduced NF_INSTANCE_ID/NF_INSTANCE_TYPE
- Skip SCP in configuration validation
2022-10-08 11:48:12 +09:00
Sukchan Lee
3955e9ba8d Revert the previous commit on #1797 2022-10-07 14:06:30 +09:00
Sukchan Lee
d1ed8aa61d [SMF] Update PFCP report error situation (#1819) 2022-10-07 10:41:53 +09:00
Bostjan Meglic
a99a76d916 [AMF,UDM] Add support to subscribe to SDM changes
AMF subscribes to UDM for each registered UE.

At the moment, UDM does not send callback to AMF when any of the UE's
properties in the database changes.
At the moment, AMF does properly parse the ModificationNotification, but
does not do anything useful.
2022-10-06 21:20:10 +09:00
safaorhann
e9aaceee98 fix dropped_dl_traffic_threshold ie. 2022-10-06 10:40:08 +09:00
Sukchan Lee
dc6ca962bb Follow-up on #1797 2022-10-06 10:10:31 +09:00
Spencer Sevilla
be2af54682 ogs_info swaps CP and UP SEIDs 2022-10-05 17:41:42 +09:00
Sukchan Lee
6d27fbb8cc Follow-up on #1797 2022-10-05 14:50:52 +09:00
jmasterfunk84
15680003b5 [MME] Cancel Location while Idle (#1797)
* Cancel Location while Idle Fix

* Forgot about SGSAP on MME Change.

Added "action" to sgsap_send_detach..

* Make handle_clr uniform with other handlers

* Added Robustness for Any Detach Type

* Memory wasn't freed upon CLR for unknown IMSIs

* Moving MME Detach to new PR
2022-10-05 11:06:01 +09:00
Sukchan Lee
7c8722d9d4 [SBI] Client Request timeout
TS29.500
Ch 6.11 Detection and handling of late arriving requests

In Open5GS, this part was hard-corded.

HTTP2 Client sends a request and waits for 10 seconds.
If no response is received from the HTTP2 Server,
HTTP2 Client performs the exception handling.

In this commit, HTTP2 client sends Header with setting Max-Rsp-Time to 10 seconds.
However, HTTP2 server has not yet been implemented to process this value.
The server is still processing using hard-corded values (10 seconds).
2022-10-03 11:43:34 +09:00
Sukchan Lee
c537166d37 Follow-on up #1794 2022-10-02 19:41:52 +09:00
jmasterfunk84
1f2a8678ed [MME] Support for Insert Subscriber Data (#1794)
* [MME] Support for Insert Subscriber Data

* Supported AVPs in IDR will overwrite existing subscription information
* Provide error on partial APN updates
* IDR and ULA use same function to process AVPs
* Move subdatamask values into s6a, so both HSS and MME can use them
* Updates are not actioned at this time.  A Re-attach is required for
  most changes to take effect

* Memory issue on IDR exceptions

* Remove of handling MSIDSN change until DSR is used
2022-10-02 19:36:24 +09:00
Sukchan Lee
35ae3317b7 Added Release Notes for v2.4.11 2022-10-01 14:18:09 +09:00
226 changed files with 10574 additions and 5343 deletions

View File

@@ -2,7 +2,7 @@
## Getting Started
If you don't understand something about Open5GS, the [https://open5gs.org/open5gs/docs/](https://open5gs.org/open5gs/docs/) is a great place to look for answers.
Please follow the [documentation](https://open5gs.org/open5gs/docs/) at [open5gs.org](https://open5gs.org/)!
## Sponsors

View File

@@ -221,7 +221,7 @@ nssf:
- addr: 127.0.0.14
port: 7777
nsi:
- addr: ::1
- addr: 127.0.0.10
port: 7777
s_nssai:
sst: 1

View File

@@ -250,7 +250,7 @@ nssf:
- addr: 127.0.0.14
port: 7777
nsi:
- addr: ::1
- addr: 127.0.0.10
port: 7777
s_nssai:
sst: 1

View File

@@ -7,7 +7,7 @@
create 640 open5gs open5gs
postrotate
for i in nrfd pcrfd hssd ausfd udmd udrd upfd sgwcd sgwud smfd mmed amfd; do
for i in nrfd scpd pcrfd hssd ausfd udmd udrd upfd sgwcd sgwud smfd mmed amfd; do
systemctl reload open5gs-$i
done
endscript

View File

@@ -2,6 +2,7 @@
#
# logfilename [owner:group] mode count size when flags [/pid_file] [sig_num]
@localstatedir@/log/open5gs/nrf.log 644 14 * $D0 GZ @localstatedir@/run/open5gs-nrfd/pid`
@localstatedir@/log/open5gs/scp.log 644 14 * $D0 GZ @localstatedir@/run/open5gs-scpd/pid`
@localstatedir@/log/open5gs/pcrf.log 644 14 * $D0 GZ @localstatedir@/run/open5gs-pcrfd/pid`
@localstatedir@/log/open5gs/hss.log 644 14 * $D0 GZ @localstatedir@/run/open5gs-hssd/pid`
@localstatedir@/log/open5gs/ausf.log 644 14 * $D0 GZ @localstatedir@/run/open5gs-ausfd/pid`

View File

@@ -220,7 +220,7 @@ nssf:
- addr: 127.0.0.14
port: 7777
nsi:
- addr: ::1
- addr: 127.0.0.10
port: 7777
s_nssai:
sst: 1

View File

@@ -20,6 +20,7 @@
#
logger:
file: @localstatedir@/log/open5gs/amf.log
#
# amf:
#
@@ -118,6 +119,29 @@ logger:
# 'service-names' is always included in the URI query parameter.
# * That is, 'no_service_names' has no effect.
#
# <For Indirect Communication with Delegated Discovery>
#
# o (Default) If you do not set Delegated Discovery as shown below,
#
# sbi:
# - addr: 127.0.0.5
# port: 7777
#
# - Use SCP if SCP avaiable. Otherwise NRF is used.
# => App fails if both NRF and SCP are unavailable.
#
# sbi:
# - addr: 127.0.0.5
# port: 7777
# discovery:
# delegated: auto
#
# o To use SCP always => App fails if no SCP available.
# delegated: yes
#
# o Don't use SCP server => App fails if no NRF available.
# delegated: no
#
# <NGAP Server>>
#
# o NGAP Server(all address available)
@@ -298,6 +322,50 @@ amf:
full: Open5GS
amf_name: open5gs-amf0
#
# scp:
#
# <SBI Client>>
#
# o SBI Client(http://127.0.1.10:7777)
# sbi:
# addr: 127.0.1.10
# port: 7777
#
# o SBI Client(https://127.0.1.10:443, http://scp.open5gs.org:80)
# sbi:
# - addr: 127.0.1.10
# tls:
# key: scp.key
# pem: scp.pem
# - name: scp.open5gs.org
#
# o SBI Client(http://[fd69:f21d:873c:fb::1]:80)
# If prefer_ipv4 is true, http://127.0.1.10:80 is selected.
#
# sbi:
# addr:
# - 127.0.1.10
# - fd69:f21d:873c:fb::1
#
# o SBI Option (Default)
# - tcp_nodelay : true
# - so_linger.l_onoff : false
#
# sbi:
# addr: 127.0.1.10
# option:
# tcp_nodelay: false
# so_linger:
# l_onoff: true
# l_linger: 10
#
#
scp:
sbi:
- addr: 127.0.1.10
port: 7777
#
# nrf:
#
@@ -336,12 +404,12 @@ amf:
# l_onoff: true
# l_linger: 10
#
nrf:
sbi:
- addr:
- 127.0.0.10
- ::1
port: 7777
#nrf:
# sbi:
# - addr:
# - 127.0.0.10
# - ::1
# port: 7777
#
# parameter:

View File

@@ -20,6 +20,7 @@
#
logger:
file: @localstatedir@/log/open5gs/ausf.log
#
# ausf:
#
@@ -118,11 +119,78 @@ logger:
# 'service-names' is always included in the URI query parameter.
# * That is, 'no_service_names' has no effect.
#
# <For Indirect Communication with Delegated Discovery>
#
# o (Default) If you do not set Delegated Discovery as shown below,
#
# sbi:
# - addr: 127.0.0.11
# port: 7777
#
# - Use SCP if SCP avaiable. Otherwise NRF is used.
# => App fails if both NRF and SCP are unavailable.
#
# sbi:
# - addr: 127.0.0.11
# port: 7777
# discovery:
# delegated: auto
#
# o To use SCP always => App fails if no SCP available.
# delegated: yes
#
# o Don't use SCP server => App fails if no NRF available.
# delegated: no
#
ausf:
sbi:
- addr: 127.0.0.11
port: 7777
#
# scp:
#
# <SBI Client>>
#
# o SBI Client(http://127.0.1.10:7777)
# sbi:
# addr: 127.0.1.10
# port: 7777
#
# o SBI Client(https://127.0.1.10:443, http://scp.open5gs.org:80)
# sbi:
# - addr: 127.0.1.10
# tls:
# key: scp.key
# pem: scp.pem
# - name: scp.open5gs.org
#
# o SBI Client(http://[fd69:f21d:873c:fb::1]:80)
# If prefer_ipv4 is true, http://127.0.1.10:80 is selected.
#
# sbi:
# addr:
# - 127.0.1.10
# - fd69:f21d:873c:fb::1
#
# o SBI Option (Default)
# - tcp_nodelay : true
# - so_linger.l_onoff : false
#
# sbi:
# addr: 127.0.1.10
# option:
# tcp_nodelay: false
# so_linger:
# l_onoff: true
# l_linger: 10
#
#
scp:
sbi:
- addr: 127.0.1.10
port: 7777
#
# nrf:
#
@@ -161,12 +229,12 @@ ausf:
# l_onoff: true
# l_linger: 10
#
nrf:
sbi:
- addr:
- 127.0.0.10
- ::1
port: 7777
#nrf:
# sbi:
# - addr:
# - 127.0.0.10
# - ::1
# port: 7777
#
# parameter:

View File

@@ -22,6 +22,7 @@ db_uri: mongodb://localhost/open5gs
#
logger:
file: @localstatedir@/log/open5gs/bsf.log
#
# bsf:
#
@@ -120,11 +121,78 @@ logger:
# 'service-names' is always included in the URI query parameter.
# * That is, 'no_service_names' has no effect.
#
# <For Indirect Communication with Delegated Discovery>
#
# o (Default) If you do not set Delegated Discovery as shown below,
#
# sbi:
# - addr: 127.0.0.15
# port: 7777
#
# - Use SCP if SCP avaiable. Otherwise NRF is used.
# => App fails if both NRF and SCP are unavailable.
#
# sbi:
# - addr: 127.0.0.15
# port: 7777
# discovery:
# delegated: auto
#
# o To use SCP always => App fails if no SCP available.
# delegated: yes
#
# o Don't use SCP server => App fails if no NRF available.
# delegated: no
#
bsf:
sbi:
- addr: 127.0.0.15
port: 7777
#
# scp:
#
# <SBI Client>>
#
# o SBI Client(http://127.0.1.10:7777)
# sbi:
# addr: 127.0.1.10
# port: 7777
#
# o SBI Client(https://127.0.1.10:443, http://scp.open5gs.org:80)
# sbi:
# - addr: 127.0.1.10
# tls:
# key: scp.key
# pem: scp.pem
# - name: scp.open5gs.org
#
# o SBI Client(http://[fd69:f21d:873c:fb::1]:80)
# If prefer_ipv4 is true, http://127.0.1.10:80 is selected.
#
# sbi:
# addr:
# - 127.0.1.10
# - fd69:f21d:873c:fb::1
#
# o SBI Option (Default)
# - tcp_nodelay : true
# - so_linger.l_onoff : false
#
# sbi:
# addr: 127.0.1.10
# option:
# tcp_nodelay: false
# so_linger:
# l_onoff: true
# l_linger: 10
#
#
scp:
sbi:
- addr: 127.0.1.10
port: 7777
#
# nrf:
#
@@ -163,12 +231,12 @@ bsf:
# l_onoff: true
# l_linger: 10
#
nrf:
sbi:
- addr:
- 127.0.0.10
- ::1
port: 7777
#nrf:
# sbi:
# - addr:
# - 127.0.0.10
# - ::1
# port: 7777
#
# parameter:

View File

@@ -92,6 +92,50 @@ nrf:
- ::1
port: 7777
#
# scp:
#
# <SBI Client>>
#
# o SBI Client(http://127.0.1.10:7777)
# sbi:
# addr: 127.0.1.10
# port: 7777
#
# o SBI Client(https://127.0.1.10:443, http://scp.open5gs.org:80)
# sbi:
# - addr: 127.0.1.10
# tls:
# key: scp.key
# pem: scp.pem
# - name: scp.open5gs.org
#
# o SBI Client(http://[fd69:f21d:873c:fb::1]:80)
# If prefer_ipv4 is true, http://127.0.1.10:80 is selected.
#
# sbi:
# addr:
# - 127.0.1.10
# - fd69:f21d:873c:fb::1
#
# o SBI Option (Default)
# - tcp_nodelay : true
# - so_linger.l_onoff : false
#
# sbi:
# addr: 127.0.1.10
# option:
# tcp_nodelay: false
# so_linger:
# l_onoff: true
# l_linger: 10
#
#
scp:
sbi:
- addr: 127.0.1.10
port: 7777
#
# parameter:
#

View File

@@ -20,6 +20,7 @@
#
logger:
file: @localstatedir@/log/open5gs/nssf.log
#
# nssf:
#
@@ -168,16 +169,83 @@ logger:
# 'service-names' is always included in the URI query parameter.
# * That is, 'no_service_names' has no effect.
#
# <For Indirect Communication with Delegated Discovery>
#
# o (Default) If you do not set Delegated Discovery as shown below,
#
# sbi:
# - addr: 127.0.0.14
# port: 7777
#
# - Use SCP if SCP avaiable. Otherwise NRF is used.
# => App fails if both NRF and SCP are unavailable.
#
# sbi:
# - addr: 127.0.0.14
# port: 7777
# discovery:
# delegated: auto
#
# o To use SCP always => App fails if no SCP available.
# delegated: yes
#
# o Don't use SCP server => App fails if no NRF available.
# delegated: no
#
nssf:
sbi:
- addr: 127.0.0.14
port: 7777
nsi:
- addr: ::1
- addr: 127.0.0.10
port: 7777
s_nssai:
sst: 1
#
# scp:
#
# <SBI Client>>
#
# o SBI Client(http://127.0.1.10:7777)
# sbi:
# addr: 127.0.1.10
# port: 7777
#
# o SBI Client(https://127.0.1.10:443, http://scp.open5gs.org:80)
# sbi:
# - addr: 127.0.1.10
# tls:
# key: scp.key
# pem: scp.pem
# - name: scp.open5gs.org
#
# o SBI Client(http://[fd69:f21d:873c:fb::1]:80)
# If prefer_ipv4 is true, http://127.0.1.10:80 is selected.
#
# sbi:
# addr:
# - 127.0.1.10
# - fd69:f21d:873c:fb::1
#
# o SBI Option (Default)
# - tcp_nodelay : true
# - so_linger.l_onoff : false
#
# sbi:
# addr: 127.0.1.10
# option:
# tcp_nodelay: false
# so_linger:
# l_onoff: true
# l_linger: 10
#
#
scp:
sbi:
- addr: 127.0.1.10
port: 7777
#
# nrf:
#
@@ -204,12 +272,12 @@ nssf:
# - 127.0.0.10
# - fd69:f21d:873c:fa::1
#
nrf:
sbi:
- addr:
- 127.0.0.10
- ::1
port: 7777
#nrf:
# sbi:
# - addr:
# - 127.0.0.10
# - ::1
# port: 7777
#
# parameter:

View File

@@ -22,6 +22,7 @@ db_uri: mongodb://localhost/open5gs
#
logger:
file: @localstatedir@/log/open5gs/pcf.log
#
# pcf:
#
@@ -127,11 +128,78 @@ logger:
# 'service-names' is always included in the URI query parameter.
# * That is, 'no_service_names' has no effect.
#
# <For Indirect Communication with Delegated Discovery>
#
# o (Default) If you do not set Delegated Discovery as shown below,
#
# sbi:
# - addr: 127.0.0.13
# port: 7777
#
# - Use SCP if SCP avaiable. Otherwise NRF is used.
# => App fails if both NRF and SCP are unavailable.
#
# sbi:
# - addr: 127.0.0.13
# port: 7777
# discovery:
# delegated: auto
#
# o To use SCP always => App fails if no SCP available.
# delegated: yes
#
# o Don't use SCP server => App fails if no NRF available.
# delegated: no
#
pcf:
sbi:
- addr: 127.0.0.13
port: 7777
#
# scp:
#
# <SBI Client>>
#
# o SBI Client(http://127.0.1.10:7777)
# sbi:
# addr: 127.0.1.10
# port: 7777
#
# o SBI Client(https://127.0.1.10:443, http://scp.open5gs.org:80)
# sbi:
# - addr: 127.0.1.10
# tls:
# key: scp.key
# pem: scp.pem
# - name: scp.open5gs.org
#
# o SBI Client(http://[fd69:f21d:873c:fb::1]:80)
# If prefer_ipv4 is true, http://127.0.1.10:80 is selected.
#
# sbi:
# addr:
# - 127.0.1.10
# - fd69:f21d:873c:fb::1
#
# o SBI Option (Default)
# - tcp_nodelay : true
# - so_linger.l_onoff : false
#
# sbi:
# addr: 127.0.1.10
# option:
# tcp_nodelay: false
# so_linger:
# l_onoff: true
# l_linger: 10
#
#
scp:
sbi:
- addr: 127.0.1.10
port: 7777
#
# nrf:
#
@@ -170,12 +238,12 @@ pcf:
# l_onoff: true
# l_linger: 10
#
nrf:
sbi:
- addr:
- 127.0.0.10
- ::1
port: 7777
#nrf:
# sbi:
# - addr:
# - 127.0.0.10
# - ::1
# port: 7777
#
# parameter:

View File

@@ -88,19 +88,10 @@ logger:
# l_onoff: true
# l_linger: 10
#
# <Next hop SCP>
#
# o Next hop SCP Server(https://127.0.1.11:7777)
# next_scp:
# sbi:
# - addr: 127.0.1.11
# port: 7777
#
# <For Indirect Communication with Delegated Discovery>
#
# o (Default) If you do not set Delegated Discovery as shown below,
#
# next_scp:
# sbi:
# - addr: 127.0.1.10
# port: 7777
@@ -108,7 +99,6 @@ logger:
# - Use SCP if SCP avaiable. Otherwise NRF is used.
# => App fails if both NRF and SCP are unavailable.
#
# next_scp:
# sbi:
# - addr: 127.0.1.10
# port: 7777
@@ -126,6 +116,45 @@ scp:
- addr: 127.0.1.10
port: 7777
#
# next_scp:
#
# <Next hop SCP>
#
# o SBI Client(http://127.0.1.11:7777)
# sbi:
# addr: 127.0.1.11
# port: 7777
#
# o SBI Client(https://127.0.1.11:443, http://next-scp.open5gs.org:80)
# sbi:
# - addr: 127.0.1.11
# tls:
# key: next-scp.key
# pem: next-scp.pem
# - name: next-scp.open5gs.org
#
# o SBI Client(http://[fd69:f21d:873c:fb::1]:80)
# If prefer_ipv4 is true, http://127.0.1.11:80 is selected.
#
# sbi:
# addr:
# - 127.0.1.11
# - fd69:f21d:873c:fb::1
#
# o SBI Option (Default)
# - tcp_nodelay : true
# - so_linger.l_onoff : false
#
# sbi:
# addr: 127.0.1.11
# option:
# tcp_nodelay: false
# so_linger:
# l_onoff: true
# l_linger: 10
#
#
# nrf:
#

View File

@@ -20,6 +20,7 @@
#
logger:
file: @localstatedir@/log/open5gs/smf.log
#
# smf:
#
@@ -118,6 +119,29 @@ logger:
# 'service-names' is always included in the URI query parameter.
# * That is, 'no_service_names' has no effect.
#
# <For Indirect Communication with Delegated Discovery>
#
# o (Default) If you do not set Delegated Discovery as shown below,
#
# sbi:
# - addr: 127.0.0.4
# port: 7777
#
# - Use SCP if SCP avaiable. Otherwise NRF is used.
# => App fails if both NRF and SCP are unavailable.
#
# sbi:
# - addr: 127.0.0.4
# port: 7777
# discovery:
# delegated: auto
#
# o To use SCP always => App fails if no SCP available.
# delegated: yes
#
# o Don't use SCP server => App fails if no NRF available.
# delegated: no
#
#
# <PFCP Server>
#
@@ -416,7 +440,20 @@ logger:
# mnc: 70
# tac: 99
#
# <Security Indication - 5G Core only>
#
# According to 3GPP TS38.413 Section 9.3.1.27,
# Security Indication IE may be instructed to 5G gNB.
#
# If you set the security_indication in smf.yaml,
# this information is delivered using PDU Session Resource Request Transfer IE
#
# security_indication:
# integrity_protection_indication: required|preferred|not-needed
# confidentiality_protection_indication: required|preferred|not-needed
# maximum_integrity_protected_data_rate_uplink: bitrate64kbs|maximum-UE-rate
# maximum_integrity_protected_data_rate_downlink: bitrate64kbs|maximum-UE-rate
#
smf:
sbi:
- addr: 127.0.0.4
@@ -446,6 +483,50 @@ smf:
enabled: auto
freeDiameter: @sysconfdir@/freeDiameter/smf.conf
#
# scp:
#
# <SBI Client>>
#
# o SBI Client(http://127.0.1.10:7777)
# sbi:
# addr: 127.0.1.10
# port: 7777
#
# o SBI Client(https://127.0.1.10:443, http://scp.open5gs.org:80)
# sbi:
# - addr: 127.0.1.10
# tls:
# key: scp.key
# pem: scp.pem
# - name: scp.open5gs.org
#
# o SBI Client(http://[fd69:f21d:873c:fb::1]:80)
# If prefer_ipv4 is true, http://127.0.1.10:80 is selected.
#
# sbi:
# addr:
# - 127.0.1.10
# - fd69:f21d:873c:fb::1
#
# o SBI Option (Default)
# - tcp_nodelay : true
# - so_linger.l_onoff : false
#
# sbi:
# addr: 127.0.1.10
# option:
# tcp_nodelay: false
# so_linger:
# l_onoff: true
# l_linger: 10
#
#
scp:
sbi:
- addr: 127.0.1.10
port: 7777
#
# nrf:
#
@@ -484,12 +565,12 @@ smf:
# l_onoff: true
# l_linger: 10
#
nrf:
sbi:
- addr:
- 127.0.0.10
- ::1
port: 7777
#nrf:
# sbi:
# - addr:
# - 127.0.0.10
# - ::1
# port: 7777
#
# upf:

View File

@@ -20,6 +20,7 @@
#
logger:
file: @localstatedir@/log/open5gs/udm.log
#
# udm:
#
@@ -120,11 +121,78 @@ logger:
# 'service-names' is always included in the URI query parameter.
# * That is, 'no_service_names' has no effect.
#
# <For Indirect Communication with Delegated Discovery>
#
# o (Default) If you do not set Delegated Discovery as shown below,
#
# sbi:
# - addr: 127.0.0.12
# port: 7777
#
# - Use SCP if SCP avaiable. Otherwise NRF is used.
# => App fails if both NRF and SCP are unavailable.
#
# sbi:
# - addr: 127.0.0.12
# port: 7777
# discovery:
# delegated: auto
#
# o To use SCP always => App fails if no SCP available.
# delegated: yes
#
# o Don't use SCP server => App fails if no NRF available.
# delegated: no
#
udm:
sbi:
- addr: 127.0.0.12
port: 7777
#
# scp:
#
# <SBI Client>>
#
# o SBI Client(http://127.0.1.10:7777)
# sbi:
# addr: 127.0.1.10
# port: 7777
#
# o SBI Client(https://127.0.1.10:443, http://scp.open5gs.org:80)
# sbi:
# - addr: 127.0.1.10
# tls:
# key: scp.key
# pem: scp.pem
# - name: scp.open5gs.org
#
# o SBI Client(http://[fd69:f21d:873c:fb::1]:80)
# If prefer_ipv4 is true, http://127.0.1.10:80 is selected.
#
# sbi:
# addr:
# - 127.0.1.10
# - fd69:f21d:873c:fb::1
#
# o SBI Option (Default)
# - tcp_nodelay : true
# - so_linger.l_onoff : false
#
# sbi:
# addr: 127.0.1.10
# option:
# tcp_nodelay: false
# so_linger:
# l_onoff: true
# l_linger: 10
#
#
scp:
sbi:
- addr: 127.0.1.10
port: 7777
#
# nrf:
#
@@ -163,12 +231,12 @@ udm:
# l_onoff: true
# l_linger: 10
#
nrf:
sbi:
- addr:
- 127.0.0.10
- ::1
port: 7777
#nrf:
# sbi:
# - addr:
# - 127.0.0.10
# - ::1
# port: 7777
#
# parameter:

View File

@@ -22,6 +22,7 @@ db_uri: mongodb://localhost/open5gs
#
logger:
file: @localstatedir@/log/open5gs/udr.log
#
# udr:
#
@@ -120,11 +121,78 @@ logger:
# 'service-names' is always included in the URI query parameter.
# * That is, 'no_service_names' has no effect.
#
# <For Indirect Communication with Delegated Discovery>
#
# o (Default) If you do not set Delegated Discovery as shown below,
#
# sbi:
# - addr: 127.0.0.20
# port: 7777
#
# - Use SCP if SCP avaiable. Otherwise NRF is used.
# => App fails if both NRF and SCP are unavailable.
#
# sbi:
# - addr: 127.0.0.20
# port: 7777
# discovery:
# delegated: auto
#
# o To use SCP always => App fails if no SCP available.
# delegated: yes
#
# o Don't use SCP server => App fails if no NRF available.
# delegated: no
#
udr:
sbi:
- addr: 127.0.0.20
port: 7777
#
# scp:
#
# <SBI Client>>
#
# o SBI Client(http://127.0.1.10:7777)
# sbi:
# addr: 127.0.1.10
# port: 7777
#
# o SBI Client(https://127.0.1.10:443, http://scp.open5gs.org:80)
# sbi:
# - addr: 127.0.1.10
# tls:
# key: scp.key
# pem: scp.pem
# - name: scp.open5gs.org
#
# o SBI Client(http://[fd69:f21d:873c:fb::1]:80)
# If prefer_ipv4 is true, http://127.0.1.10:80 is selected.
#
# sbi:
# addr:
# - 127.0.1.10
# - fd69:f21d:873c:fb::1
#
# o SBI Option (Default)
# - tcp_nodelay : true
# - so_linger.l_onoff : false
#
# sbi:
# addr: 127.0.1.10
# option:
# tcp_nodelay: false
# so_linger:
# l_onoff: true
# l_linger: 10
#
#
scp:
sbi:
- addr: 127.0.1.10
port: 7777
#
# nrf:
#
@@ -163,12 +231,12 @@ udr:
# l_onoff: true
# l_linger: 10
#
nrf:
sbi:
- addr:
- 127.0.0.10
- ::1
port: 7777
#nrf:
# sbi:
# - addr:
# - 127.0.0.10
# - ::1
# port: 7777
#
# parameter:

View File

@@ -285,7 +285,7 @@ nssf:
- addr: 127.0.0.14
port: 7777
nsi:
- addr: ::1
- addr: 127.0.0.10
port: 7777
s_nssai:
sst: 1

View File

@@ -216,7 +216,7 @@ nssf:
- addr: 127.0.0.14
port: 7777
nsi:
- addr: ::1
- addr: 127.0.0.10
port: 7777
s_nssai:
sst: 1

View File

@@ -25,6 +25,7 @@ systemd_conf_in = '''
open5gs-hssd.service
open5gs-pcrfd.service
open5gs-nrfd.service
open5gs-scpd.service
open5gs-ausfd.service
open5gs-udmd.service
open5gs-pcfd.service

View File

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

View File

@@ -223,7 +223,7 @@ nssf:
- addr: 127.0.0.14
port: 7777
nsi:
- addr: ::1
- addr: 127.0.0.10
port: 7777
s_nssai:
sst: 1

View File

@@ -226,7 +226,7 @@ nssf:
- addr: 127.0.0.14
port: 7777
nsi:
- addr: ::1
- addr: 127.0.0.10
port: 7777
s_nssai:
sst: 1

30
debian/changelog vendored
View File

@@ -1,3 +1,33 @@
open5gs (2.5.6) unstable; urgency=medium
* New NF - SCP(Service Communication Proxy)
-- Sukchan Lee <acetcom@gmail.com> Fri, 18 Nov 2022 23:24:32 +0900
open5gs (2.5.6~jammy5) jammy; urgency=medium
* New NF - SCP(Service Communication Proxy)
-- Sukchan Lee <acetcom@gmail.com> Fri, 18 Nov 2022 23:23:07 +0900
open5gs (2.5.6~kinetic3) kinetic; urgency=medium
* New NF - SCP(Service Communication Proxy)
-- Sukchan Lee <acetcom@gmail.com> Fri, 18 Nov 2022 23:21:16 +0900
open5gs (2.5.6~bionic3) bionic; urgency=medium
* New NF - SCP(Service Communication Proxy)
-- Sukchan Lee <acetcom@gmail.com> Fri, 18 Nov 2022 23:18:33 +0900
open5gs (2.5.6~focal3) focal; urgency=medium
* New NF - SCP(Service Communication Proxy)
-- Sukchan Lee <acetcom@gmail.com> Fri, 18 Nov 2022 23:17:05 +0900
open5gs (2.4.11) unstable; urgency=medium
* Bug Fixed

13
debian/control vendored
View File

@@ -165,6 +165,18 @@ Description: NRF (Network Repository Function)
.
This package provides the NRF (Network Repository Function)
Package: open5gs-scp
Architecture: any
Multi-Arch: same
Depends: ${shlibs:Depends},
${misc:Depends},
open5gs-common (= ${binary:Version})
Description: SCP (Network Repository Function)
Open5GS is a C-language implementation of 5G Core and EPC
Packet Core, i.e. the core network of an NR/LTE network (Release-16)
.
This package provides the SCP (Service Communication Proxy)
Package: open5gs-ausf
Architecture: any
Multi-Arch: same
@@ -251,6 +263,7 @@ Depends: ${misc:Depends},
open5gs-hss (= ${binary:Version}),
open5gs-pcrf (= ${binary:Version}),
open5gs-nrf (= ${binary:Version}),
open5gs-scp (= ${binary:Version}),
open5gs-ausf (= ${binary:Version}),
open5gs-udm (= ${binary:Version}),
open5gs-pcf (= ${binary:Version}),

View File

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

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

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

View File

@@ -1,52 +1,32 @@
Docker running example
===========================================
* Build Image
* Development
`$ docker-compose build`
`$ docker compose run dev`
* Development
* Run WebUI
`$ docker-compose run dev`
* Runtime
```
$ docker-compose \
-f docker-compose.yml -f docker-compose.run.yml run run
```
`$ docker-compose up webui`
* Test
```
$ docker-compose \
-f docker-compose.yml -f docker-compose.test.yml run test
```
* Test(ubuntu:artful)
```
$ TAG=eoan docker-compose build
$ TAG=eoan docker-compose \
-f docker-compose.yml -f docker-compose.test.yml run test
```
`$ docker compose run test`
* Test(ubuntu:focal)
`$ TAG=focal docker compose run test`
* Development(fedora:latest)
```
$ DIST=fedora docker-compose build
$ DIST=fedora docker-compose run dev
```
* Runtime(debian:jessie)
```
$ DIST=debian TAG=stretch docker-compose build
$ DIST=debian TAG=stretch docker-compose
-f docker-compose.yml -f docker-compose.run.yml run run
```
`$ DIST=fedora docker compose run dev`
* All Test with All Environment
`$ ./check.sh`
* Run WebUI
`$ docker-compose up -d`
* Runtime
`$ docker compose run run`
For OpenSUSE Build Service Release
===========================================
@@ -100,8 +80,18 @@ export DEBEMAIL='acetcom@gmail.com'
* Version Change
```
$ vi meson.build
$ ./misc/git-version-gen . > .tarball-version 2>/dev/null
$ cat ./meson.build
$ cat ./webui/package.json
$ cat ./webui/package-lock.json
$ cat ./docs/assets/webui/install
```
* New NF
```
$ cat debian/control
$ cat configs/systemd/open5gs-scpd.service.in
$ cat configs/logrotate/open5gs.in
$ cat configs/newsyslog/open5gs.conf.in
```
* Upload OpenBuildService

View File

@@ -9,4 +9,7 @@ WORKDIR /open5gs
COPY docker/build/setup.sh /root
COPY ./ /open5gs
ADD https://github.com/ufoscout/docker-compose-wait/releases/download/2.9.0/wait /wait
RUN chmod +x /wait
RUN meson build && ninja -C build install

View File

@@ -1,15 +1,9 @@
#!/bin/sh
docker-compose build
docker-compose -f docker-compose.yml -f docker-compose.test.yml run --rm test
TAG=bionic docker-compose build
TAG=bionic docker-compose -f docker-compose.yml -f docker-compose.test.yml run --rm test
DIST=fedora TAG=32 docker-compose build
DIST=fedora TAG=32 docker-compose -f docker-compose.yml -f docker-compose.test.yml run --rm test
DIST=debian docker-compose build
DIST=debian docker-compose -f docker-compose.yml -f docker-compose.test.yml run --rm test
docker compose run --rm test
TAG=focal docker compose run --rm test
DIST=fedora docker compose run --rm test
DIST=debian docker compose run --rm test
#DIST=alpine docker compose run --rm test
docker rm $(docker ps -qa --no-trunc --filter "status=exited")

View File

@@ -1,22 +0,0 @@
version: '3'
services:
run:
network_mode: "host"
image: ${USER}/${DIST-ubuntu}-${TAG-latest}-open5gs-build
depends_on:
- mongodb
- build
cap_add:
- NET_ADMIN
devices:
- "/dev/net/tun:/dev/net/tun"
sysctls:
- net.ipv6.conf.all.disable_ipv6=0
volumes:
- config:/etc/open5gs
hostname: open5gs-run
command: /bin/bash -c "/root/setup.sh; /usr/bin/open5gs-pcrfd -D; /usr/bin/open5gs-pgwd -D; /usr/bin/open5gs-sgwd -D; /usr/bin/open5gs-hssd -D; /usr/bin/open5gs-mmed"
volumes:
config: {}

View File

@@ -1,18 +0,0 @@
version: '3'
services:
test:
image: ${USER}/${DIST-ubuntu}-${TAG-latest}-open5gs-build
depends_on:
- mongodb
- build
environment:
DB_URI: mongodb://mongodb/open5gs
cap_add:
- NET_ADMIN
devices:
- "/dev/net/tun:/dev/net/tun"
sysctls:
- net.ipv6.conf.all.disable_ipv6=0
hostname: open5gs-test
command: /bin/bash -c "/root/setup.sh; cd /open5gs/build && meson test -v"

View File

@@ -6,21 +6,24 @@ services:
container_name: open5gs-mongodb
ports:
- "27017:27017"
restart: unless-stopped
volumes:
- mongodb:/data/db
- ../docs/assets/webui/mongo-init.js:/docker-entrypoint-initdb.d/mongo-init.js:ro
webui:
build: webui
build:
context: ../
dockerfile: docker/webui/Dockerfile
image: ${USER}/open5gs-webui
container_name: open5gs-webui
depends_on:
- mongodb
ports:
- "3000:3000"
depends_on:
- mongodb
environment:
DB_URI: mongodb://mongodb/open5gs
- DB_URI=mongodb://mongodb/open5gs
- WAIT_HOSTS=mongodb:27017
base:
build:
@@ -44,6 +47,40 @@ services:
- base
command: /bin/bash -c "echo 'build' services"
run:
# network_mode: "host"
image: ${USER}/${DIST-ubuntu}-${TAG-latest}-open5gs-build
depends_on:
- mongodb
- build
cap_add:
- NET_ADMIN
devices:
- "/dev/net/tun:/dev/net/tun"
sysctls:
- net.ipv6.conf.all.disable_ipv6=0
volumes:
- config:/etc/open5gs
hostname: open5gs-run
# command: /bin/bash -c "/root/setup.sh; /usr/bin/open5gs-pcrfd -D; /usr/bin/open5gs-pgwd -D; /usr/bin/open5gs-sgwd -D; /usr/bin/open5gs-hssd -D; /usr/bin/open5gs-mmed"
test:
image: ${USER}/${DIST-ubuntu}-${TAG-latest}-open5gs-build
depends_on:
- mongodb
- build
environment:
- DB_URI=mongodb://mongodb/open5gs
- WAIT_HOSTS=mongodb:27017
cap_add:
- NET_ADMIN
devices:
- "/dev/net/tun:/dev/net/tun"
sysctls:
- net.ipv6.conf.all.disable_ipv6=0
hostname: open5gs-test
command: /bin/bash -c "/root/setup.sh; cd /open5gs/build && /wait && meson test -v"
dev:
build:
context: ./${DIST-ubuntu}/${TAG-latest}/dev
@@ -83,3 +120,4 @@ services:
volumes:
mongodb: {}
home: {}
config: {}

View File

@@ -1,21 +1,16 @@
FROM node:carbon
FROM node:19
MAINTAINER Sukchan Lee <acetcom@gmail.com>
ARG PACKAGE=open5gs
ARG VERSION=2.2.6
RUN set -e; \
cd /usr/src; \
rm -rf ./$PACKAGE; \
curl -SLO "https://github.com/open5gs/$PACKAGE/archive/v$VERSION.tar.gz"; \
tar -xvf v$VERSION.tar.gz; \
mv ./$PACKAGE-$VERSION/ ./$PACKAGE;
COPY webui /usr/src/open5gs/webui
WORKDIR /usr/src/open5gs/webui
RUN npm install && \
RUN npm clean-install && \
npm run build
CMD npm run start
ADD https://github.com/ufoscout/docker-compose-wait/releases/download/2.9.0/wait /wait
RUN chmod +x /wait
CMD /wait && npm run start
EXPOSE 3000

View File

@@ -44,18 +44,19 @@ All of these Open5GS components have config files. Each config file contains the
#### 5G SA Core
The Open5GS 5G SA Core contains the following functions:
* NRF - NF Repository Function
* SCP - Service Communication Proxy
* AMF - Access and Mobility Management Function
* SMF - Session Management Function
* UPF - User Plane Function
* AUSF - Authentication Server Function
* NRF - NF Repository Function
* UDM - Unified Data Management
* UDR - Unified Data Repository
* PCF - Policy and Charging Function
* NSSF - Network Slice Selection Function
* BSF - Binding Support Function
The 5G SA core works in a different way to the 4G core - it uses a **Service Based Architecture** (SBI). **Control plane** functions are configured to register with the NRF, and the NRF then helps them discover the other core functions. Running through the other functions: The AMF handles connection and mobility management; a subset of what the 4G MME is tasked with. gNBs (5G basestations) connect to the AMF. The UDM, AUSF and UDR carry out similar operations as the 4G HSS, generating SIM authentication vectors and holding the subscriber profile. Session management is all handled by the SMF (previously the responsibility of the 4G MME/ SGWC/ PGWC). The NSSF provides a way to select the network slice. Finally there is the PCF, used for charging and enforcing subscriber policies.
The 5G SA core works in a different way to the 4G core - it uses a **Service Based Architecture** (SBI). **Control plane** functions are configured to register with the NRF, and the NRF then helps them discover the other core functions. Running through the other functions: The AMF handles connection and mobility management; a subset of what the 4G MME is tasked with. gNBs (5G basestations) connect to the AMF. The UDM, AUSF and UDR carry out similar operations as the 4G HSS, generating SIM authentication vectors and holding the subscriber profile. Session management is all handled by the SMF (previously the responsibility of the 4G MME/ SGWC/ PGWC). The NSSF provides a way to select the network slice, and PCF is used for charging and enforcing subscriber policies. Finally there is the SCP that enable indirect communication.
The 5G SA core **user plane** is much simpler, as it only contains a single function. The UPF carries user data packets between the gNB and the external WAN. It connects back to the SMF too.
@@ -70,14 +71,36 @@ With the exception of the SMF and UPF, all config files for the 5G SA core funct
**Note:** Nighly builds are offered by [Osmocom](https://osmocom.org) on [OBS](https://build.opensuse.org/package/show/network:osmocom:nightly/open5gs). Scroll down to use a nightly build package.
{: .notice--warning}
#### Getting MongoDB
---
Import the public key used by the package management system.
```bash
$ sudo apt update
$ sudo apt install wget gnupg
$ wget -qO - https://www.mongodb.org/static/pgp/server-6.0.asc | sudo apt-key add -
```
Create the list file /etc/apt/sources.list.d/mongodb-org-6.0.list for your version of Ubuntu.
```bash
$ echo "deb [ arch=amd64,arm64 ] https://repo.mongodb.org/apt/ubuntu focal/mongodb-org/6.0 multiverse" | sudo tee /etc/apt/sources.list.d/mongodb-org-6.0.list
```
Install the MongoDB packages.
```bash
$ sudo apt update
$ sudo apt-get install -y mongodb-org
$ sudo systemctl start mongod (if '/usr/bin/mongod' is not running)
$ sudo systemctl enable mongod (ensure to automatically start it on system boot)
```
#### Ubuntu
*Ubuntu* makes it easy to install Open5GS as shown below.
```bash
$ sudo apt update
$ sudo apt install software-properties-common
$ sudo add-apt-repository ppa:open5gs/latest
$ sudo apt update
$ sudo apt install open5gs
@@ -90,13 +113,9 @@ The Open5GS packages for Debian are available on [OBS](https://build.opensuse.or
```bash
$ sudo apt update
$ sudo apt install wget gnupg
$ wget -qO - https://www.mongodb.org/static/pgp/server-4.2.asc | sudo apt-key add -
$ echo "deb http://repo.mongodb.org/apt/debian buster/mongodb-org/4.2 main" | sudo tee /etc/apt/sources.list.d/mongodb-org.list
$ wget -qO - https://download.opensuse.org/repositories/home:/acetcom:/open5gs:/latest/Debian_10/Release.key | sudo apt-key add -
$ sudo sh -c "echo 'deb http://download.opensuse.org/repositories/home:/acetcom:/open5gs:/latest/Debian_10/ ./' > /etc/apt/sources.list.d/open5gs.list"
$ sudo apt update
$ sudo apt install mongodb-org
$ sudo apt install open5gs
```
@@ -115,16 +134,6 @@ https://download.opensuse.org/repositories/home:/acetcom:/open5gs:/latest/xUbunt
https://download.opensuse.org/repositories/home:/acetcom:/open5gs:/latest/xUbuntu_22.04/
```
#### openSUSE
[Martin Hauke](https://build.opensuse.org/user/show/mnhauke) packaged Open5GS for *openSUSE* on [OBS](https://build.opensuse.org/package/show/home:mnhauke:open5gs/open5gs).
```bash
$ sudo zypper addrepo -f obs://home:mnhauke:open5gs home:mnhauke:open5gs
$ sudo zypper install mongodb-server mongodb-shell
$ sudo zypper install open5gs
```
#### Nightly Builds
Nightly bulit package are provided by [Osmocom](https://osmocom.org) on [OBS](https://build.opensuse.org/package/show/network:osmocom:nightly/open5gs). On *Ubuntu 20.04* you can install it like this:
@@ -153,6 +162,15 @@ https://download.opensuse.org/repositories/network:/osmocom:/nightly/xUbuntu_21.
https://download.opensuse.org/repositories/network:/osmocom:/nightly/xUbuntu_22.04/
```
#### openSUSE
[Martin Hauke](https://build.opensuse.org/user/show/mnhauke) packaged Open5GS for *openSUSE* on [OBS](https://build.opensuse.org/package/show/home:mnhauke:open5gs/open5gs).
```bash
$ sudo zypper addrepo -f obs://home:mnhauke:open5gs home:mnhauke:open5gs
$ sudo zypper install mongodb-server mongodb-shell
$ sudo zypper install open5gs
```
## 3. Install the WebUI of Open5GS
---
@@ -167,7 +185,7 @@ The WebUI allows you to interactively edit subscriber data. While it is not esse
```bash
$ sudo apt update
$ sudo apt install curl
$ curl -fsSL https://deb.nodesource.com/setup_14.x | sudo -E bash -
$ curl -fsSL https://deb.nodesource.com/setup_18.x | sudo -E bash -
$ sudo apt install nodejs
```
@@ -220,6 +238,7 @@ HSS-frDi = 127.0.0.8 :3868 for S6a, Cx
PCRF-frDi = 127.0.0.9 :3868 for Gx
NRF-sbi = 127.0.0.10:7777 for 5G SBI
SCP-sbi = 127.0.1.10:7777 for 5G SBI
AUSF-sbi = 127.0.0.11:7777 for 5G SBI
UDM-sbi = 127.0.0.12:7777 for 5G SBI
PCF-sbi = 127.0.0.13:7777 for 5G SBI
@@ -239,45 +258,49 @@ Modify [/etc/open5gs/mme.yaml](https://github.com/{{ site.github_username }}/ope
```diff
$ diff -u /etc/open5gs/mme.yaml.old /etc/open5gs/mme.yaml
mme:
freeDiameter: /etc/freeDiameter/mme.conf
--- mme.yaml 2020-09-05 20:52:28.648235143 -0400
+++ mme.yaml.new 2020-09-05 20:56:05.434484208 -0400
@@ -253,20 +253,20 @@ mme:
s1ap:
- addr: 127.0.0.2
+ addr: 10.10.0.2 # for external eNB - a local address that can be reached by the eNB
- - addr: 127.0.0.2
+ - addr: 10.10.0.2
gtpc:
- addr: 127.0.0.2
metrics:
addr: 127.0.0.2
port: 9090
gummei:
plmn_id:
- mcc: 999
- mnc: 70
+ mcc: 001 # set your PLMN-MCC
+ mnc: 01 # set your PLMN-MNC
+ mcc: 001
+ mnc: 01
mme_gid: 2
mme_code: 1
tai:
plmn_id:
- mcc: 999
- mnc: 70
- tac: 1
+ mcc: 001 # set your PLMN-MCC
+ mnc: 01 # set your PLMN-MNC
+ tac: 2 # should match the TAC used by your eNB
+ mcc: 001
+ mnc: 01
tac: 1
security:
integrity_order : [ EIA2, EIA1, EIA0 ]
```
Modify [/etc/open5gs/sgwu.yaml](https://github.com/{{ site.github_username }}/open5gs/blob/main/configs/open5gs/sgwu.yaml.in) to set the GTP-U IP address.
```diff
$ diff -u /etc/open5gs/sgwu.yaml.old /etc/open5gs/sgwu.yaml
--- sgwu.yaml 2020-09-05 20:50:39.393022566 -0400
+++ sgwu.yaml.new 2020-09-05 20:51:06.667838823 -0400
@@ -98,7 +98,7 @@ logger:
#
sgwu:
gtpu:
- addr: 127.0.0.6
+ addr: 10.11.0.6 # for external eNB - a local address that can be reached by the eNB
pfcp:
addr: 127.0.0.6
- - addr: 127.0.0.6
+ - addr: 10.11.0.6
gtpu:
- addr: 127.0.0.6
```
After changing config files, please restart Open5GS daemons.
@@ -298,20 +321,23 @@ Modify [/etc/open5gs/amf.yaml](https://github.com/{{ site.github_username }}/ope
```diff
$ diff -u /etc/open5gs/amf.yaml.old /etc/open5gs/amf.yaml
amf:
sbi:
- addr: 127.0.0.5
port: 7777
--- amf.yaml 2020-09-05 20:52:28.652234967 -0400
+++ amf.yaml.new 2020-09-05 20:55:07.453114885 -0400
@@ -293,26 +293,26 @@ amf:
- addr: 127.0.0.5
port: 7777
ngap:
- - addr: 127.0.0.5
+ - addr: 10.10.0.5 # for external gNB - a local address that can be reached by the gNB
+ - addr: 10.10.0.5
metrics:
addr: 127.0.0.5
port: 9090
guami:
- plmn_id:
- mcc: 999
- mnc: 70
+ mcc: 001 # set your PLMN-MCC
+ mnc: 01 # set your PLMN-MNC
+ mcc: 001
+ mnc: 01
amf_id:
region: 2
set: 1
@@ -319,36 +345,34 @@ amf:
- plmn_id:
- mcc: 999
- mnc: 70
- tac: 1
+ mcc: 001 # set your PLMN-MCC
+ mnc: 01 # set your PLMN-MNC
+ tac: 2 # should match the TAC used by your gNB
+ mcc: 001
+ mnc: 01
tac: 1
plmn_support:
- plmn_id:
- mcc: 999
- mnc: 70
+ mcc: 001 # set your PLMN-MCC
+ mnc: 01 # set your PLMN-MNC
+ mcc: 001
+ mnc: 01
s_nssai:
- sst: 1
security:
```
Modify [/etc/open5gs/upf.yaml](https://github.com/{{ site.github_username }}/open5gs/blob/main/configs/open5gs/upf.yaml.in) to set the GTP-U address.
```diff
$ diff -u /etc/open5gs/upf.yaml.old /etc/open5gs/upf.yaml
upf:
--- upf.yaml 2020-09-05 20:52:28.652234967 -0400
+++ upf.yaml.new 2020-09-05 20:52:55.279052142 -0400
@@ -168,7 +168,7 @@ upf:
pfcp:
- addr: 127.0.0.7
gtpu:
- - addr: 127.0.0.7
+ - addr: 10.11.0.7 # for external gNB - a local address that can be reached by the gNB
+ - addr: 10.11.0.7
subnet:
- addr: 10.45.0.1/16
- addr: 2001:db8:cafe::1/48
```
After changing config files, please restart Open5GS daemons.
@@ -482,6 +506,7 @@ $ sudo systemctl stop open5gs-upfd
$ sudo systemctl stop open5gs-hssd
$ sudo systemctl stop open5gs-pcrfd
$ sudo systemctl stop open5gs-nrfd
$ sudo systemctl stop open5gs-scpd
$ sudo systemctl stop open5gs-ausfd
$ sudo systemctl stop open5gs-udmd
$ sudo systemctl stop open5gs-pcfd
@@ -501,6 +526,7 @@ $ sudo systemctl restart open5gs-upfd
$ sudo systemctl restart open5gs-hssd
$ sudo systemctl restart open5gs-pcrfd
$ sudo systemctl restart open5gs-nrfd
$ sudo systemctl restart open5gs-scpd
$ sudo systemctl restart open5gs-ausfd
$ sudo systemctl restart open5gs-udmd
$ sudo systemctl restart open5gs-pcfd
@@ -539,4 +565,3 @@ The WebUI of Open5GS can be removed as follows:
```bash
curl -fsSL {{ site.url }}{{ site.baseurl }}/assets/webui/uninstall | sudo -E bash -
```

View File

@@ -13,15 +13,29 @@ This post explains how to compile and install the source code on **Debian/Ubuntu
### Getting MongoDB
---
Install MongoDB with package manager. It is used as database for NRF/PCF/UDR and PCRF/HSS.
Import the public key used by the package management system.
```bash
$ sudo apt update
$ sudo apt install mongodb
$ sudo systemctl start mongodb (if '/usr/bin/mongod' is not running)
$ sudo systemctl enable mongodb (ensure to automatically start it on system boot)
$ wget -qO - https://www.mongodb.org/static/pgp/server-6.0.asc | sudo apt-key add -
```
Create the list file /etc/apt/sources.list.d/mongodb-org-6.0.list for your version of Ubuntu.
```bash
$ echo "deb [ arch=amd64,arm64 ] https://repo.mongodb.org/apt/ubuntu focal/mongodb-org/6.0 multiverse" | sudo tee /etc/apt/sources.list.d/mongodb-org-6.0.list
```
Install the MongoDB packages.
```bash
$ sudo apt update
$ sudo apt-get install -y mongodb-org
$ sudo systemctl start mongod (if '/usr/bin/mongod' is not running)
$ sudo systemctl enable mongod (ensure to automatically start it on system boot)
```
**Tip:** MongoDB is used as database for NRF/PCF/UDR and PCRF/HSS.
{: .notice--info}
### Setting up TUN device (not persistent after rebooting)
---
@@ -99,12 +113,15 @@ Modify [install/etc/open5gs/amf.yaml](https://github.com/{{ site.github_username
$ diff -u /etc/open5gs/amf.yaml.old /etc/open5gs/amf.yaml
--- amf.yaml 2020-09-05 20:52:28.652234967 -0400
+++ amf.yaml.new 2020-09-05 20:55:07.453114885 -0400
@@ -165,23 +165,23 @@
@@ -293,26 +293,26 @@ amf:
- addr: 127.0.0.5
port: 7777
ngap:
- - addr: 127.0.0.5
+ - addr: 10.10.0.5
metrics:
addr: 127.0.0.5
port: 9090
guami:
- plmn_id:
- mcc: 999
@@ -118,10 +135,9 @@ $ diff -u /etc/open5gs/amf.yaml.old /etc/open5gs/amf.yaml
- plmn_id:
- mcc: 999
- mnc: 70
- tac: 1
+ mcc: 001
+ mnc: 01
+ tac: 2
tac: 1
plmn_support:
- plmn_id:
- mcc: 999
@@ -138,13 +154,11 @@ Modify [install/etc/open5gs/upf.yaml](https://github.com/{{ site.github_username
$ diff -u /etc/open5gs/upf.yaml.old /etc/open5gs/upf.yaml
--- upf.yaml 2020-09-05 20:52:28.652234967 -0400
+++ upf.yaml.new 2020-09-05 20:52:55.279052142 -0400
@@ -137,9 +137,7 @@
@@ -168,7 +168,7 @@ upf:
pfcp:
- addr: 127.0.0.7
gtpu:
- - addr:
- - 127.0.0.7
- - ::1
- - addr: 127.0.0.7
+ - addr: 10.11.0.7
subnet:
- addr: 10.45.0.1/16
@@ -158,14 +172,15 @@ Modify [install/etc/open5gs/mme.yaml](https://github.com/{{ site.github_username
$ diff -u /etc/open5gs/mme.yaml.old /etc/open5gs/mme.yaml
--- mme.yaml 2020-09-05 20:52:28.648235143 -0400
+++ mme.yaml.new 2020-09-05 20:56:05.434484208 -0400
@@ -204,20 +204,20 @@
mme:
freeDiameter: /home/acetcom/Documents/git/open5gs/install/etc/freeDiameter/mme.conf
@@ -253,20 +253,20 @@ mme:
s1ap:
- addr: 127.0.0.2
+ addr: 10.10.0.2
- - addr: 127.0.0.2
+ - addr: 10.10.0.2
gtpc:
- addr: 127.0.0.2
metrics:
addr: 127.0.0.2
port: 9090
gummei:
plmn_id:
- mcc: 999
@@ -178,13 +193,11 @@ $ diff -u /etc/open5gs/mme.yaml.old /etc/open5gs/mme.yaml
plmn_id:
- mcc: 999
- mnc: 70
- tac: 1
+ mcc: 001
+ mnc: 01
+ tac: 2
tac: 1
security:
integrity_order : [ EIA1, EIA2, EIA0 ]
ciphering_order : [ EEA0, EEA1, EEA2 ]
integrity_order : [ EIA2, EIA1, EIA0 ]
```
Modify [install/etc/open5gs/sgwu.yaml](https://github.com/{{ site.github_username }}/open5gs/blob/main/configs/open5gs/sgwu.yaml.in) to set the GTP-U IP address.
@@ -192,15 +205,14 @@ Modify [install/etc/open5gs/sgwu.yaml](https://github.com/{{ site.github_usernam
$ diff -u /etc/open5gs/sgwu.yaml.old /etc/open5gs/sgwu.yaml
--- sgwu.yaml 2020-09-05 20:50:39.393022566 -0400
+++ sgwu.yaml.new 2020-09-05 20:51:06.667838823 -0400
@@ -51,7 +51,7 @@
@@ -98,7 +98,7 @@ logger:
#
sgwu:
gtpu:
- addr: 127.0.0.6
+ addr: 10.11.0.6
pfcp:
addr: 127.0.0.6
- - addr: 127.0.0.6
+ - addr: 10.11.0.6
gtpu:
- addr: 127.0.0.6
```
If you modify the config files while Open5GS daemons are running, please restart them
@@ -210,140 +222,164 @@ If you modify the config files while Open5GS daemons are running, please restart
---
```bash
$ ./install/bin/open5gs-mmed
Open5GS daemon v2.1.0
$ ./install/bin/open5gs-nrfd
Open5GS daemon v2.4.11-100-gbea24d7
08/21 22:53:47.328: [app] INFO: Configuration: '/home/acetcom/Documents/git/open5gs/install/etc/open5gs/mme.yaml' (../src/main.c:54)
08/21 22:53:47.328: [app] INFO: File Logging: '/home/acetcom/Documents/git/open5gs/install/var/log/open5gs/mme.log' (../src/main.c:57)
08/21 22:53:47.365: [app] INFO: MME initialize...done (../src/mme/app-init.c:33)
08/21 22:53:47.365: [gtp] INFO: gtp_server() [127.0.0.2]:2123 (../lib/gtp/path.c:32)
08/21 22:53:47.365: [gtp] INFO: gtp_connect() [127.0.0.3]:2123 (../lib/gtp/path.c:59)
08/21 22:53:47.366: [mme] INFO: s1ap_server() [127.0.0.2]:36412 (../src/mme/s1ap-sctp.c:57)
10/22 10:43:43.669: [app] INFO: Configuration: '/home/acetcom/Documents/git/open5gs/install/etc/open5gs/nrf.yaml' (../lib/app/ogs-init.c:126)
10/22 10:43:43.669: [app] INFO: File Logging: '/home/acetcom/Documents/git/open5gs/install/var/log/open5gs/nrf.log' (../lib/app/ogs-init.c:129)
10/22 10:43:43.670: [sbi] INFO: nghttp2_server() [127.0.0.10]:7777 (../lib/sbi/nghttp2-server.c:150)
10/22 10:43:43.670: [sbi] INFO: nghttp2_server() [::1]:7777 (../lib/sbi/nghttp2-server.c:150)
10/22 10:43:43.671: [app] INFO: NRF initialize...done (../src/nrf/app.c:31)
$ ./install/bin/open5gs-sgwcd
Open5GS daemon v2.1.0
$ ./install/bin/open5gs-scpd
Open5GS daemon v2.4.11-100-gbea24d7
08/21 22:54:43.059: [app] INFO: Configuration: '/home/acetcom/Documents/git/open5gs/install/etc/open5gs/sgwc.yaml' (../src/main.c:54)
08/21 22:54:43.059: [app] INFO: File Logging: '/home/acetcom/Documents/git/open5gs/install/var/log/open5gs/sgwc.log' (../src/main.c:57)
08/21 22:54:43.065: [app] INFO: SGW-C initialize...done (../src/sgwc/app.c:31)
08/21 22:54:43.066: [gtp] INFO: gtp_server() [127.0.0.3]:2123 (../lib/gtp/path.c:32)
08/21 22:54:43.066: [pfcp] INFO: pfcp_server() [127.0.0.3]:8805 (../lib/pfcp/path.c:32)
08/21 22:54:43.066: [pfcp] INFO: ogs_pfcp_connect() [127.0.0.6]:8805 (../lib/pfcp/path.c:60)
$ ./install/bin/open5gs-smfd
Open5GS daemon v2.1.0
08/21 22:54:56.000: [app] INFO: Configuration: '/home/acetcom/Documents/git/open5gs/install/etc/open5gs/smf.yaml' (../src/main.c:54)
08/21 22:54:56.000: [app] INFO: File Logging: '/home/acetcom/Documents/git/open5gs/install/var/log/open5gs/smf.log' (../src/main.c:57)
08/21 22:54:56.050: [gtp] INFO: gtp_server() [127.0.0.4]:2123 (../lib/gtp/path.c:32)
08/21 22:54:56.050: [app] INFO: SMF initialize...done (../src/smf/app.c:31)
08/21 22:54:56.050: [gtp] INFO: gtp_server() [::1]:2123 (../lib/gtp/path.c:32)
08/21 22:54:56.050: [pfcp] INFO: pfcp_server() [127.0.0.4]:8805 (../lib/pfcp/path.c:32)
08/21 22:54:56.050: [pfcp] INFO: pfcp_server() [::1]:8805 (../lib/pfcp/path.c:32)
08/21 22:54:56.050: [pfcp] INFO: ogs_pfcp_connect() [127.0.0.7]:8805 (../lib/pfcp/path.c:60)
08/21 22:54:56.051: [sbi] INFO: sbi_server() [127.0.0.4]:7777 (../lib/sbi/server.c:298)
10/22 10:43:45.709: [app] INFO: Configuration: '/home/acetcom/Documents/git/open5gs/install/etc/open5gs/scp.yaml' (../lib/app/ogs-init.c:126)
10/22 10:43:45.709: [app] INFO: File Logging: '/home/acetcom/Documents/git/open5gs/install/var/log/open5gs/scp.log' (../lib/app/ogs-init.c:129)
10/22 10:43:45.711: [sbi] INFO: nghttp2_server() [127.0.1.10]:7777 (../lib/sbi/nghttp2-server.c:150)
10/22 10:43:45.712: [app] INFO: SCP initialize...done (../src/scp/app.c:31)
$ ./install/bin/open5gs-amfd
Open5GS daemon v2.1.0
Open5GS daemon v2.4.11-100-gbea24d7
08/21 22:55:14.015: [app] INFO: Configuration: '/home/acetcom/Documents/git/open5gs/install/etc/open5gs/amf.yaml' (../src/main.c:54)
08/21 22:55:14.015: [app] INFO: File Logging: '/home/acetcom/Documents/git/open5gs/install/var/log/open5gs/amf.log' (../src/main.c:57)
08/21 22:55:14.039: [app] INFO: AMF initialize...done (../src/amf/app.c:33)
08/21 22:55:14.040: [sbi] INFO: sbi_server() [127.0.0.5]:7777 (../lib/sbi/server.c:298)
08/21 22:55:14.040: [amf] INFO: ngap_server() [127.0.0.5]:38412 (../src/amf/ngap-sctp.c:56)
10/22 10:44:01.416: [app] INFO: Configuration: '/home/acetcom/Documents/git/open5gs/install/etc/open5gs/amf.yaml' (../lib/app/ogs-init.c:126)
10/22 10:44:01.416: [app] INFO: File Logging: '/home/acetcom/Documents/git/open5gs/install/var/log/open5gs/amf.log' (../lib/app/ogs-init.c:129)
10/22 10:44:01.419: [sbi] INFO: NF Service [namf-comm] (../lib/sbi/context.c:1401)
10/22 10:44:01.420: [sbi] INFO: nghttp2_server() [127.0.0.5]:7777 (../lib/sbi/nghttp2-server.c:150)
10/22 10:44:01.420: [amf] INFO: ngap_server() [127.0.0.5]:38412 (../src/amf/ngap-sctp.c:61)
10/22 10:44:01.420: [sctp] INFO: AMF initialize...done (../src/amf/app.c:33)
$ ./install/bin/open5gs-sgwud
Open5GS daemon v2.1.0
$ ./install/bin/open5gs-smfd
Open5GS daemon v2.4.11-100-gbea24d7
08/21 22:54:10.357: [app] INFO: Configuration: '/home/acetcom/Documents/git/open5gs/install/etc/open5gs/sgwu.yaml' (../src/main.c:54)
08/21 22:54:10.357: [app] INFO: File Logging: '/home/acetcom/Documents/git/open5gs/install/var/log/open5gs/sgwu.log' (../src/main.c:57)
08/21 22:54:10.360: [pfcp] INFO: pfcp_server() [127.0.0.6]:8805 (../lib/pfcp/path.c:32)
08/21 22:54:10.360: [app] INFO: SGW-U initialize...done (../src/sgwu/app.c:31)
08/21 22:54:10.361: [gtp] INFO: gtp_server() [127.0.0.6]:2152 (../lib/gtp/path.c:32)
10/22 10:44:03.217: [app] INFO: Configuration: '/home/acetcom/Documents/git/open5gs/install/etc/open5gs/smf.yaml' (../lib/app/ogs-init.c:126)
10/22 10:44:03.217: [app] INFO: File Logging: '/home/acetcom/Documents/git/open5gs/install/var/log/open5gs/smf.log' (../lib/app/ogs-init.c:129)
10/22 10:44:03.269: [gtp] INFO: gtp_server() [127.0.0.4]:2123 (../lib/gtp/path.c:30)
10/22 10:44:03.269: [gtp] INFO: gtp_server() [::1]:2123 (../lib/gtp/path.c:30)
10/22 10:44:03.269: [gtp] INFO: gtp_server() [127.0.0.4]:2152 (../lib/gtp/path.c:30)
10/22 10:44:03.269: [gtp] INFO: gtp_server() [::1]:2152 (../lib/gtp/path.c:30)
10/22 10:44:03.269: [pfcp] INFO: pfcp_server() [127.0.0.4]:8805 (../lib/pfcp/path.c:30)
10/22 10:44:03.269: [pfcp] INFO: pfcp_server() [::1]:8805 (../lib/pfcp/path.c:30)
10/22 10:44:03.269: [pfcp] INFO: ogs_pfcp_connect() [127.0.0.7]:8805 (../lib/pfcp/path.c:61)
10/22 10:44:03.269: [sbi] INFO: NF Service [nsmf-pdusession] (../lib/sbi/context.c:1401)
10/22 10:44:03.270: [sbi] INFO: nghttp2_server() [127.0.0.4]:7777 (../lib/sbi/nghttp2-server.c:150)
10/22 10:44:03.270: [app] INFO: SMF initialize...done (../src/smf/app.c:31)
$ ./install/bin/open5gs-upfd
Open5GS daemon v2.1.0
Open5GS daemon v2.4.11-100-gbea24d7
08/21 22:54:21.596: [app] INFO: Configuration: '/home/acetcom/Documents/git/open5gs/install/etc/open5gs/upf.yaml' (../src/main.c:54)
08/21 22:54:21.596: [app] INFO: File Logging: '/home/acetcom/Documents/git/open5gs/install/var/log/open5gs/upf.log' (../src/main.c:57)
08/21 22:54:21.601: [pfcp] INFO: pfcp_server() [127.0.0.7]:8805 (../lib/pfcp/path.c:32)
08/21 22:54:21.601: [app] INFO: UPF initialize...done (../src/upf/app.c:31)
08/21 22:54:21.601: [gtp] INFO: gtp_server() [127.0.0.7]:2152 (../lib/gtp/path.c:32)
08/21 22:54:21.601: [gtp] INFO: gtp_server() [::1]:2152 (../lib/gtp/path.c:32)
10/22 10:44:06.884: [app] INFO: Configuration: '/home/acetcom/Documents/git/open5gs/install/etc/open5gs/upf.yaml' (../lib/app/ogs-init.c:126)
10/22 10:44:06.884: [app] INFO: File Logging: '/home/acetcom/Documents/git/open5gs/install/var/log/open5gs/upf.log' (../lib/app/ogs-init.c:129)
10/22 10:44:06.892: [pfcp] INFO: pfcp_server() [127.0.0.7]:8805 (../lib/pfcp/path.c:30)
10/22 10:44:06.892: [gtp] INFO: gtp_server() [127.0.0.7]:2152 (../lib/gtp/path.c:30)
10/22 10:44:06.892: [app] INFO: UPF initialize...done (../src/upf/app.c:31)
$ ./install/bin/open5gs-hssd
Open5GS daemon v2.1.0
$./install/bin/open5gs-ausfd
Open5GS daemon v2.4.11-100-gbea24d7
08/21 22:57:17.450: [app] INFO: Configuration: '/home/acetcom/Documents/git/open5gs/install/etc/open5gs/hss.yaml' (../src/main.c:54)
08/21 22:57:17.450: [app] INFO: File Logging: '/home/acetcom/Documents/git/open5gs/install/var/log/open5gs/hss.log' (../src/main.c:57)
08/21 22:57:17.451: [dbi] INFO: MongoDB URI: 'mongodb://localhost/open5gs' (../lib/dbi/ogs-mongoc.c:99)
08/21 22:57:17.519: [app] INFO: HSS initialize...done (../src/hss/app-init.c:31)
$ ./install/bin/open5gs-pcrfd
Open5GS daemon v2.1.0
08/21 22:57:45.894: [app] INFO: Configuration: '/home/acetcom/Documents/git/open5gs/install/etc/open5gs/pcrf.yaml' (../src/main.c:54)
08/21 22:57:45.894: [app] INFO: File Logging: '/home/acetcom/Documents/git/open5gs/install/var/log/open5gs/pcrf.log' (../src/main.c:57)
08/21 22:57:45.896: [dbi] INFO: MongoDB URI: 'mongodb://localhost/open5gs' (../lib/dbi/ogs-mongoc.c:99)
08/21 22:57:45.997: [app] INFO: PCRF initialize...done (../src/pcrf/app-init.c:31)
$ ./install/bin/open5gs-nrfd
Open5GS daemon v2.1.0
08/21 22:56:35.472: [app] INFO: Configuration: '/home/acetcom/Documents/git/open5gs/install/etc/open5gs/nrf.yaml' (../src/main.c:54)
08/21 22:56:35.472: [app] INFO: File Logging: '/home/acetcom/Documents/git/open5gs/install/var/log/open5gs/nrf.log' (../src/main.c:57)
08/21 22:56:35.472: [app] INFO: NRF initialize...done (../src/nrf/app.c:31)
08/21 22:56:35.473: [sbi] INFO: sbi_server() [127.0.0.10]:7777 (../lib/sbi/server.c:298)
08/21 22:56:35.473: [sbi] INFO: sbi_server() [::1]:7777 (../lib/sbi/server.c:298
$ ./install/bin/open5gs-ausfd
Open5GS daemon v2.1.0
08/21 22:55:41.899: [app] INFO: Configuration: '/home/acetcom/Documents/git/open5gs/install/etc/open5gs/ausf.yaml' (../src/main.c:54)
08/21 22:55:41.899: [app] INFO: File Logging: '/home/acetcom/Documents/git/open5gs/install/var/log/open5gs/ausf.log' (../src/main.c:57)
08/21 22:55:41.900: [app] INFO: AUSF initialize...done (../src/ausf/app.c:31)
08/21 22:55:41.900: [sbi] INFO: sbi_server() [127.0.0.11]:7777 (../lib/sbi/server.c:298)
10/22 10:44:08.747: [app] INFO: Configuration: '/home/acetcom/Documents/git/open5gs/install/etc/open5gs/ausf.yaml' (../lib/app/ogs-init.c:126)
10/22 10:44:08.747: [app] INFO: File Logging: '/home/acetcom/Documents/git/open5gs/install/var/log/open5gs/ausf.log' (../lib/app/ogs-init.c:129)
10/22 10:44:08.748: [sbi] INFO: NF Service [nausf-auth] (../lib/sbi/context.c:1401)
10/22 10:44:08.749: [sbi] INFO: nghttp2_server() [127.0.0.11]:7777 (../lib/sbi/nghttp2-server.c:150)
10/22 10:44:08.749: [app] INFO: AUSF initialize...done (../src/ausf/app.c:31)
$ ./install/bin/open5gs-udmd
Open5GS daemon v2.1.0
Open5GS daemon v2.4.11-100-gbea24d7
08/21 22:56:02.154: [app] INFO: Configuration: '/home/acetcom/Documents/git/open5gs/install/etc/open5gs/udm.yaml' (../src/main.c:54)
08/21 22:56:02.154: [app] INFO: File Logging: '/home/acetcom/Documents/git/open5gs/install/var/log/open5gs/udm.log' (../src/main.c:57)
08/21 22:56:02.155: [app] INFO: UDM initialize...done (../src/udm/app.c:31)
08/21 22:56:02.155: [sbi] INFO: sbi_server() [127.0.0.12]:7777 (../lib/sbi/server.c:298)
10/22 10:44:10.724: [app] INFO: Configuration: '/home/acetcom/Documents/git/open5gs/install/etc/open5gs/udm.yaml' (../lib/app/ogs-init.c:126)
10/22 10:44:10.724: [app] INFO: File Logging: '/home/acetcom/Documents/git/open5gs/install/var/log/open5gs/udm.log' (../lib/app/ogs-init.c:129)
10/22 10:44:10.726: [sbi] INFO: NF Service [nudm-ueau] (../lib/sbi/context.c:1401)
10/22 10:44:10.726: [sbi] INFO: NF Service [nudm-uecm] (../lib/sbi/context.c:1401)
10/22 10:44:10.726: [sbi] INFO: NF Service [nudm-sdm] (../lib/sbi/context.c:1401)
10/22 10:44:10.727: [sbi] INFO: nghttp2_server() [127.0.0.12]:7777 (../lib/sbi/nghttp2-server.c:150)
10/22 10:44:10.727: [app] INFO: UDM initialize...done (../src/udm/app.c:31)
$ ./install/bin/open5gs-pcfd
Open5GS daemon v2.1.0
$./install/bin/open5gs-pcfd
Open5GS daemon v2.4.11-100-gbea24d7
08/21 22:56:02.154: [app] INFO: Configuration: '/home/acetcom/Documents/git/open5gs/install/etc/open5gs/pcf.yaml' (../src/main.c:54)
08/21 22:56:02.154: [app] INFO: File Logging: '/home/acetcom/Documents/git/open5gs/install/var/log/open5gs/pcf.log' (../src/main.c:57)
08/21 22:56:02.155: [app] INFO: PCF initialize...done (../src/pcf/app.c:31)
08/21 22:56:02.155: [sbi] INFO: sbi_server() [127.0.0.12]:7777 (../lib/sbi/server.c:298)
10/22 10:44:14.265: [app] INFO: Configuration: '/home/acetcom/Documents/git/open5gs/install/etc/open5gs/pcf.yaml' (../lib/app/ogs-init.c:126)
10/22 10:44:14.265: [app] INFO: File Logging: '/home/acetcom/Documents/git/open5gs/install/var/log/open5gs/pcf.log' (../lib/app/ogs-init.c:129)
10/22 10:44:14.269: [dbi] INFO: MongoDB URI: 'mongodb://localhost/open5gs' (../lib/dbi/ogs-mongoc.c:130)
10/22 10:44:14.269: [sbi] INFO: NF Service [npcf-am-policy-control] (../lib/sbi/context.c:1401)
10/22 10:44:14.269: [sbi] INFO: NF Service [npcf-smpolicycontrol] (../lib/sbi/context.c:1401)
10/22 10:44:14.269: [sbi] INFO: NF Service [npcf-policyauthorization] (../lib/sbi/context.c:1401)
10/22 10:44:14.269: [sbi] INFO: nghttp2_server() [127.0.0.13]:7777 (../lib/sbi/nghttp2-server.c:150)
10/22 10:44:14.269: [app] INFO: PCF initialize...done (../src/pcf/app.c:31)
$ ./install/bin/open5gs-nssfd
Open5GS daemon v2.1.0
Open5GS daemon v2.4.11-100-gbea24d7
08/21 22:56:02.154: [app] INFO: Configuration: '/home/acetcom/Documents/git/open5gs/install/etc/open5gs/nssfd.yaml' (../src/main.c:54)
08/21 22:56:02.154: [app] INFO: File Logging: '/home/acetcom/Documents/git/open5gs/install/var/log/open5gs/nssfd.log' (../src/main.c:57)
08/21 22:56:02.155: [app] INFO: NSSF initialize...done (../src/nssfd/app.c:31)
08/21 22:56:02.155: [sbi] INFO: sbi_server() [127.0.0.12]:7777 (../lib/sbi/server.c:298)
10/22 10:44:16.250: [app] INFO: Configuration: '/home/acetcom/Documents/git/open5gs/install/etc/open5gs/nssf.yaml' (../lib/app/ogs-init.c:126)
10/22 10:44:16.250: [app] INFO: File Logging: '/home/acetcom/Documents/git/open5gs/install/var/log/open5gs/nssf.log' (../lib/app/ogs-init.c:129)
10/22 10:44:16.252: [sbi] INFO: NF Service [nnssf-nsselection] (../lib/sbi/context.c:1401)
10/22 10:44:16.252: [sbi] INFO: nghttp2_server() [127.0.0.14]:7777 (../lib/sbi/nghttp2-server.c:150)
10/22 10:44:16.252: [app] INFO: NSSF initialize...done (../src/nssf/app.c:31)
$ ./install/bin/open5gs-bsfd
Open5GS daemon v2.1.0
Open5GS daemon v2.4.11-100-gbea24d7
08/21 22:56:02.154: [app] INFO: Configuration: '/home/acetcom/Documents/git/open5gs/install/etc/open5gs/bsf.yaml' (../src/main.c:54)
08/21 22:56:02.154: [app] INFO: File Logging: '/home/acetcom/Documents/git/open5gs/install/var/log/open5gs/bsf.log' (../src/main.c:57)
08/21 22:56:02.155: [app] INFO: BSF initialize...done (../src/bsf/app.c:31)
08/21 22:56:02.155: [sbi] INFO: sbi_server() [127.0.0.12]:7777 (../lib/sbi/server.c:298)
10/22 10:44:18.836: [app] INFO: Configuration: '/home/acetcom/Documents/git/open5gs/install/etc/open5gs/bsf.yaml' (../lib/app/ogs-init.c:126)
10/22 10:44:18.836: [app] INFO: File Logging: '/home/acetcom/Documents/git/open5gs/install/var/log/open5gs/bsf.log' (../lib/app/ogs-init.c:129)
10/22 10:44:18.837: [sbi] INFO: NF Service [nbsf-management] (../lib/sbi/context.c:1401)
10/22 10:44:18.837: [sbi] INFO: nghttp2_server() [127.0.0.15]:7777 (../lib/sbi/nghttp2-server.c:150)
10/22 10:44:18.837: [app] INFO: BSF initialize...done (../src/bsf/app.c:31)
$ ./install/bin/open5gs-udrd
Open5GS daemon v2.1.0
Open5GS daemon v2.4.11-100-gbea24d7
08/21 22:56:15.810: [app] INFO: Configuration: '/home/acetcom/Documents/git/open5gs/install/etc/open5gs/udr.yaml' (../src/main.c:54)
08/21 22:56:15.810: [app] INFO: File Logging: '/home/acetcom/Documents/git/open5gs/install/var/log/open5gs/udr.log' (../src/main.c:57)
08/21 22:56:15.813: [dbi] INFO: MongoDB URI: 'mongodb://localhost/open5gs' (../lib/dbi/ogs-mongoc.c:99)
08/21 22:56:15.813: [app] INFO: UDR initialize...done (../src/udr/app.c:31)
08/21 22:56:15.813: [sbi] INFO: sbi_server() [127.0.0.13]:7777 (../lib/sbi/server.c:298)
10/22 10:44:24.018: [app] INFO: Configuration: '/home/acetcom/Documents/git/open5gs/install/etc/open5gs/udr.yaml' (../lib/app/ogs-init.c:126)
10/22 10:44:24.018: [app] INFO: File Logging: '/home/acetcom/Documents/git/open5gs/install/var/log/open5gs/udr.log' (../lib/app/ogs-init.c:129)
10/22 10:44:24.021: [dbi] INFO: MongoDB URI: 'mongodb://localhost/open5gs' (../lib/dbi/ogs-mongoc.c:130)
10/22 10:44:24.021: [sbi] INFO: NF Service [nudr-dr] (../lib/sbi/context.c:1401)
10/22 10:44:24.021: [sbi] INFO: nghttp2_server() [127.0.0.20]:7777 (../lib/sbi/nghttp2-server.c:150)
10/22 10:44:24.021: [app] INFO: UDR initialize...done (../src/udr/app.c:31)
$ ./install/bin/open5gs-mmed
Open5GS daemon v2.4.11-100-gbea24d7
10/22 10:44:26.011: [app] INFO: Configuration: '/home/acetcom/Documents/git/open5gs/install/etc/open5gs/mme.yaml' (../lib/app/ogs-init.c:126)
10/22 10:44:26.011: [app] INFO: File Logging: '/home/acetcom/Documents/git/open5gs/install/var/log/open5gs/mme.log' (../lib/app/ogs-init.c:129)
10/22 10:44:26.062: [gtp] INFO: gtp_server() [127.0.0.2]:2123 (../lib/gtp/path.c:30)
10/22 10:44:26.063: [gtp] INFO: gtp_connect() [127.0.0.3]:2123 (../lib/gtp/path.c:60)
10/22 10:44:26.063: [mme] INFO: s1ap_server() [127.0.0.2]:36412 (../src/mme/s1ap-sctp.c:62)
10/22 10:44:26.063: [sctp] INFO: MME initialize...done (../src/mme/app-init.c:33)
$ ./install/bin/open5gs-sgwcd
Open5GS daemon v2.4.11-100-gbea24d7
10/22 10:44:29.050: [app] INFO: Configuration: '/home/acetcom/Documents/git/open5gs/install/etc/open5gs/sgwc.yaml' (../lib/app/ogs-init.c:126)
10/22 10:44:29.050: [app] INFO: File Logging: '/home/acetcom/Documents/git/open5gs/install/var/log/open5gs/sgwc.log' (../lib/app/ogs-init.c:129)
10/22 10:44:29.058: [gtp] INFO: gtp_server() [127.0.0.3]:2123 (../lib/gtp/path.c:30)
10/22 10:44:29.058: [pfcp] INFO: pfcp_server() [127.0.0.3]:8805 (../lib/pfcp/path.c:30)
10/22 10:44:29.058: [pfcp] INFO: ogs_pfcp_connect() [127.0.0.6]:8805 (../lib/pfcp/path.c:61)
10/22 10:44:29.058: [app] INFO: SGW-C initialize...done (../src/sgwc/app.c:31)
$ ./install/bin/open5gs-sgwud
Open5GS daemon v2.4.11-100-gbea24d7
10/22 10:44:36.178: [app] INFO: Configuration: '/home/acetcom/Documents/git/open5gs/install/etc/open5gs/sgwu.yaml' (../lib/app/ogs-init.c:126)
10/22 10:44:36.178: [app] INFO: File Logging: '/home/acetcom/Documents/git/open5gs/install/var/log/open5gs/sgwu.log' (../lib/app/ogs-init.c:129)
10/22 10:44:36.185: [pfcp] INFO: pfcp_server() [127.0.0.6]:8805 (../lib/pfcp/path.c:30)
10/22 10:44:36.185: [gtp] INFO: gtp_server() [127.0.0.6]:2152 (../lib/gtp/path.c:30)
10/22 10:44:36.185: [app] INFO: SGW-U initialize...done (../src/sgwu/app.c:31)
$ ./install/bin/open5gs-hssd
Open5GS daemon v2.4.11-100-gbea24d7
10/22 10:49:22.963: [app] INFO: Configuration: '/home/acetcom/Documents/git/open5gs/install/etc/open5gs/hss.yaml' (../lib/app/ogs-init.c:126)
10/22 10:49:22.963: [app] INFO: File Logging: '/home/acetcom/Documents/git/open5gs/install/var/log/open5gs/hss.log' (../lib/app/ogs-init.c:129)
10/22 10:49:22.965: [dbi] INFO: MongoDB URI: 'mongodb://localhost/open5gs' (../lib/dbi/ogs-mongoc.c:130)
10/22 10:49:22.996: [app] INFO: HSS initialize...done (../src/hss/app-init.c:31)
10/22 10:49:22.997: [diam] INFO: CONNECTED TO 'mme.localdomain' (SCTP,soc#15): (../lib/diameter/common/logger.c:108)
$ ./install/bin/open5gs-pcrfd
Open5GS daemon v2.4.11-100-gbea24d7
10/22 10:49:26.089: [app] INFO: Configuration: '/home/acetcom/Documents/git/open5gs/install/etc/open5gs/pcrf.yaml' (../lib/app/ogs-init.c:126)
10/22 10:49:26.089: [app] INFO: File Logging: '/home/acetcom/Documents/git/open5gs/install/var/log/open5gs/pcrf.log' (../lib/app/ogs-init.c:129)
10/22 10:49:26.091: [dbi] INFO: MongoDB URI: 'mongodb://localhost/open5gs' (../lib/dbi/ogs-mongoc.c:130)
10/22 10:49:26.124: [app] INFO: PCRF initialize...done (../src/pcrf/app-init.c:31)
10/22 10:49:26.125: [diam] INFO: CONNECTED TO 'smf.localdomain' (SCTP,soc#15): (../lib/diameter/common/logger.c:108)
```
Several command line options are provided.
@@ -382,7 +418,7 @@ $ ./build/tests/app/app ## Both 5G Core and EPC with ./build/configs/sample.yaml
```bash
$ sudo apt install curl
$ curl -fsSL https://deb.nodesource.com/setup_14.x | sudo -E bash -
$ curl -fsSL https://deb.nodesource.com/setup_18.x | sudo -E bash -
$ sudo apt install nodejs
```
@@ -390,7 +426,7 @@ Install the dependencies to run WebUI
```bash
$ cd webui
$ npm ci --no-optional
$ npm ci
```
The WebUI runs as an [npm](https://www.npmjs.com/) script.
@@ -547,32 +583,37 @@ You can use the command line option[`-d`] to record more logs.
```bash
$ ./tests/app/app -d
Open5GS daemon v1.3.0-213-gd190548+
Open5GS daemon v2.4.11-100-gbea24d7
08/21 23:01:54.246: [app] INFO: Configuration: '/home/acetcom/Documents/git/open5gs/build/configs/sample.yaml' (../src/main.c:54)
08/21 23:01:54.246: [thread] DEBUG: [0x7f8de4d25018] worker signal (../lib/core/ogs-thread.c:66)
08/21 23:01:54.246: [thread] DEBUG: [0x7f8de4d25018] thread started (../lib/core/ogs-thread.c:101)
Open5GS daemon v1.3.0-213-gd190548+
08/21 23:01:54.254: [app] INFO: Configuration: '/home/acetcom/Documents/git/open5gs/build/configs/sample.yaml' (../src/main.c:54)
08/21 23:01:54.254: [thread] DEBUG: [0x7ff8d13be818] worker signal (../lib/core/ogs-thread.c:66)
08/21 23:01:54.254: [nrf] DEBUG: nrf_state_initial(): INIT (../src/nrf/nrf-sm.c:25)
08/21 23:01:54.254: [nrf] DEBUG: nrf_state_operational(): ENTRY (../src/nrf/nrf-sm.c:50)
08/21 23:01:54.254: [thread] DEBUG: [0x7ff8d13be818] thread started (../lib/core/ogs-thread.c:101)
08/21 23:01:54.254: [app] INFO: NRF initialize...done (../src/nrf/app.c:31)
08/21 23:01:54.255: [sbi] INFO: sbi_server() [127.0.0.10]:7777 (../lib/sbi/server.c:298)
08/21 23:01:54.255: [sbi] INFO: sbi_server() [::1]:7777 (../lib/sbi/server.c:298)
08/21 23:01:54.296: [thread] DEBUG: [0x7f8de4d25098] worker signal (../lib/core/ogs-thread.c:66)
08/21 23:01:54.296: [thread] DEBUG: [0x7f8de4d25098] thread started (../lib/core/ogs-thread.c:101)
Open5GS daemon v1.3.0-213-gd190548+
08/21 23:01:54.315: [app] INFO: Configuration: '/home/acetcom/Documents/git/open5gs/build/configs/sample.yaml' (../src/main.c:54)
08/21 23:01:54.319: [dbi] INFO: MongoDB URI: 'mongodb://localhost/open5gs' (../lib/dbi/ogs-mongoc.c:99)
08/21 23:01:54.332: [app] INFO: PCRF initialize...done (../src/pcrf/app-init.c:31)
08/21 23:01:54.347: [thread] DEBUG: [0x7f8de4d25118] worker signal (../lib/core/ogs-thread.c:66)
08/21 23:01:54.347: [thread] DEBUG: [0x7f8de4d25118] thread started (../lib/core/ogs-thread.c:101)
Open5GS daemon v1.3.0-213-gd190548+
10/22 10:59:03.813: [app] INFO: Configuration: '/home/acetcom/Documents/git/open5gs/build/configs/sample.yaml' (../lib/app/ogs-init.c:126)
10/22 10:59:03.813: [thread] DEBUG: [0x55fab86aff40] worker signal (../lib/core/ogs-thread.c:66)
10/22 10:59:03.813: [thread] DEBUG: [0x55fab86aff40] thread started (../lib/core/ogs-thread.c:101)
Open5GS daemon v2.4.11-100-gbea24d7
10/22 10:59:03.818: [app] INFO: Configuration: '/home/acetcom/Documents/git/open5gs/build/configs/sample.yaml' (../lib/app/ogs-init.c:126)
10/22 10:59:03.819: [sock] DEBUG: addr:127.0.0.10, port:7777 (../lib/core/ogs-sockaddr.c:140)
10/22 10:59:03.819: [sock] DEBUG: addr:::1, port:7777 (../lib/core/ogs-sockaddr.c:140)
10/22 10:59:03.819: [sock] DEBUG: addr:127.0.1.10, port:7777 (../lib/core/ogs-sockaddr.c:140)
10/22 10:59:03.819: [sock] DEBUG: socket create(2:1:6) (../lib/core/ogs-socket.c:92)
10/22 10:59:03.819: [sock] DEBUG: Turn on TCP_NODELAY (../lib/core/ogs-sockopt.c:139)
10/22 10:59:03.819: [sock] DEBUG: Turn on SO_REUSEADDR (../lib/core/ogs-sockopt.c:120)
10/22 10:59:03.819: [sock] DEBUG: socket bind 127.0.0.10:7777 (../lib/core/ogs-socket.c:117)
10/22 10:59:03.819: [sock] DEBUG: tcp_server() [127.0.0.10]:7777 (../lib/core/ogs-tcp.c:60)
10/22 10:59:03.819: [sbi] INFO: nghttp2_server() [127.0.0.10]:7777 (../lib/sbi/nghttp2-server.c:150)
10/22 10:59:03.819: [sock] DEBUG: socket create(10:1:6) (../lib/core/ogs-socket.c:92)
10/22 10:59:03.819: [sock] DEBUG: Turn on TCP_NODELAY (../lib/core/ogs-sockopt.c:139)
10/22 10:59:03.819: [sock] DEBUG: Turn on SO_REUSEADDR (../lib/core/ogs-sockopt.c:120)
10/22 10:59:03.819: [sock] DEBUG: socket bind ::1:7777 (../lib/core/ogs-socket.c:117)
10/22 10:59:03.819: [sock] DEBUG: tcp_server() [::1]:7777 (../lib/core/ogs-tcp.c:60)
10/22 10:59:03.819: [sbi] INFO: nghttp2_server() [::1]:7777 (../lib/sbi/nghttp2-server.c:150)
10/22 10:59:03.819: [thread] DEBUG: [0x5601b141e520] worker signal (../lib/core/ogs-thread.c:66)
10/22 10:59:03.819: [nrf] DEBUG: nrf_state_initial(): INIT (../src/nrf/nrf-sm.c:25)
10/22 10:59:03.819: [nrf] DEBUG: nrf_state_operational(): ENTRY (../src/nrf/nrf-sm.c:50)
10/22 10:59:03.819: [thread] DEBUG: [0x5601b141e520] thread started (../lib/core/ogs-thread.c:101)
10/22 10:59:03.819: [app] INFO: NRF initialize...done (../src/nrf/app.c:31)
10/22 10:59:03.864: [thread] DEBUG: [0x55fab86d2100] worker signal (../lib/core/ogs-thread.c:66)
10/22 10:59:03.864: [thread] DEBUG: [0x55fab86d2100] thread started (../lib/core/ogs-thread.c:101)
Open5GS daemon v2.4.11-100-gbea24d7
...
```

View File

@@ -1,372 +0,0 @@
---
title: Open5GS Splitting Network Functions
head_inline: "<style> .blue { color: blue; } </style>"
---
In a production network, NFs are usually not on the same machine as the default example that comes with Open5GS.
Open5GS is designed to comply with standards, so in theory you can connect core network functions from Open5GS or other vendors to form a functioning network. However, this is only possible if it complies with 3GPP.
To demonstrate this, we will cover how to isolate each network function and connect each network function to another. For some interfaces, you can specify multiple interfaces to connect to multiple interfaces.
In this example, we are connecting the Open5GS NF together, but instead of the Open5GS network function, you can easily connect them like other vendors' NFs.
## 1. Configuring Open5GS (Without other vendors' NFs)
_Cloud Authentication and Session Management Server_
```
MongoDB = 127.0.0.1 (subscriber data) - http://localhost:3000
MME-s1ap = 10.10.0.2 :36412 (authVPN) for S1-MME
MME-gtpc = 127.0.0.2 :2123 for S11
MME-frDi = 127.0.0.2 :3868 for S6a auth
SGWC-gtpc = 127.0.0.3 :2123 for S11
SGWC-pfcp = 10.10.0.3 :8805 (authVPN) for Sxa
SMF-gtpc = 127.0.0.4 :2123 for S5/8c, N11
SMF-pfcp = 10.10.0.4 :8805 (authVPN) for N4
SMF-frDi = 127.0.0.4 :3868 for Gx auth
SMF-sbi = 127.0.0.4 :7777 for 5G SBI (N7,N10,N11)
AMF-ngap = 10.10.0.5 :38412 (authVPN) for N2
AMF-sbi = 127.0.0.5 :7777 for 5G SBI (N8,N12,N11)
HSS-frDi = 127.0.0.8 :3868 for S6a auth
PCRF-frDi = 127.0.0.9 :3868 for Gx auth
NRF-sbi = 127.0.0.10:7777 for 5G SBI
AUSF-sbi = 127.0.0.11:7777 for 5G SBI
UDM-sbi = 127.0.0.12:7777 for 5G SBI
PCF-sbi = 127.0.0.13:7777 for 5G SBI
NSSF-sbi = 127.0.0.14:7777 for 5G SBI
BSF-sbi = 127.0.0.15:7777 for 5G SBI
UDR-sbi = 127.0.0.20:7777 for 5G SBI
```
_Cloud Userplane Server (to host IMS etc)_
```
SGWU-pfcp = 10.10.0.6 :8805 (authVPN) for Sxa
SGWU-gtpu = 10.11.0.6 :2152 (userplaneVPN) for S1-U, S5/8u
UPF-pfcp = 10.10.0.7 :8805 (authVPN) for N4
UPF-gtpu = 10.11.0.7 :2152 (userplaneVPN) for S5/8u, N3
```
You can refer to the network settings at
[{{ site.url }}{{ site.baseurl }}/assets/Open5GS-Diagram.pdf]({{ site.url }}{{ site.baseurl }}/assets/Open5GS-Diagram.pdf) provided by [@kbarlee](https://github.com/kbarlee) in issue [#528](https://github.com/{{ site.github_username }}/open5gs/issues/528)
{: .notice--danger}
Modify [install/etc/open5gs/mme.yaml](https://github.com/{{ site.github_username }}/open5gs/blob/main/configs/open5gs/mme.yaml.in) to set the S1AP IP address, PLMN ID, and TAC.
```diff
$ diff -u /etc/open5gs/mme.yaml.old /etc/open5gs/mme.yaml
--- mme.yaml.old 2020-08-22 11:36:40.512418765 -0400
+++ mme.yaml 2020-08-22 11:36:27.081466682 -0400
@@ -204,20 +204,20 @@
mme:
freeDiameter: /home/acetcom/Documents/git/open5gs/install/etc/freeDiameter/mme.conf
s1ap:
- addr: 127.0.0.2
+ addr: 10.10.0.2
gtpc:
addr: 127.0.0.2
gummei:
plmn_id:
- mcc: 001
- mnc: 01
+ mcc: 999
+ mnc: 70
mme_gid: 2
mme_code: 1
tai:
plmn_id:
- mcc: 001
- mnc: 01
- tac: 7
+ mcc: 999
+ mnc: 70
+ tac: 1
security:
integrity_order : [ EIA1, EIA2, EIA0 ]
ciphering_order : [ EEA0, EEA1, EEA2 ]
```
Modify [install/etc/open5gs/sgwc.yaml](https://github.com/{{ site.github_username }}/open5gs/blob/main/configs/open5gs/sgwc.yaml.in) to set the PFCP IP address.
```diff
$ diff -u /etc/open5gs/sgwc.yaml.old /etc/open5gs/sgwc.yaml
@@ -49,7 +49,7 @@
gtpc:
addr: 127.0.0.3
pfcp:
- addr: 127.0.0.3
+ addr: 10.10.0.3
#
# sgwu:
@@ -100,7 +100,7 @@
#
sgwu:
pfcp:
- addr: 127.0.0.6
+ addr: 10.10.0.6
#
# parameter:
```
Modify [install/etc/open5gs/smf.yaml](https://github.com/{{ site.github_username }}/open5gs/blob/main/configs/open5gs/smf.yaml.in) to set the PFCP IP address.
```diff
$ diff -u /etc/open5gs/smf.yaml.old /etc/open5gs/smf.yaml
--- smf.yaml.old 2020-08-22 11:37:39.990816411 -0400
+++ smf.yaml 2020-08-22 11:38:18.647999952 -0400
@@ -187,8 +187,7 @@
- addr: 127.0.0.4
- addr: ::1
pfcp:
- - addr: 127.0.0.4
- - addr: ::1
+ - addr: 10.10.0.4
subnet:
- addr: 10.45.0.1/16
- addr: 2001:db8:cafe::1/48
@@ -282,7 +281,7 @@
#
upf:
pfcp:
- - addr: 127.0.0.7
+ - addr: 10.10.0.7
#
# parameter:
```
Modify [install/etc/open5gs/amf.yaml](https://github.com/{{ site.github_username }}/open5gs/blob/main/configs/open5gs/amf.yaml.in) to set the NGAP IP address, PLMN ID, TAC and NSSAI.
```diff
diff -u /etc/open5gs/amf.yaml.old /etc/open5gs/amf.yaml
--- amf.yaml.old 2020-06-21 23:34:14.643114779 -0400
+++ amf.yaml 2020-06-21 23:34:28.718482095 -0400
@@ -67,25 +67,25 @@
- addr: 127.0.0.5
port: 7777
ngap:
- - addr: 127.0.0.5
+ - addr: 10.10.0.5
guami:
- plmn_id:
- mcc: 001
- mnc: 01
+ mcc: 999
+ mnc: 70
amf_id:
region: 2
set: 1
tai:
- plmn_id:
- mcc: 001
- mnc: 01
- tac: 7
+ mcc: 999
+ mnc: 70
+ tac: 1
plmn_support:
- plmn_id:
- mcc: 001
- mnc: 01
+ mcc: 999
+ mnc: 70
s_nssai:
- sst: 1
- - sd: 2
security:
integrity_order : [ NIA1, NIA2, NIA0 ]
ciphering_order : [ NEA0, NEA1, NEA2 ]
```
Modify [install/etc/open5gs/sgwu.yaml](https://github.com/{{ site.github_username }}/open5gs/blob/main/configs/open5gs/sgwu.yaml.in) to set the GTP-U and PFCP IP address.
```diff
$ diff -u /etc/open5gs/sgwu.yaml.old /etc/open5gs/sgwu.yaml
--- sgwu.yaml.old 2020-08-22 11:41:09.214670723 -0400
+++ sgwu.yaml 2020-08-22 11:41:27.433937124 -0400
@@ -51,9 +51,9 @@
#
sgwu:
gtpu:
- addr: 127.0.0.6
+ addr: 10.11.0.6
pfcp:
- addr: 127.0.0.6
+ addr: 10.10.0.6
#
# sgwc:
```
Modify [install/etc/open5gs/upf.yaml](https://github.com/{{ site.github_username }}/open5gs/blob/main/configs/open5gs/upf.yaml.in) to set the GTP-U and PFCP IP address.
```diff
$ diff -u /etc/open5gs/upf.yaml.old /etc/open5gs/upf.yaml
--- upf.yaml.old 2020-08-22 11:42:57.781750067 -0400
+++ upf.yaml 2020-08-22 11:43:13.268901616 -0400
@@ -59,11 +59,9 @@
#
upf:
pfcp:
- - addr: 127.0.0.7
+ - addr: 10.10.0.7
gtpu:
- - addr:
- - 127.0.0.7
- - ::1
+ - addr: 10.11.0.7
subnet:
- addr: 10.45.0.1/16
- addr: 2001:db8:cafe::1/48
```
After changing conf files, please restart Open5GS daemons.
```bash
$ sudo systemctl restart open5gs-mmed.service
$ sudo systemctl restart open5gs-sgwcd.service
$ sudo systemctl restart open5gs-smfd.service
$ sudo systemctl restart open5gs-amfd.service
$ sudo systemctl restart open5gs-upfd.service
$ sudo systemctl restart open5gs-sgwud.service
```
## 2. External SMF
In it's simplest form the SMF has 4 interfaces:
* S5 - Connection to home network SGW-C (GTP-C)
* Gx - Connection to PCRF (Diameter)
* SBI - Service-based interface(HTTP2)
* Sgi - Connection to external network (Generally the Internet via standard TCP/IP)
#### S5 Interface Configuration
Edit ```/etc/open5gs/smf.yaml``` and change the address to IP of the server running the SMF for the listener on GTP-C interfaces.
```
smf:
freeDiameter: /etc/freeDiameter/smf.conf
gtpc:
addr:
- 10.0.1.121
```
#### Gx Interface Configuration
Edit ```/etc/freeDiameter/smf.conf```
Update ```ListenOn``` address to IP of the server running the SMF:
``` ListenOn = "10.0.1.121"; ```
Update ConnectPeer to connect to the PCRF on it's IP.
```ConnectPeer = "pcrf.localdomain" { ConnectTo = "10.0.1.123"; No_TLS; };```
#### Restart Services
Restart Open5GS SMF Daemon:
``` $ sudo systemctl restart open5gs-smfd.service ```
## 3. External SGW-C
In it's simplest form the SGW-C has 2 interfaces:
* S11 - Connection to MME (GTP-C)
* S5 - Connection to the home network SMF (GTP-C)
#### S5 Interface Configuration
Edit ```/etc/open5gs/sgwc.yaml``` and change the address to IP of the server running the SGW-C for the listener on GTP-C interface.
```
sgwc:
gtpc:
addr:
- 10.0.1.122
```
Restart Open5GS SGW-C Daemon:
``` $ sudo systemctl restart open5gs-sgwcd.service ```
## 4. External PCRF
In it's simplest from the PCRF has 1 network interface:
* Gx - Connection to SMF (Diameter)
#### Gx Interface Configuration
Edit ```/etc/freeDiameter/pcrf.conf```
Update ```ListenOn``` address to IP of the server running the HSS on it's IP:
``` ListenOn = "10.0.1.123"; ```
Update ConnectPeer to connect to the MME.
```ConnectPeer = "smf.localdomain" { ConnectTo = "10.0.1.121"; No_TLS; };```
#### MongoDB Interface Configuration
Edit the ```db_uri:``` to point at the Open5GS: ```db_uri: mongodb://10.0.1.118/open5gs```
Restart Open5GS PCRF Daemon:
``` $ sudo systemctl restart open5gs-pcrfd.service ```
## 5. External HSS
In it's simplest form the HSS has 1 network interface:
* S6a - Connection to MME (Diameter)
#### S6a Interface Configuration
Edit ```/etc/freeDiameter/hss.conf```
Update ```ListenOn``` address to IP of the server running the HSS on it's IP:
``` ListenOn = "10.0.1.118"; ```
Update ConnectPeer to connect to the MME.
```ConnectPeer = "mme.localdomain" { ConnectTo = "10.0.1.124"; No_TLS; };```
Restart Open5GS HSS Daemon:
``` $ sudo systemctl restart open5gs-hssd.service ```
#### MongoDB Interface Configuration (Open5GS specific)
If you are using Open5GS's HSS you may need to enable MongoDB access from the PCRF. This is done by editing ''/etc/mongodb.conf'' and changing the bind IP to:
``` bind_ip = 0.0.0.0 ```
Restart MongoDB for changes to take effect.
``` $ /etc/init.d/mongodb restart ```
## 6. External MME
In it's simplest form the MME has 3 interfaces:
* S1AP - Connections from eNodeBs
* S6a - Connection to HSS (Diameter)
* S11 - Connection to SGW-C (GTP-C)
#### S11 Interface Configuration
Edit ```/etc/open5gs/mme.yaml``` and filling the IP address of the SGW-C and SMF servers.
```
sgwc:
gtpc:
addr: 10.0.1.122
smf:
gtpc:
addr:
- 10.0.1.121
```
#### S6a Interface Configuration
Edit ```/etc/freeDiameter/mme.conf```
Update ```ListenOn``` address to IP of the server running the MME:
``` ListenOn = "10.0.1.124"; ```
Update ConnectPeer to connect to the PCRF on it's IP.
```ConnectPeer = "hss.localdomain" { ConnectTo = "10.0.1.118"; No_TLS; };```
#### Restart Services
Restart Open5GS MME Daemon:
``` $ sudo systemctl restart open5gs-mmed.service ```

View File

@@ -328,9 +328,10 @@ $ cd build
$ ninja install
$ cd ../
$ ls install/bin
open5gs-amfd open5gs-hssd open5gs-nrfd open5gs-sgwcd open5gs-smfd open5gs-udrd
open5gs-ausfd open5gs-mmed open5gs-pcrfd open5gs-sgwud open5gs-udmd open5gs-pcfd
open5gs-upfd open5gs-nssfd open5gs-bsfd
open5gs-amfd open5gs-mmed open5gs-pcrfd open5gs-smfd
open5gs-ausfd open5gs-nrfd open5gs-scpd open5gs-udmd
open5gs-bsfd open5gs-nssfd open5gs-sgwcd open5gs-udrd
open5gs-hssd open5gs-pcfd open5gs-sgwud open5gs-upfd
```
## Building WebUI of Open5GS
@@ -347,7 +348,7 @@ Install the dependencies to run WebUI
```bash
$ cd ~/open5gs
$ cd webui
$ npm ci --no-optional
$ npm ci
```
The WebUI runs as an [npm](https://www.npmjs.com/) script.

View File

@@ -127,7 +127,7 @@ Install the dependencies to run WebUI
```bash
$ cd webui
$ npm ci --no-optional
$ npm ci
```
The WebUI runs as an [npm](https://www.npmjs.com/) script.

View File

@@ -164,7 +164,7 @@ Install the dependencies to run WebUI
```bash
$ cd webui
$ npm ci --no-optional
$ npm ci
```
The WebUI runs as an [npm](https://www.npmjs.com/) script.

View File

@@ -162,7 +162,7 @@ Install the dependencies to run WebUI
```bash
$ cd webui
$ npm ci --no-optional
$ npm ci
```
The WebUI runs as an [npm](https://www.npmjs.com/) script.

View File

@@ -207,7 +207,7 @@ Install the dependencies to run WebUI
```bash
$ cd webui
$ npm ci --no-optional
$ npm ci
```
The WebUI runs as an [npm](https://www.npmjs.com/) script.

View File

@@ -105,7 +105,7 @@ Install the dependencies to run WebUI
```bash
$ cd webui
$ npm ci --no-optional
$ npm ci
```
The WebUI runs as an [npm](https://www.npmjs.com/) script.

View File

@@ -21,6 +21,7 @@ open5gs 26934 0.0 0.0 707472 12732 ? Ssl 12:13 0:00 /usr/bin/open5g
open5gs 27244 0.2 0.0 2861424 13584 ? Ssl 12:13 0:00 /usr/bin/open5gs-hssd -c /etc/open5gs/hss.yaml
open5gs 27366 0.0 0.0 2890772 14380 ? Ssl 12:13 0:00 /usr/bin/open5gs-pcrfd -c /etc/open5gs/pcrf.yaml
open5gs 27485 0.0 0.0 243816 15064 ? Ssl 12:13 0:00 /usr/bin/open5gs-nrfd -c /etc/open5gs/nrf.yaml
open5gs 27485 0.0 0.0 243916 13064 ? Ssl 12:13 0:00 /usr/bin/open5gs-scpd -c /etc/open5gs/scp.yaml
open5gs 27543 0.0 0.0 222416 9672 ? Ssl 12:13 0:00 /usr/bin/open5gs-ausfd -c /etc/open5gs/ausf.yaml
open5gs 27600 0.0 0.0 222328 9668 ? Ssl 12:13 0:00 /usr/bin/open5gs-udmd -c /etc/open5gs/udm.yaml
open5gs 27600 0.0 0.0 222329 9669 ? Ssl 12:13 0:00 /usr/bin/open5gs-pcfd -c /etc/open5gs/pcf.yaml
@@ -29,7 +30,7 @@ open5gs 27600 0.0 0.0 222329 9669 ? Ssl 12:13 0:00 /usr/bin/open5g
open5gs 27697 0.0 0.0 243976 13716 ? Ssl 12:13 0:00 /usr/bin/open5gs-udrd -c /etc/open5gs/udr.yaml
```
You should see each of the above services, MME, SGW-C, SMF, AMF, SGW-U, UPF, HSS, PCRF, NRF, AUSF, UDM, PCF, NSSF, BSF & UDR are all running.
You should see each of the above services, MME, SGW-C, SMF, AMF, SGW-U, UPF, HSS, PCRF, NRF, SCP, AUSF, UDM, PCF, NSSF, BSF & UDR are all running.
If your instance doesn't show this make sure you're started each service:
```bash
@@ -42,6 +43,7 @@ $ systemctl start open5gs-upfd.service
$ systemctl start open5gs-hssd.service
$ systemctl start open5gs-pcrfd.service
$ systemctl start open5gs-nrfd.service
$ systemctl start open5gs-scpd.service
$ systemctl start open5gs-ausfd.service
$ systemctl start open5gs-udmd.service
$ systemctl start open5gs-pcfd.service
@@ -55,14 +57,15 @@ $ systemctl start open5gs-udrd.service
If a service isn't running check the log for that service - logs for each service live in */var/log/open5gs/* where each service logs to it's own file - MME logs in mme.log, AMF logs in amf.log, and so on.
```bash
$ cat /var/log/open5gs/mme.log
Open5GS daemon v1.0.0
$ cat a.log
Open5GS daemon v2.4.11-100-gbea24d7
[app] INFO: Configuration: '/etc/open5gs/mme.yaml' (../src/main.c:54)
[app] INFO: File Logging: '/var/log/open5gs/mme.log' (../src/main.c:57)
[mme] ERROR: No sgwc.gtpc in '/etc/open5gs/mme.yaml' (../src/mme/mme-context.c:192)
[app] ERROR: Failed to intialize MME (../src/mme/app-init.c:30)
[app] FATAL: Open5GS initialization failed. Aborted (../src/main.c:222)
10/22 11:05:40.032: [app] INFO: Configuration: '/home/acetcom/Documents/git/open5gs/install/etc/open5gs/mme.yaml' (../lib/app/ogs-init.c:126)
10/22 11:05:40.032: [app] INFO: File Logging: 'a.log' (../lib/app/ogs-init.c:129)
10/22 11:05:40.094: [gtp] INFO: gtp_server() [127.0.0.2]:2123 (../lib/gtp/path.c:30)
10/22 11:05:40.094: [gtp] INFO: gtp_connect() [127.0.0.3]:2123 (../lib/gtp/path.c:60)
10/22 11:05:40.094: [mme] INFO: s1ap_server() [127.0.0.2]:36412 (../src/mme/s1ap-sctp.c:62)
10/22 11:05:40.094: [sctp] INFO: MME initialize...done (../src/mme/app-init.c:33)
```
Or, you can use `journalctl` like below to view live log.
@@ -181,11 +184,11 @@ $ diff -u /etc/open5gs/amf.yaml.old /etc/open5gs/amf.yaml
@@ -20,6 +20,7 @@
#
logger:
file: /home/acetcom/Documents/git/open5gs/install/var/log/open5gs/amf.log
file: @localstatedir@/log/open5gs/amf.log
+ level: debug
#
# amf:
#
```
After changing conf files, please restart Open5GS daemons.

View File

@@ -92,7 +92,7 @@ home/open5gs/install/lib/x86_64-linux-gnu/libfdcore.so.7(+0x67c3c) [0x7f3b715f9c
At this time, you need to check the DB schema is in the form below by using the command the below.
```
$ mongo
$ mongosh
> use open5gs
> db.subscribers.find().pretty()
{
@@ -159,7 +159,7 @@ $ mongo
If you see below, you are using the old format DB schema.
```
$ mongo
$ mongosh
> use open5gs
> db.subscribers.find().pretty()
{
@@ -207,7 +207,7 @@ If you are using old format DB schema, please perform the following step.
1. First of all, it is recommended to use the following command to remove all existing subscription DB.
```
$ mongo
$ mongosh
> use open5gs
switched to db open5gs
> db.subscribers.drop()
@@ -221,7 +221,7 @@ $ curl -fsSL https://open5gs.org/open5gs/assets/webui/install | sudo -E bash -
4. Log in to the new WebUI and add new subscriber information using your web browser.
5. Make sure it is a new DB schema as below:
```
$ mongo
$ mongosh
> use open5gs
> db.subscribers.find().pretty()
{
@@ -256,7 +256,7 @@ This is a test program bug and has not yet been resolved.
To restart the test program, first remove all subscriber information using MongoDB Client
```
$ mongo
$ mongosh
> use open5gs
switched to db open5gs
> db.subscribers.find() ### Check the test subscriber
@@ -276,6 +276,7 @@ $ sudo pkill -9 open5gs-upfd
$ sudo pkill -9 open5gs-hssd
$ sudo pkill -9 open5gs-pcrfd
$ sudo pkill -9 open5gs-nrfd
$ sudo pkill -9 open5gs-scpd
$ sudo pkill -9 open5gs-ausfd
$ sudo pkill -9 open5gs-udmd
$ sudo pkill -9 open5gs-pcfd
@@ -312,7 +313,7 @@ $ diff --git a/configs/open5gs/amf.yaml.in b/configs/open5gs/amf.yaml.in
index 7e939e81..dfe4456d 100644
--- a/configs/open5gs/amf.yaml.in
+++ b/configs/open5gs/amf.yaml.in
@@ -199,6 +199,12 @@ amf:
@@ -315,6 +315,12 @@ amf:
mnc: 70
s_nssai:
- sst: 1
@@ -332,9 +333,9 @@ $ diff --git a/configs/open5gs/smf.yaml.in b/configs/open5gs/smf.yaml.in
index d45aa60f..701ee533 100644
--- a/configs/open5gs/smf.yaml.in
+++ b/configs/open5gs/smf.yaml.in
@@ -317,6 +317,11 @@ logger:
#
@@ -442,6 +442,11 @@ logger:
#
smf:
+ info:
+ - s_nssai:
@@ -351,7 +352,7 @@ $ diff --git a/configs/open5gs/smf.yaml.in b/configs/open5gs/smf.yaml.in
index d45aa60f..949da220 100644
--- a/configs/open5gs/smf.yaml.in
+++ b/configs/open5gs/smf.yaml.in
@@ -317,6 +317,12 @@ logger:
@@ -442,6 +442,12 @@ logger:
#
smf:
@@ -370,7 +371,7 @@ $ diff --git a/configs/open5gs/nssf.yaml.in b/configs/open5gs/nssf.yaml.in
index ecd4f7e2..04d9c4ba 100644
--- a/configs/open5gs/nssf.yaml.in
+++ b/configs/open5gs/nssf.yaml.in
@@ -119,6 +119,11 @@ nssf:
@@ -201,6 +201,12 @@ nssf:
port: 7777
s_nssai:
sst: 1
@@ -379,9 +380,10 @@ index ecd4f7e2..04d9c4ba 100644
+ s_nssai:
+ sst: 1
+ sd: 000080
+
#
# nrf:
# scp:
```
Then add a slice to MongoDB's subscriber info.
@@ -409,6 +411,7 @@ And the process below is only used in 5G, so there is no need to run it.
```bash
$ open5gs-nrfd
$ open5gs-scpd
$ open5gs-amfd
$ open5gs-ausfd
$ open5gs-udmd
@@ -503,9 +506,9 @@ Now, you need to modify the configuration file of Open5GS to adjust the UE IP Po
$ diff -u smf.yaml smf.yaml.new
--- smf.yaml 2020-09-17 09:31:16.547882093 -0400
+++ smf.yaml.new 2020-09-17 09:32:18.267726844 -0400
@@ -190,7 +190,7 @@
- addr: 127.0.0.4
- addr: ::1
@@ -458,7 +458,7 @@ smf:
addr: 127.0.0.4
port: 9090
subnet:
- - addr: 10.45.0.1/16
+ - addr: 10.46.0.1/16
@@ -518,7 +521,7 @@ $ diff -u smf.yaml smf.yaml.new
$ diff -u upf.yaml upf.yaml.new
--- upf.yaml 2020-09-17 09:31:16.547882093 -0400
+++ upf.yaml.new 2020-09-17 09:32:25.199619989 -0400
@@ -139,7 +139,7 @@
@@ -170,7 +170,7 @@ upf:
gtpu:
- addr: 127.0.0.7
subnet:
@@ -596,7 +599,7 @@ Please make sure that MongoDB server daemon is running.
Then, remove all subscriber information using MongoDB Client
```
$ mongo
$ mongosh
> use open5gs
switched to db open5gs
> db.subscribers.find() ### Check the test subscriber
@@ -616,6 +619,7 @@ $ sudo pkill -9 open5gs-upfd
$ sudo pkill -9 open5gs-hssd
$ sudo pkill -9 open5gs-pcrfd
$ sudo pkill -9 open5gs-nrfd
$ sudo pkill -9 open5gs-scpd
$ sudo pkill -9 open5gs-ausfd
$ sudo pkill -9 open5gs-udmd
$ sudo pkill -9 open5gs-pcfd
@@ -998,7 +1002,7 @@ attach_test : -Line 134: Condition is false, but expected true
Remove all subscriber information using MongoDB Client
```
$ mongo
$ mongosh
> db.subscribers.find() ### Check the test subscriber
> db.subscribers.drop() ### Remove all subscriber
> db.subscribers.find() ### Check that all subscribers are empty
@@ -1077,6 +1081,7 @@ Currently, the number of UE is limited to `128*128`.
* HSS : 127.0.0.8
* PCRF : 127.0.0.9
* NRF : 127.0.0.10
* SCP : 127.0.1.10
* AUSF : 127.0.0.11
* UDM : 127.0.0.12
* PCF : 127.0.0.13

View File

@@ -156,9 +156,20 @@ $ make test
#### 3. Open5GS
Install the MongoDB packages.
```bash
```
The Open5GS package is available on the recent versions of *Ubuntu*.
```bash
# Install the MongoDB Packages
$ wget -qO - https://www.mongodb.org/static/pgp/server-6.0.asc | sudo apt-key add -
$ echo "deb [ arch=amd64,arm64 ] https://repo.mongodb.org/apt/ubuntu focal/mongodb-org/6.0 multiverse" | sudo tee /etc/apt/sources.list.d/mongodb-org-6.0.list
$ sudo apt update
$ sudo apt install mongodb-org
# Getting the authentication key
$ sudo apt install wget
$ wget https://download.opensuse.org/repositories/home:/acetcom:/open5gs:/latest/xUbuntu_20.04/Release.key
@@ -173,7 +184,7 @@ $ sudo apt install open5gs
The following shows how to install the Web UI of Open5GS.
```bash
$ curl -fsSL https://deb.nodesource.com/setup_14.x | sudo -E bash -
$ curl -fsSL https://deb.nodesource.com/setup_18.x | sudo -E bash -
$ sudo apt install nodejs
$ curl -fsSL https://open5gs.org/open5gs/assets/webui/install | sudo -E bash -
```
@@ -229,16 +240,17 @@ Modify [install/etc/open5gs/mme.yaml](https://github.com/{{ site.github_username
```diff
$ diff -u /etc/open5gs/mme.yaml.old /etc/open5gs/mme.yaml
--- mme.yaml.old 2020-08-22 12:07:32.755250028 -0400
+++ mme.yaml 2020-08-22 12:08:17.309320211 -0400
@@ -208,20 +208,20 @@
mme:
freeDiameter: /home/acetcom/Documents/git/open5gs/install/etc/freeDiameter/mme.conf
--- mme.yaml 2020-09-05 20:52:28.648235143 -0400
+++ mme.yaml.new 2020-09-05 20:56:05.434484208 -0400
@@ -253,20 +253,20 @@ mme:
s1ap:
- addr: 127.0.0.2
+ addr: 127.0.1.2
- - addr: 127.0.0.2
+ - addr: 10.10.0.2
gtpc:
- addr: 127.0.0.2
metrics:
addr: 127.0.0.2
port: 9090
gummei:
plmn_id:
- mcc: 999
@@ -251,28 +263,26 @@ $ diff -u /etc/open5gs/mme.yaml.old /etc/open5gs/mme.yaml
plmn_id:
- mcc: 999
- mnc: 70
- tac: 1
+ mcc: 310
+ mnc: 789
+ tac: 2
tac: 1
security:
integrity_order : [ EIA1, EIA2, EIA0 ]
ciphering_order : [ EEA0, EEA1, EEA2 ]
integrity_order : [ EIA2, EIA1, EIA0 ]
```
Modify [install/etc/open5gs/sgwu.yaml](https://github.com/{{ site.github_username }}/open5gs/blob/main/configs/open5gs/sgwu.yaml.in) to set the GTP-U IP address.
```diff
$ diff -u /etc/open5gs/sgwu.yaml.old /etc/open5gs/sgwu.yaml
--- sgwu.yaml.old 2020-08-22 12:08:44.782880778 -0400
+++ sgwu.yaml 2020-08-22 12:06:49.809299514 -0400
@@ -82,7 +82,7 @@
--- sgwu.yaml 2020-09-05 20:50:39.393022566 -0400
+++ sgwu.yaml.new 2020-09-05 20:51:06.667838823 -0400
@@ -98,7 +98,7 @@ logger:
#
sgwu:
gtpu:
- addr: 10.11.0.6
+ addr: 127.0.0.6
pfcp:
addr: 127.0.0.6
- - addr: 10.11.0.6
+ - addr: 127.0.0.6
gtpu:
- addr: 127.0.0.6
```

View File

@@ -15,6 +15,11 @@ head_inline: "<style> ul { padding-bottom: 1em; } </style>"
- [Dockerized VoLTE Setup](tutorial/03-VoLTE-dockerized)
- [Metrics with Prometheus](tutorial/04-metrics-prometheus)
- Inside Source Code
- [Detailed Architecture of Open5GS](https://chowdera.com/2022/151/202205312246348316.html)
- [UPF Code Explanation](https://medium.com/@aditya.koranga/open5gs-upf-code-explanation-with-flow-c-79c50f253dd1)
- [SMF Code Explanation](https://medium.com/@aditya.koranga/open5gs-smf-code-explanation-with-flow-charts-a3b3cd38c991)
- Troubleshooting
- [Simple Issues](troubleshoot/01-simple-issues)
- [Now in Github Issues](troubleshoot/02-now-in-github-issues)

View File

@@ -52,7 +52,7 @@ true
$ git checkout v2.1.7
$ cd webui
$ rm -Rf ./node_modules
$ npm ci --no-optional
$ npm ci
$ npm run dev
## You should log out
@@ -60,7 +60,7 @@ $ npm run dev
$ git checkout main
$ cd webui
$ rm -Rf ./node_modules
$ npm ci --no-optional
$ npm ci
$ npm run dev
## You can log back in

View File

@@ -46,7 +46,7 @@ true
$ git checkout v2.1.7
$ cd webui
$ rm -Rf ./node_modules
$ npm ci --no-optional
$ npm ci
$ npm run dev
## You should log out
@@ -54,7 +54,7 @@ $ npm run dev
$ git checkout main
$ cd webui
$ rm -Rf ./node_modules
$ npm ci --no-optional
$ npm ci
$ npm run dev
## You can log back in

View File

@@ -42,7 +42,7 @@ true
$ git checkout v2.1.7
$ cd webui
$ rm -Rf ./node_modules
$ npm ci --no-optional
$ npm ci
$ npm run dev
## You should log out
@@ -50,7 +50,7 @@ $ npm run dev
$ git checkout main
$ cd webui
$ rm -Rf ./node_modules
$ npm ci --no-optional
$ npm ci
$ npm run dev
## You can log back in

View File

@@ -36,7 +36,7 @@ true
$ git checkout v2.1.7
$ cd webui
$ rm -Rf ./node_modules
$ npm ci --no-optional
$ npm ci
$ npm run dev
## You should log out
@@ -44,7 +44,7 @@ $ npm run dev
$ git checkout main
$ cd webui
$ rm -Rf ./node_modules
$ npm ci --no-optional
$ npm ci
$ npm run dev
## You can log back in

View File

@@ -1,6 +1,6 @@
---
title: "v2.4.10 - Service-name based NF Discovery"
date: 2022-09-09 09:43:00 +0900
title: "v2.4.12 - Service-name based NF Discovery"
date: 2022-11-18 22:00:00 +0900
categories:
- Release
tags:
@@ -9,6 +9,7 @@ tags:
head_inline: "<style> ul { padding-bottom: 1em; } .blue { color: blue; }</style>"
---
#### New Features
- [CONF] Service-name based NF Discovery -- [f020732](https://github.com/open5gs/open5gs/commit/f020732ce9f60217dfcd0b7e9ba5c8949db966d5), [9f98d42](https://github.com/open5gs/open5gs/commit/9f98d421a081a5edc3a525d1cf2504b8b6cf059e), [5295c10](https://github.com/open5gs/open5gs/commit/5295c108adc2fc5ae97ee5007760334ef7a6297b)
@@ -16,9 +17,17 @@ head_inline: "<style> ul { padding-bottom: 1em; } .blue { color: blue; }</style>
- [SBI] Move state machine from src to lib directory -- [e6a14cb](https://github.com/open5gs/open5gs/commit/e6a14cb73debbdc21e91499b75dde3d71a5aa02b)
- [SBI] Increased the MAX stream number from UE * 16 -- [db37bc8](https://github.com/open5gs/open5gs/commit/db37bc894459df38661bdf98891938ec3513bc72), [ec9fe7b](https://github.com/open5gs/open5gs/commit/ec9fe7b31d0253003244be498e8f963da63e7657), [603a746](https://github.com/open5gs/open5gs/commit/603a746f49c68b06ab5d8b3ceeca3afde987cab5)
- [Diameter] Improve S6A interface ([#1676](https://github.com/open5gs/open5gs/pull/1676), [#1698](https://github.com/open5gs/open5gs/pull/1698), [#1714](https://github.com/open5gs/open5gs/pull/1714)) -- [jmasterfunk84](https://github.com/jmasterfunk84)
- [MME] Added protection code if no PDN-Type ([#1756](https://github.com/open5gs/open5gs/pull/1756)) -- [yar-or81](https://github.com/yar-or81)
- [Metric] Move metrics configuration section under respective ([#1754](https://github.com/open5gs/open5gs/pull/1754)) -- [bmeglicit](https://github.com/bmeglicit)
- [Diameter] Enable Change Streams ([#1758](https://github.com/open5gs/open5gs/pull/1758)) -- [jmasterfunk84](https://github.com/jmasterfunk84)
- [AMF] Added amfInfoList to NFProfile ([#1757](https://github.com/open5gs/open5gs/pull/1757)) -- [gstaa](https://github.com/gstaa)
- [TLV] Acceptable even if the TLV length is smaller than expected ([#1780](https://github.com/open5gs/open5gs/discussions/1780)) -- [infinitydon](https://github.com/infinitydon)
- [Diameter] Introduce Cancel Location and Insert Subscription Data ([#1744](https://github.com/open5gs/open5gs/pull/1744)) -- [jmasterfunk84](https://github.com/jmasterfunk84)
#### Security Issues
- [PFCP] Fixed security protection -- [CVE-2022-39063](https://cve.report/CVE-2022-39063), [d99491a](https://github.com/open5gs/open5gs/commit/d99491aca5304460d3929b37bf26e064efd86686), [444e182](https://github.com/open5gs/open5gs/commit/444e1822887a78d3c3ef1f0bcaad9ee10ac951c3)
- [SBI] Fixed HTTP2 crash from random JSON data ([#1679](https://github.com/open5gs/open5gs/issues/1679)) -- [Popvlvs](https://github.com/Popvlvs)
- [TLV] UPF crashes after UDP port scan ([#1767](https://github.com/open5gs/open5gs/issues/1767)) -- [Popvlvs](https://github.com/Popvlvs)
#### Bug Fixes
- [SBI] Fixed memory leak and CPU usage 100% -- [7231daf](https://github.com/open5gs/open5gs/commit/7231dafbf12c2009ec6fe740686342e2c5d245a2), [c716a12](https://github.com/open5gs/open5gs/commit/c716a1294a6120f4100ba2efa9039f6168d74ce7)
@@ -27,6 +36,12 @@ head_inline: "<style> ul { padding-bottom: 1em; } .blue { color: blue; }</style>
- [SMF] Fixed abort on app exit when no diameter configuration -- ([#1710](https://github.com/open5gs/open5gs/issues/1710)) -- [bmeglicit](https://github.com/bmeglicit)
- [MME] Fixed crash on sending SMS between UEs -- ([#1701](https://github.com/open5gs/open5gs/issues/1701)) -- [salibeh](https://github.com/salibeh)
- [MME] Fixed GTP transaction crash if it has already been removed during paging-- ([#1696](https://github.com/open5gs/open5gs/issues/1696)) -- [vsbc2010](https://github.com/vsbc2010)
- [5GC] Session deletion was not properly worked in BSF([#1725](https://github.com/open5gs/open5gs/issues/1725)) -- [prasenjitpdas](https://github.com/prasenjitpdas)
- [AMF] In deregistration state, we use an invalid state-machine pointer. ([#1805](https://github.com/open5gs/open5gs/pull/1805)) -- [bmeglicit](https://github.com/bmeglicit)
- [SGWC] Fixed crash because session context could be deleted before response message is not received from SMF ([#1765](https://github.com/open5gs/open5gs/issues/1765)) -- [dai9000](https://github.com/dai9000)
- [SMF] Wait for both N1&N2 release signals before releasing session ([#1753](https://github.com/open5gs/open5gs/pull/1753)) -- [bmeglicit](https://github.com/bmeglicit)
- [UPF] UL and DL URR usage Report was swapped ([#1793](https://github.com/open5gs/open5gs/issues/1793)) -- [dibasdas02](https://github.com/dibasdas02)
- [CORE] Fixed timer overflow on 32bit systems ([#1770](https://github.com/open5gs/open5gs/pull/1770)) -- [spencersevilla](https://github.com/spencersevilla)
#### Specification Compliance
- [5GC] Handle APN/DNN names as case-insensitive ([#1747](https://github.com/open5gs/open5gs/pull/1747)) -- [jmasterfunk84](https://github.com/jmasterfunk84)
@@ -39,5 +54,5 @@ head_inline: "<style> ul { padding-bottom: 1em; } .blue { color: blue; }</style>
- [Diameter] Fixed the path of Nnrf_NFManagement Service ([#1683](https://github.com/open5gs/open5gs/issues/1683)) -- [s5uishida](https://github.com/s5uishida)
- [Diameter] Fixed AVP Occurring Too Many Times ([#1680](https://github.com/open5gs/open5gs/pull/1680)) -- [jmasterfunk84](https://github.com/jmasterfunk84)
Download -- [v2.4.10.tar.gz](https://github.com/open5gs/open5gs/archive/v2.4.10.tar.gz)
Download -- [v2.4.12.tar.gz](https://github.com/open5gs/open5gs/archive/v2.4.12.tar.gz)
{: .notice--info}

View File

@@ -0,0 +1,99 @@
---
title: "v2.5.6 - SCP for Indirect Communication"
date: 2022-11-18 22:59:00 +0900
categories:
- Release
tags:
- News
- Release
head_inline: "<style> ul { padding-bottom: 1em; } .blue { color: blue; }</style>"
---
#### New Feature
SCP(Service Communication Proxy) is added to support Indirect Communication based on TS29.500. The default Open5GS configuration is provided as an indirect communication using SCP.
- [amf.yaml] If NFs are configured to use Delegated Discovery through the SCP, you do not need to set up NRF.
```
amf:
sbi:
- addr: 127.0.0.5
port: 7777
scp:
sbi:
- addr: 127.0.1.10
port: 7777
#nrf:
# sbi:
# - addr:
# - 127.0.0.10
# - ::1
# port: 7777
```
- [scp.yaml] NRF is needed for Delegated Discovery in SCP configuration.
```
scp:
sbi:
- addr: 127.0.1.10
port: 7777
#
# next_scp:
# sbi:
# addr: 127.0.1.11
# port: 7777
#
nrf:
sbi:
- addr:
- 127.0.0.10
- ::1
port: 7777
```
- [nrf.yaml] If there is an SCP in the NRF configuration, a notification(nnrf-nfm/nf-status-notify) is sent through an indirect communication.
```
nrf:
sbi:
addr:
- 127.0.0.10
- ::1
port: 7777
scp:
sbi:
- addr: 127.0.1.10
port: 7777
```
#### Enhancements
- [WebUI/DB] Fixed the WebUI to Support MongoDB 6.0 ([#1824](https://github.com/open5gs/open5gs/issues/1824)) -- [bmeglicit](https://github.com/bmeglicit)
- [NAS] Discard NAS message if integrity is failed ([#1848](https://github.com/open5gs/open5gs/pull/1848)) -- [jmasterfunk84](https://github.com/jmasterfunk84)
- [AMF] Support REREGISTRATION_REQUIRED in dereg notify ([#1858](https://github.com/open5gs/open5gs/pull/1858)) -- [mitmitmitm](https://github.com/mitmitmitm)
- [SMF] Support Security Indication IE for 5G-SA UP integrity and confidentiality([#1851](https://github.com/open5gs/open5gs/discussions/1851)) -- [irazairspan](https://github.com/irazairspan)
- [DBI] Disable Changes Streams with mongo Version ([#1833](https://github.com/open5gs/open5gs/pull/1833)) -- [jmasterfunk84](https://github.com/jmasterfunk84)
- [SBI] Added 3gpp-Sbi-Sender-Timestamp and 3gpp-Sbi-Max-Rsp-Time -- [7c8722d](https://github.com/open5gs/open5gs/commit/7c8722d9d4d2db13d889be1e5e37bc062f069396)
- [MME] Cancel Location while Idle ([#1797](https://github.com/open5gs/open5gs/pull/1797)) -- [jmasterfunk84](https://github.com/jmasterfunk84)
- [MME] Support for Insert Subscriber Data ([#1794](https://github.com/open5gs/open5gs/pull/1794)) -- [jmasterfunk84](https://github.com/jmasterfunk84)
#### Bug Fixes
- [AMD] Added implicit_unsubscribe field to SDMSubscription ([#1884](https://github.com/open5gs/open5gs/pull/1884)) -- [bmeglicit](https://github.com/bmeglicit)
- [SMF] Fixed PTI when PDU Session Reject -- [ddf09f2](https://github.com/open5gs/open5gs/commit/ddf09f270aaaaae67ac9ec1c157b4b28f1c90d10)
- [SBI] Do not send empty arrays in NRF/PCF ([#1876](https://github.com/open5gs/open5gs/pull/1876)) -- [bmeglicit](https://github.com/bmeglicit)
- [SGW-C] Fixed the bug of SGW-C session deletion ([#1825](https://github.com/open5gs/open5gs/pull/1825)) -- [dai9000](https://github.com/dai9000), [cmmacneill53](https://github.com/cmmacneill53)
- [AMF] Reject registration requests when pool for UE context is empty ([#1828](https://github.com/open5gs/open5gs/pull/1828)) -- [bmeglicit](https://github.com/bmeglicit)
- [AMF] Increase size of TMSI pool ([#1827](https://github.com/open5gs/open5gs/pull/1827)) -- [bmeglicit](https://github.com/bmeglicit)
- [AMF/UDM] Added support to subscribe to SDM changes ([#1820](https://github.com/open5gs/open5gs/pull/1820)) -- [bmeglicit](https://github.com/bmeglicit)
- [PFCP] Do not check qos_flow in PFCP Report message ([#1819](https://github.com/open5gs/open5gs/pull/1819)) -- [ssafaorhan](https://github.com/ssafaorhan)
- [PFCP] Fixed invalid message of Dropped DL Traffic threshold ([#1817](https://github.com/open5gs/open5gs/pull/1817)) -- [ssafaorhan](https://github.com/ssafaorhan)
Download -- [v2.5.5.tar.gz](https://github.com/open5gs/open5gs/archive/v2.5.5.tar.gz)
{: .notice--info}

View File

@@ -10,7 +10,7 @@
#
PACKAGE="open5gs"
VERSION="2.4.11"
VERSION="2.5.6"
print_status() {
echo
@@ -93,18 +93,23 @@ preinstall() {
PRE_INSTALL_PKGS=""
if [ ! -x /usr/bin/lsb_release ]; then
PRE_INSTALL_PKGS="${PRE_INSTALL_PKGS} lsb-release"
# Check that HTTPS transport is available to APT
# (Check snaked from: https://get.docker.io/ubuntu/)
if [ ! -e /usr/lib/apt/methods/https ]; then
PRE_INSTALL_PKGS="${PRE_INSTALL_PKGS} apt-transport-https"
fi
if [ ! -x /usr/bin/node ] && [ ! -x /usr/bin/wget ]; then
PRE_INSTALL_PKGS="${PRE_INSTALL_PKGS} nodejs"
if [ ! -x /usr/bin/lsb_release ]; then
PRE_INSTALL_PKGS="${PRE_INSTALL_PKGS} lsb-release"
fi
if [ ! -x /usr/bin/curl ] && [ ! -x /usr/bin/wget ]; then
PRE_INSTALL_PKGS="${PRE_INSTALL_PKGS} curl"
fi
# Used by apt-key to add new keys
if [ ! -x /usr/bin/gpg ]; then
PRE_INSTALL_PKGS="${PRE_INSTALL_PKGS} gnupg"
fi
@@ -114,9 +119,17 @@ exec_cmd 'apt-get update'
if [ "X${PRE_INSTALL_PKGS}" != "X" ]; then
print_status "Installing packages required for setup:${PRE_INSTALL_PKGS}..."
# This next command needs to be redirected to /dev/null or the script will bork
# in some environments
exec_cmd "apt-get install -y${PRE_INSTALL_PKGS} > /dev/null 2>&1"
fi
IS_PRERELEASE=$(lsb_release -d | grep 'Ubuntu .*development' >& /dev/null; echo $?)
if [[ $IS_PRERELEASE -eq 0 ]]; then
print_status "Your distribution, identified as \"$(lsb_release -d -s)\", is a pre-release version of Ubuntu. NodeSource does not maintain official support for Ubuntu versions until they are formally released. You can try using the manual installation instructions available at https://github.com/nodesource/distributions and use the latest supported Ubuntu version name as the distribution identifier, although this is not guaranteed to work."
exit 1
fi
DISTRO=$(lsb_release -c -s)
check_alt() {
@@ -128,54 +141,76 @@ check_alt() {
fi
}
check_alt "SolydXK" "solydxk-9" "Debian" "stretch"
check_alt "Kali" "sana" "Debian" "jessie"
check_alt "Kali" "kali-rolling" "Debian" "jessie"
check_alt "Sparky Linux" "Tyche" "Debian" "stretch"
check_alt "Sparky Linux" "Nibiru" "Debian" "buster"
check_alt "MX Linux 17" "Horizon" "Debian" "stretch"
check_alt "MX Linux 18" "Continuum" "Debian" "stretch"
check_alt "MX Linux 19" "patito feo" "Debian" "buster"
check_alt "Linux Mint" "maya" "Ubuntu" "precise"
check_alt "Linux Mint" "qiana" "Ubuntu" "trusty"
check_alt "Linux Mint" "rafaela" "Ubuntu" "trusty"
check_alt "Linux Mint" "rebecca" "Ubuntu" "trusty"
check_alt "Linux Mint" "rosa" "Ubuntu" "trusty"
check_alt "Linux Mint" "sarah" "Ubuntu" "xenial"
check_alt "Linux Mint" "serena" "Ubuntu" "xenial"
check_alt "Linux Mint" "sonya" "Ubuntu" "xenial"
check_alt "Linux Mint" "sylvia" "Ubuntu" "xenial"
check_alt "Linux Mint" "tara" "Ubuntu" "bionic"
check_alt "Linux Mint" "tessa" "Ubuntu" "bionic"
check_alt "Linux Mint" "tina" "Ubuntu" "bionic"
check_alt "Linux Mint" "tricia" "Ubuntu" "bionic"
check_alt "LMDE" "betsy" "Debian" "jessie"
check_alt "LMDE" "cindy" "Debian" "stretch"
check_alt "elementaryOS" "luna" "Ubuntu" "precise"
check_alt "elementaryOS" "freya" "Ubuntu" "trusty"
check_alt "elementaryOS" "loki" "Ubuntu" "xenial"
check_alt "elementaryOS" "juno" "Ubuntu" "bionic"
check_alt "elementaryOS" "hera" "Ubuntu" "bionic"
check_alt "Trisquel" "toutatis" "Ubuntu" "precise"
check_alt "Trisquel" "belenos" "Ubuntu" "trusty"
check_alt "Trisquel" "flidas" "Ubuntu" "xenial"
check_alt "Uruk GNU/Linux" "lugalbanda" "Ubuntu" "xenial"
check_alt "BOSS" "anokha" "Debian" "wheezy"
check_alt "BOSS" "anoop" "Debian" "jessie"
check_alt "BOSS" "drishti" "Debian" "stretch"
check_alt "bunsenlabs" "bunsen-hydrogen" "Debian" "jessie"
check_alt "bunsenlabs" "helium" "Debian" "stretch"
check_alt "Tanglu" "chromodoris" "Debian" "jessie"
check_alt "PureOS" "green" "Debian" "sid"
check_alt "Devuan" "jessie" "Debian" "jessie"
check_alt "Devuan" "ascii" "Debian" "stretch"
check_alt "Devuan" "beowulf" "Debian" "buster"
check_alt "Devuan" "ceres" "Debian" "sid"
check_alt "Deepin" "panda" "Debian" "sid"
check_alt "Deepin" "unstable" "Debian" "sid"
check_alt "Deepin" "stable" "Debian" "buster"
check_alt "Pardus" "onyedi" "Debian" "stretch"
check_alt "Liquid Lemur" "lemur-3" "Debian" "stretch"
check_alt "Astra Linux" "orel" "Debian" "stretch"
check_alt "BOSS" "anokha" "Debian" "wheezy"
check_alt "BOSS" "anoop" "Debian" "jessie"
check_alt "BOSS" "drishti" "Debian" "stretch"
check_alt "BOSS" "unnati" "Debian" "buster"
check_alt "BOSS" "urja" "Debian" "bullseye"
check_alt "bunsenlabs" "bunsen-hydrogen" "Debian" "jessie"
check_alt "bunsenlabs" "helium" "Debian" "stretch"
check_alt "bunsenlabs" "lithium" "Debian" "buster"
check_alt "Devuan" "jessie" "Debian" "jessie"
check_alt "Devuan" "ascii" "Debian" "stretch"
check_alt "Devuan" "beowulf" "Debian" "buster"
check_alt "Devuan" "chimaera" "Debian" "bullseye"
check_alt "Devuan" "ceres" "Debian" "sid"
check_alt "Deepin" "panda" "Debian" "sid"
check_alt "Deepin" "unstable" "Debian" "sid"
check_alt "Deepin" "stable" "Debian" "buster"
check_alt "Deepin" "apricot" "Debian" "buster"
check_alt "elementaryOS" "luna" "Ubuntu" "precise"
check_alt "elementaryOS" "freya" "Ubuntu" "trusty"
check_alt "elementaryOS" "loki" "Ubuntu" "xenial"
check_alt "elementaryOS" "juno" "Ubuntu" "bionic"
check_alt "elementaryOS" "hera" "Ubuntu" "bionic"
check_alt "elementaryOS" "odin" "Ubuntu" "focal"
check_alt "elementaryOS" "jolnir" "Ubuntu" "focal"
check_alt "Kali" "sana" "Debian" "jessie"
check_alt "Kali" "kali-rolling" "Debian" "bullseye"
check_alt "Linux Mint" "maya" "Ubuntu" "precise"
check_alt "Linux Mint" "qiana" "Ubuntu" "trusty"
check_alt "Linux Mint" "rafaela" "Ubuntu" "trusty"
check_alt "Linux Mint" "rebecca" "Ubuntu" "trusty"
check_alt "Linux Mint" "rosa" "Ubuntu" "trusty"
check_alt "Linux Mint" "sarah" "Ubuntu" "xenial"
check_alt "Linux Mint" "serena" "Ubuntu" "xenial"
check_alt "Linux Mint" "sonya" "Ubuntu" "xenial"
check_alt "Linux Mint" "sylvia" "Ubuntu" "xenial"
check_alt "Linux Mint" "tara" "Ubuntu" "bionic"
check_alt "Linux Mint" "tessa" "Ubuntu" "bionic"
check_alt "Linux Mint" "tina" "Ubuntu" "bionic"
check_alt "Linux Mint" "tricia" "Ubuntu" "bionic"
check_alt "Linux Mint" "ulyana" "Ubuntu" "focal"
check_alt "Linux Mint" "ulyssa" "Ubuntu" "focal"
check_alt "Linux Mint" "uma" "Ubuntu" "focal"
check_alt "Linux Mint" "una" "Ubuntu" "focal"
check_alt "Linux Mint" "vanessa" "Ubuntu" "jammy"
check_alt "Liquid Lemur" "lemur-3" "Debian" "stretch"
check_alt "LMDE" "betsy" "Debian" "jessie"
check_alt "LMDE" "cindy" "Debian" "stretch"
check_alt "LMDE" "debbie" "Debian" "buster"
check_alt "LMDE" "elsie" "Debian" "bullseye"
check_alt "MX Linux 17" "Horizon" "Debian" "stretch"
check_alt "MX Linux 18" "Continuum" "Debian" "stretch"
check_alt "MX Linux 19" "patito feo" "Debian" "buster"
check_alt "MX Linux 21" "wildflower" "Debian" "bullseye"
check_alt "Pardus" "onyedi" "Debian" "stretch"
check_alt "Parrot" "ara" "Debian" "bullseye"
check_alt "PureOS" "green" "Debian" "sid"
check_alt "PureOS" "amber" "Debian" "buster"
check_alt "PureOS" "byzantium" "Debian" "bullseye"
check_alt "SolydXK" "solydxk-9" "Debian" "stretch"
check_alt "Sparky Linux" "Tyche" "Debian" "stretch"
check_alt "Sparky Linux" "Nibiru" "Debian" "buster"
check_alt "Sparky Linux" "Po-Tolo" "Debian" "bullseye"
check_alt "Tanglu" "chromodoris" "Debian" "jessie"
check_alt "Trisquel" "toutatis" "Ubuntu" "precise"
check_alt "Trisquel" "belenos" "Ubuntu" "trusty"
check_alt "Trisquel" "flidas" "Ubuntu" "xenial"
check_alt "Trisquel" "etiona" "Ubuntu" "bionic"
check_alt "Ubilinux" "dolcetto" "Debian" "stretch"
check_alt "Uruk GNU/Linux" "lugalbanda" "Ubuntu" "xenial"
if [ "X${DISTRO}" == "Xdebian" ]; then
print_status "Unknown Debian-based distribution, checking /etc/debian_version..."
@@ -188,31 +223,25 @@ if [ "X${DISTRO}" == "Xdebian" ]; then
fi
fi
if [ "X${DISTRO}" == "Xbuster" ]; then
if [ -f "/etc/apt/sources.list.d/mongodb-org.list" ]; then
print_status 'Removing Launchpad PPA Repository for MongoDB...'
exec_cmd "rm -f /etc/apt/sources.list.d/mongodb-org.list"
fi
print_status 'Removing Launchpad PPA Repository for MongoDB...'
for i in /etc/apt/sources.list.d/mongodb-org*; do
exec_cmd "rm -f $i"
done
print_status 'Adding the MongoDB signing key to your keyring...'
print_status 'Adding the MongoDB signing key to your keyring...'
if [ -x /usr/bin/curl ]; then
exec_cmd 'curl -s https://www.mongodb.org/static/pgp/server-4.2.asc | apt-key add -'
else
exec_cmd 'wget -qO- https://www.mongodb.org/static/pgp/server-4.2.asc | apt-key add -'
fi
print_status "Creating apt sources list file for the MongoDB repo..."
exec_cmd "echo 'deb http://repo.mongodb.org/apt/debian buster/mongodb-org/4.2 main' > /etc/apt/sources.list.d/mongodb-org.list"
if [ ! -x /usr/bin/mongod ]; then
MONGODB_INSTALL_PKGS="${MONGODB_INSTALL_PKGS} mongodb-org"
fi
if [ -x /usr/bin/curl ]; then
exec_cmd_nobail "curl -sLf 'https://www.mongodb.org/static/pgp/server-6.0.asc' | apt-key add -"
else
if [ ! -x /usr/bin/mongod ]; then
MONGODB_INSTALL_PKGS="${MONGODB_INSTALL_PKGS} mongodb"
fi
exec_cmd_nobail "wget -qO - 'https://www.mongodb.org/static/pgp/server-6.0.asc' | apt-key add -"
fi
print_status "Creating apt sources list file for the MongoDB repo..."
exec_cmd "echo 'deb [ arch=amd64,arm64 ] https://repo.mongodb.org/apt/ubuntu focal/mongodb-org/6.0 multiverse' > /etc/apt/sources.list.d/mongodb-org-6.0.list"
if [ ! -x /usr/bin/mongod ]; then
MONGODB_INSTALL_PKGS="${MONGODB_INSTALL_PKGS} mongodb-org"
fi
if [ "X${MONGODB_INSTALL_PKGS}" != "X" ]; then
@@ -230,7 +259,7 @@ if [ -x /usr/bin/curl ]; then
exec_cmd "curl -sLf 'https://github.com/open5gs/${PACKAGE}/archive/v${VERSION}.tar.gz' | tar zxf -"
RC=$?
else
exec_cmd "wget -qO- /dev/null 'https://github.com/open5gs/${PACKAGE}/archive/v${VERSION}.tar.gz' | tar zxf -"
exec_cmd "wget -qO - 'https://github.com/open5gs/${PACKAGE}/archive/v${VERSION}.tar.gz' | tar zxf -"
RC=$?
fi
@@ -240,7 +269,7 @@ if [[ $RC != 0 ]]; then
fi
print_status "Build the Open5GS WebUI..."
exec_cmd "cd ./${PACKAGE}-${VERSION}/webui && npm ci --no-optional && npm run build"
exec_cmd "cd ./${PACKAGE}-${VERSION}/webui && npm clean-install && npm run build"
print_status "Install the Open5GS WebUI..."
exec_cmd "mv ./${PACKAGE}-${VERSION}/webui /usr/lib/node_modules/${PACKAGE}"
@@ -267,23 +296,14 @@ EOF"
exec_cmd_nobail "systemctl daemon-reload"
exec_cmd "systemctl enable open5gs-webui"
exec_cmd "deb-systemd-invoke start open5gs-webui"
exec_cmd "rm -rf ./${PACKAGE}-${VERSION}"
}
postinstall() {
print_status "Default Administrator Account [Username:admin, Password:1423]..."
exec_cmd "mongosh open5gs ./${PACKAGE}-${VERSION}/docs/assets/webui/mongo-init.js"
exec_cmd "cat << EOF > ./account.js
db = db.getSiblingDB('open5gs')
cursor = db.accounts.find()
if ( cursor.count() == 0 ) {
db.accounts.insert({ salt: 'f5c15fa72622d62b6b790aa8569b9339729801ab8bda5d13997b5db6bfc1d997', hash: '402223057db5194899d2e082aeb0802f6794622e1cbc47529c419e5a603f2cc592074b4f3323b239ffa594c8b756d5c70a4e1f6ecd3f9f0d2d7328c4cf8b1b766514effff0350a90b89e21eac54cd4497a169c0c7554a0e2cd9b672e5414c323f76b8559bc768cba11cad2ea3ae704fb36abc8abc2619231ff84ded60063c6e1554a9777a4a464ef9cfdfa90ecfdacc9844e0e3b2f91b59d9ff024aec4ea1f51b703a31cda9afb1cc2c719a09cee4f9852ba3cf9f07159b1ccf8133924f74df770b1a391c19e8d67ffdcbbef4084a3277e93f55ac60d80338172b2a7b3f29cfe8a36738681794f7ccbe9bc98f8cdeded02f8a4cd0d4b54e1d6ba3d11792ee0ae8801213691848e9c5338e39485816bb0f734b775ac89f454ef90992003511aa8cceed58a3ac2c3814f14afaaed39cbaf4e2719d7213f81665564eec02f60ede838212555873ef742f6666cc66883dcb8281715d5c762fb236d72b770257e7e8d86c122bb69028a34cf1ed93bb973b440fa89a23604cd3fefe85fbd7f55c9b71acf6ad167228c79513f5cfe899a2e2cc498feb6d2d2f07354a17ba74cecfbda3e87d57b147e17dcc7f4c52b802a8e77f28d255a6712dcdc1519e6ac9ec593270bfcf4c395e2531a271a841b1adefb8516a07136b0de47c7fd534601b16f0f7a98f1dbd31795feb97da59e1d23c08461cf37d6f2877d0f2e437f07e25015960f63', username: 'admin', roles: [ 'admin' ], "__v" : 0})
}
EOF"
exec_cmd "mongo open5gs ./account.js"
exec_cmd "rm -f ./account.js"
exec_cmd "rm -rf ./${PACKAGE}-${VERSION}"
}
## Defer setup until we have the complete script

View File

@@ -0,0 +1,5 @@
db = db.getSiblingDB('open5gs')
cursor = db.accounts.find()
if ( cursor.count() == 0 ) {
db.accounts.insertOne({ salt: 'f5c15fa72622d62b6b790aa8569b9339729801ab8bda5d13997b5db6bfc1d997', hash: '402223057db5194899d2e082aeb0802f6794622e1cbc47529c419e5a603f2cc592074b4f3323b239ffa594c8b756d5c70a4e1f6ecd3f9f0d2d7328c4cf8b1b766514effff0350a90b89e21eac54cd4497a169c0c7554a0e2cd9b672e5414c323f76b8559bc768cba11cad2ea3ae704fb36abc8abc2619231ff84ded60063c6e1554a9777a4a464ef9cfdfa90ecfdacc9844e0e3b2f91b59d9ff024aec4ea1f51b703a31cda9afb1cc2c719a09cee4f9852ba3cf9f07159b1ccf8133924f74df770b1a391c19e8d67ffdcbbef4084a3277e93f55ac60d80338172b2a7b3f29cfe8a36738681794f7ccbe9bc98f8cdeded02f8a4cd0d4b54e1d6ba3d11792ee0ae8801213691848e9c5338e39485816bb0f734b775ac89f454ef90992003511aa8cceed58a3ac2c3814f14afaaed39cbaf4e2719d7213f81665564eec02f60ede838212555873ef742f6666cc66883dcb8281715d5c762fb236d72b770257e7e8d86c122bb69028a34cf1ed93bb973b440fa89a23604cd3fefe85fbd7f55c9b71acf6ad167228c79513f5cfe899a2e2cc498feb6d2d2f07354a17ba74cecfbda3e87d57b147e17dcc7f4c52b802a8e77f28d255a6712dcdc1519e6ac9ec593270bfcf4c395e2531a271a841b1adefb8516a07136b0de47c7fd534601b16f0f7a98f1dbd31795feb97da59e1d23c08461cf37d6f2877d0f2e437f07e25015960f63', username: 'admin', roles: [ 'admin' ], "__v" : 0})
}

View File

@@ -352,8 +352,12 @@ int ogs_app_context_parse_config(void)
ogs_yaml_iter_bool(&parameter_iter);
} else if (!strcmp(parameter_key,
"use_mongodb_change_stream")) {
#if MONGOC_MAJOR_VERSION >= 1 && MONGOC_MINOR_VERSION >= 9
self.use_mongodb_change_stream =
ogs_yaml_iter_bool(&parameter_iter);
#else
self.use_mongodb_change_stream = false;
#endif
} else
ogs_warn("unknown key `%s`", parameter_key);
}

View File

@@ -182,15 +182,18 @@ void ogs_dbi_final()
mongoc_collection_destroy(self.collection.subscriber);
}
#if MONGOC_MAJOR_VERSION >= 1 && MONGOC_MINOR_VERSION >= 9
if (self.stream) {
mongoc_change_stream_destroy(self.stream);
}
#endif
ogs_mongoc_final();
}
int ogs_dbi_collection_watch_init(void)
{
#if MONGOC_MAJOR_VERSION >= 1 && MONGOC_MINOR_VERSION >= 9
bson_t empty = BSON_INITIALIZER;
const bson_t *err_doc;
bson_error_t error;
@@ -213,10 +216,14 @@ int ogs_dbi_collection_watch_init(void)
}
return OGS_OK;
# else
return OGS_ERROR;
#endif
}
int ogs_dbi_poll_change_stream(void)
{
#if MONGOC_MAJOR_VERSION >= 1 && MONGOC_MINOR_VERSION >= 9
int rv;
const bson_t *document;
@@ -240,4 +247,7 @@ int ogs_dbi_poll_change_stream(void)
}
return OGS_OK;
# else
return OGS_ERROR;
#endif
}

View File

@@ -37,7 +37,9 @@ typedef struct ogs_mongoc_s {
void *client;
void *database;
#if MONGOC_MAJOR_VERSION >= 1 && MONGOC_MINOR_VERSION >= 9
mongoc_change_stream_t *stream;
#endif
char *masked_db_uri;

View File

@@ -31,7 +31,7 @@ int ogs_dbi_process_change_stream(const bson_t *document)
rv = ogs_queue_push(ogs_app()->queue, e);
if (rv != OGS_OK) {
ogs_error("ogs_queue_push() failed:%d", (int)rv);
bson_destroy((bson_t*)e->dbi.document);
bson_destroy(e->dbi.document);
ogs_event_free(e);
} else {
ogs_pollset_notify(ogs_app()->pollset);

View File

@@ -77,6 +77,19 @@ extern "C" {
#define OGS_DIAM_S6A_CT_UPDATE_PROCEDURE_IWF (3)
#define OGS_DIAM_S6A_CT_INITIAL_ATTACH_PROCEDURE (4)
#define OGS_DIAM_S6A_SUBDATA_NO_UPDATE (0)
#define OGS_DIAM_S6A_SUBDATA_SUB_STATUS (1)
#define OGS_DIAM_S6A_SUBDATA_MSISDN (1 << 1)
#define OGS_DIAM_S6A_SUBDATA_A_MSISDN (1 << 2)
#define OGS_DIAM_S6A_SUBDATA_NAM (1 << 3)
#define OGS_DIAM_S6A_SUBDATA_ODB (1 << 4)
#define OGS_DIAM_S6A_SUBDATA_ARD (1 << 5)
#define OGS_DIAM_S6A_SUBDATA_CC (1 << 6)
#define OGS_DIAM_S6A_SUBDATA_UEAMBR (1 << 7)
#define OGS_DIAM_S6A_SUBDATA_APN_CONFIG (1 << 8)
#define OGS_DIAM_S6A_SUBDATA_RAU_TAU_TIMER (1 << 9)
#define OGS_DIAM_S6A_SUBDATA_ALL 0xFFFFFFFF
extern struct dict_object *ogs_diam_s6a_application;
extern struct dict_object *ogs_diam_s6a_cmd_air;
@@ -166,6 +179,7 @@ typedef struct ogs_diam_s6a_clr_message_s {
#define OGS_DIAM_S6A_CLR_FLAGS_S6A_S6D_INDICATOR (1)
#define OGS_DIAM_S6A_CLR_FLAGS_REATTACH_REQUIRED (1 << 1)
uint32_t clr_flags;
uint32_t cancellation_type;
} ogs_diam_s6a_clr_message_t;
typedef struct ogs_diam_s6a_idr_message_s {
@@ -179,6 +193,7 @@ typedef struct ogs_diam_s6a_idr_message_s {
#define OGS_DIAM_S6A_IDR_FLAGS_RAT_TYPE (1 << 7)
#define OGS_DIAM_S6A_IDR_FLAGS_PCSCF_Restoration (1 << 8)
uint32_t idr_flags;
uint32_t subdatamask;
ogs_subscription_data_t subscription_data;
} ogs_diam_s6a_idr_message_t;

View File

@@ -96,15 +96,16 @@ typedef struct ogs_gtp_xact_s {
#define OGS_GTP_MODIFY_QOS_UPDATE ((uint64_t)1<<1)
uint64_t update_flags;
#define OGS_GTP_DELETE_NO_ACTION 1
#define OGS_GTP_DELETE_SEND_AUTHENTICATION_REQUEST 2
#define OGS_GTP_DELETE_SEND_DETACH_ACCEPT 3
#define OGS_GTP_DELETE_SEND_DEACTIVATE_BEARER_CONTEXT_REQUEST 4
#define OGS_GTP_DELETE_SEND_UE_CONTEXT_RELEASE_COMMAND 5
#define OGS_GTP_DELETE_SEND_S1_REMOVE_AND_UNLINK 6
#define OGS_GTP_DELETE_HANDLE_PDN_CONNECTIVITY_REQUEST 7
#define OGS_GTP_DELETE_UE_CONTEXT_REMOVE 8
#define OGS_GTP_DELETE_IN_PATH_SWITCH_REQUEST 9
#define OGS_GTP_DELETE_NO_ACTION 1
#define OGS_GTP_DELETE_SEND_AUTHENTICATION_REQUEST 2
#define OGS_GTP_DELETE_SEND_DETACH_ACCEPT 3
#define OGS_GTP_DELETE_SEND_DEACTIVATE_BEARER_CONTEXT_REQUEST 4
#define OGS_GTP_DELETE_SEND_RELEASE_WITH_UE_CONTEXT_REMOVE 5
#define OGS_GTP_DELETE_SEND_RELEASE_WITH_S1_REMOVE_AND_UNLINK 6
#define OGS_GTP_DELETE_HANDLE_PDN_CONNECTIVITY_REQUEST 7
#define OGS_GTP_DELETE_UE_CONTEXT_REMOVE_PARTIAL 8
#define OGS_GTP_DELETE_IN_PATH_SWITCH_REQUEST 9
int delete_action;
#define OGS_GTP_RELEASE_SEND_UE_CONTEXT_RELEASE_COMMAND 1

View File

@@ -1191,8 +1191,8 @@ typedef struct ogs_pfcp_dropped_dl_traffic_threshold_s {
union {
struct {
ED3(uint8_t spare:6;,
uint8_t dlpa:1;,
uint8_t dlby:1;)
uint8_t dlby:1;,
uint8_t dlpa:1;)
};
uint8_t flags;
};

View File

@@ -37,7 +37,7 @@ void *ogs_event_size(int id, size_t size)
ogs_event_t *ogs_event_new(int id)
{
return ogs_event_size(id, sizeof(ogs_event_t));
return ogs_event_size(id, OGS_EVENT_SIZE);
}
void ogs_event_free(void *e)

View File

@@ -50,8 +50,6 @@ 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 _bson_t bson_t;
typedef struct ogs_event_s {
int id;
int timer_id;
@@ -66,10 +64,12 @@ typedef struct ogs_event_s {
} sbi;
struct {
const bson_t *document;
void *document;
} dbi;
} ogs_event_t;
#define OGS_EVENT_SIZE 256
void *ogs_event_size(int id, size_t size);
ogs_event_t *ogs_event_new(int id);
void ogs_event_free(void *e);

View File

@@ -652,6 +652,10 @@ typedef struct ogs_slice_data_s {
uint32_t context_identifier; /* EPC for checking default APN */
#define OGS_ALL_APN_CONFIGURATIONS_INCLUDED 0
#define OGS_MODIFIED_ADDED_APN_CONFIGURATIONS_INCLUDED 1
uint32_t all_apn_config_inc;
int num_of_session;
ogs_session_t session[OGS_MAX_NUM_OF_SESS];
} ogs_slice_data_t;

View File

@@ -1,5 +1,5 @@
/*
* Copyright (C) 2019 by Sukchan Lee <acetcom@gmail.com>
* Copyright (C) 2019-2022 by Sukchan Lee <acetcom@gmail.com>
*
* This file is part of Open5GS.
*
@@ -47,6 +47,7 @@ typedef struct connection_s {
bool memory_overflow;
char *location;
char *producer_id;
ogs_timer_t *timer;
CURL *easy;
@@ -66,8 +67,14 @@ static size_t header_cb(void *ptr, 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 connection_t *connection_add(
ogs_sbi_client_t *client, ogs_sbi_client_cb_f client_cb,
ogs_sbi_request_t *request, void *data);
static void connection_remove(connection_t *conn);
static void connection_free(connection_t *conn);
static void connection_remove_all(ogs_sbi_client_t *client);
static void connection_timer_expired(void *data);
void ogs_sbi_client_init(int num_of_sockinfo_pool, int num_of_connection_pool)
{
@@ -280,8 +287,6 @@ static char *add_params_to_uri(CURL *easy, char *uri, ogs_hash_t *params)
return uri;
}
static void _connection_remove(connection_t *conn);
static connection_t *connection_add(
ogs_sbi_client_t *client, ogs_sbi_client_cb_f client_cb,
ogs_sbi_request_t *request, void *data)
@@ -307,7 +312,7 @@ static connection_t *connection_add(
conn->method = ogs_strdup(request->h.method);
if (!conn->method) {
ogs_error("conn->method is NULL");
_connection_remove(conn);
connection_free(conn);
return NULL;
}
@@ -316,7 +321,7 @@ static connection_t *connection_add(
conn->headers = ogs_calloc(conn->num_of_header, sizeof(char *));
if (!conn->headers) {
ogs_error("conn->headers is NULL");
_connection_remove(conn);
connection_free(conn);
return NULL;
}
for (hi = ogs_hash_first(request->http.headers), i = 0;
@@ -327,7 +332,7 @@ static connection_t *connection_add(
conn->headers[i] = ogs_msprintf("%s: %s", key, val);
if (!conn->headers[i]) {
ogs_error("conn->headers[i=%d] is NULL", i);
_connection_remove(conn);
connection_free(conn);
return NULL;
}
conn->header_list = curl_slist_append(
@@ -339,7 +344,7 @@ static connection_t *connection_add(
ogs_app()->timer_mgr, connection_timer_expired, conn);
if (!conn->timer) {
ogs_error("conn->timer is NULL");
_connection_remove(conn);
connection_free(conn);
return NULL;
}
@@ -351,7 +356,7 @@ static connection_t *connection_add(
conn->easy = curl_easy_init();
if (!conn->easy) {
ogs_error("conn->easy is NULL");
_connection_remove(conn);
connection_free(conn);
return NULL;
}
@@ -360,7 +365,7 @@ static connection_t *connection_add(
request->h.uri, request->http.params);
if (!uri) {
ogs_error("add_params_to_uri() failed");
_connection_remove(conn);
connection_free(conn);
return NULL;
}
@@ -380,7 +385,7 @@ static connection_t *connection_add(
request->http.content, request->http.content_length);
if (!conn->content) {
ogs_error("conn->content is NULL");
_connection_remove(conn);
connection_free(conn);
return NULL;
}
curl_easy_setopt(conn->easy,
@@ -424,7 +429,23 @@ static connection_t *connection_add(
return conn;
}
static void _connection_remove(connection_t *conn)
static void connection_remove(connection_t *conn)
{
ogs_sbi_client_t *client = NULL;
ogs_assert(conn);
client = conn->client;
ogs_assert(client);
ogs_list_remove(&client->connection_list, conn);
ogs_assert(client->multi);
curl_multi_remove_handle(client->multi, conn->easy);
connection_free(conn);
}
static void connection_free(connection_t *conn)
{
int i;
@@ -435,6 +456,8 @@ static void _connection_remove(connection_t *conn)
if (conn->location)
ogs_free(conn->location);
if (conn->producer_id)
ogs_free(conn->producer_id);
if (conn->memory)
ogs_free(conn->memory);
@@ -459,22 +482,6 @@ static void _connection_remove(connection_t *conn)
ogs_pool_free(&connection_pool, conn);
}
static void connection_remove(connection_t *conn)
{
ogs_sbi_client_t *client = NULL;
ogs_assert(conn);
client = conn->client;
ogs_assert(client);
ogs_list_remove(&client->connection_list, conn);
ogs_assert(client->multi);
curl_multi_remove_handle(client->multi, conn->easy);
_connection_remove(conn);
}
static void connection_remove_all(ogs_sbi_client_t *client)
{
connection_t *conn = NULL, *next_conn = NULL;
@@ -555,6 +562,9 @@ static void check_multi_info(ogs_sbi_client_t *client)
if (conn->location)
ogs_sbi_header_set(response->http.headers,
OGS_SBI_LOCATION, conn->location);
if (conn->producer_id)
ogs_sbi_header_set(response->http.headers,
OGS_SBI_CUSTOM_PRODUCER_ID, conn->producer_id);
if (conn->memory_overflow == true)
level = OGS_LOG_ERROR;
@@ -585,8 +595,11 @@ static void check_multi_info(ogs_sbi_client_t *client)
ogs_warn("[%d] %s", res, conn->error);
ogs_assert(conn->client_cb);
conn->client_cb(res == CURLE_OK ? OGS_OK : OGS_ERROR,
response, conn->data);
if (res == CURLE_OK)
conn->client_cb(OGS_OK, response, conn->data);
else
conn->client_cb(OGS_ERROR, NULL, conn->data);
connection_remove(conn);
break;
default:
@@ -596,7 +609,7 @@ static void check_multi_info(ogs_sbi_client_t *client)
}
}
bool ogs_sbi_client_send_reqmem_persistent(
bool ogs_sbi_client_send_request(
ogs_sbi_client_t *client, ogs_sbi_client_cb_f client_cb,
ogs_sbi_request_t *request, void *data)
{
@@ -604,10 +617,10 @@ bool ogs_sbi_client_send_reqmem_persistent(
ogs_assert(client);
ogs_assert(request);
if (request->h.uri == NULL) {
request->h.uri = ogs_sbi_client_uri(client, &request->h);
ogs_expect_or_return_val(request->h.uri, false);
ogs_assert(request->h.method);
ogs_assert(request->h.uri);
}
ogs_debug("[%s] %s", request->h.method, request->h.uri);
@@ -617,67 +630,14 @@ bool ogs_sbi_client_send_reqmem_persistent(
return true;
}
bool ogs_sbi_client_send_request(
bool ogs_sbi_client_send_via_scp(
ogs_sbi_client_t *client, ogs_sbi_client_cb_f client_cb,
ogs_sbi_request_t *request, void *data)
{
bool rc;
ogs_assert(client);
ogs_assert(request);
rc = ogs_sbi_client_send_reqmem_persistent(
client, client_cb, request, data);
ogs_expect(rc == true);
ogs_sbi_request_free(request);
return rc;
}
bool ogs_sbi_scp_send_reqmem_persistent(
ogs_sbi_client_t *client, ogs_sbi_client_cb_f client_cb,
ogs_sbi_request_t *request, void *data)
{
ogs_sbi_nf_instance_t *scp_instance = NULL;
connection_t *conn = NULL;
char *apiroot = NULL;
ogs_assert(client);
ogs_assert(request);
scp_instance = ogs_sbi_self()->scp_instance;
if (scp_instance) {
/*
* In case of indirect communication using SCP,
* add 3gpp-Sbi-Target-apiRoot to HTTP header and
* change CLIENT instance to SCP.
*/
apiroot = ogs_sbi_client_apiroot(client);
ogs_assert(apiroot);
ogs_sbi_header_set(request->http.headers,
OGS_SBI_CUSTOM_TARGET_APIROOT, apiroot);
ogs_free(apiroot);
client = scp_instance->client;
ogs_assert(client);
}
if (request->h.uri == NULL) {
/*
* Regardless of direct or indirect communication,
* if there is no URI, we automatically creates a URI
* with Client Address and request->h
*/
request->h.uri = ogs_sbi_client_uri(client, &request->h);
ogs_assert(request->h.uri);
ogs_debug("[%s] %s", request->h.method, request->h.uri);
} else if (scp_instance) {
if (request->h.uri) {
/*
* In case of indirect communication using SCP,
* If the full URI is already defined, change full URI to SCP as below.
@@ -685,6 +645,7 @@ bool ogs_sbi_scp_send_reqmem_persistent(
* OLD: http://127.0.0.5:7777/nnrf-nfm/v1/nf-status-notify
* NEW: https://scp.open5gs.org/nnrf-nfm/v1/nf-status-notify
*/
char *apiroot = NULL;
char *path = NULL;
char *old = NULL;
@@ -697,38 +658,21 @@ bool ogs_sbi_scp_send_reqmem_persistent(
ogs_assert(path);
request->h.uri = ogs_msprintf("%s/%s", apiroot, path);
ogs_assert(request->h.method);
ogs_assert(request->h.uri);
ogs_debug("[%s] %s", request->h.method, request->h.uri);
ogs_free(apiroot);
ogs_free(path);
ogs_free(old);
ogs_debug("[%s] %s", request->h.method, request->h.uri);
}
conn = connection_add(client, client_cb, request, data);
ogs_expect_or_return_val(conn, false);
ogs_expect_or_return_val(true ==
ogs_sbi_client_send_request(client, client_cb, request, data), false);
return true;
}
bool ogs_sbi_scp_send_request(
ogs_sbi_client_t *client, ogs_sbi_client_cb_f client_cb,
ogs_sbi_request_t *request, void *data)
{
bool rc;
ogs_assert(client);
ogs_assert(request);
rc = ogs_sbi_scp_send_reqmem_persistent(client, client_cb, request, data);
ogs_expect(rc == true);
ogs_sbi_request_free(request);
return rc;
}
static size_t write_cb(void *contents, size_t size, size_t nmemb, void *data)
{
size_t realsize = 0;
@@ -766,16 +710,32 @@ static size_t header_cb(void *ptr, size_t size, size_t nmemb, void *data)
ogs_assert(conn);
if (ogs_strncasecmp(ptr, OGS_SBI_LOCATION, strlen(OGS_SBI_LOCATION)) == 0) {
/* ptr : "Location: http://xxx/xxx/xxx\r\n"
We need to truncate "Location" + ": " + "\r\n" in 'ptr' string */
/* ptr : "Location: http://xxx/xxx/xxx\r\n"
We need to truncate "Location" + ": " + "\r\n" in 'ptr' string */
int len = strlen(ptr) - strlen(OGS_SBI_LOCATION) - 2 - 2;
if (len) {
/* Only copy http://xxx/xxx/xxx" from 'ptr' string */
conn->location = ogs_memdup(
(char *)ptr + strlen(OGS_SBI_LOCATION) + 2, len+1);
(char *)ptr + strlen(OGS_SBI_LOCATION) + 2,
len+1);
ogs_assert(conn->location);
conn->location[len] = 0;
}
} else if (ogs_strncasecmp(ptr,
OGS_SBI_CUSTOM_PRODUCER_ID,
strlen(OGS_SBI_CUSTOM_PRODUCER_ID)) == 0) {
/* ptr : "3gpp-Sbi-Producer-Id: 0cb58eca-4e84-41ed-aa10-9f892634b770\r\n"
We need to truncate "3gpp-Sbi-Producer-Id" + ": " + "\r\n"
in 'ptr' string */
int len = strlen(ptr) - strlen(OGS_SBI_CUSTOM_PRODUCER_ID) - 2 - 2;
if (len) {
/* Only copy 0cb58eca-4e84-41ed-aa10-9f892634b770from 'ptr' string */
conn->producer_id = ogs_memdup(
(char *)ptr + strlen(OGS_SBI_CUSTOM_PRODUCER_ID) + 2,
len+1);
ogs_assert(conn->producer_id);
conn->producer_id[len] = 0;
}
}
return (nmemb*size);

View File

@@ -1,5 +1,5 @@
/*
* Copyright (C) 2019 by Sukchan Lee <acetcom@gmail.com>
* Copyright (C) 2019-2022 by Sukchan Lee <acetcom@gmail.com>
*
* This file is part of Open5GS.
*
@@ -62,8 +62,6 @@ typedef struct ogs_sbi_client_s {
const char *pem;
} tls;
ogs_sbi_client_cb_f cb; /* Only used when NF send to NRF */
ogs_timer_t *t_curl; /* timer for CURL */
ogs_list_t connection_list; /* CURL connection list */
@@ -86,17 +84,10 @@ ogs_sbi_client_t *ogs_sbi_client_find(ogs_sockaddr_t *addr);
void ogs_sbi_client_stop(ogs_sbi_client_t *client);
void ogs_sbi_client_stop_all(void);
bool ogs_sbi_client_send_reqmem_persistent(
ogs_sbi_client_t *client, ogs_sbi_client_cb_f client_cb,
ogs_sbi_request_t *request, void *data);
bool ogs_sbi_client_send_request(
ogs_sbi_client_t *client, ogs_sbi_client_cb_f client_cb,
ogs_sbi_request_t *request, void *data);
bool ogs_sbi_scp_send_reqmem_persistent(
ogs_sbi_client_t *client, ogs_sbi_client_cb_f client_cb,
ogs_sbi_request_t *request, void *data);
bool ogs_sbi_scp_send_request(
bool ogs_sbi_client_send_via_scp(
ogs_sbi_client_t *client, ogs_sbi_client_cb_f client_cb,
ogs_sbi_request_t *request, void *data);

View File

@@ -1,5 +1,5 @@
/*
* Copyright (C) 2019 by Sukchan Lee <acetcom@gmail.com>
* Copyright (C) 2019-2022 by Sukchan Lee <acetcom@gmail.com>
*
* This file is part of Open5GS.
*
@@ -26,6 +26,7 @@ static int context_initialized = 0;
static OGS_POOL(nf_instance_pool, ogs_sbi_nf_instance_t);
static OGS_POOL(nf_service_pool, ogs_sbi_nf_service_t);
static OGS_POOL(xact_pool, ogs_sbi_xact_t);
static OGS_POOL(subscription_spec_pool, ogs_sbi_subscription_spec_t);
static OGS_POOL(subscription_data_pool, ogs_sbi_subscription_data_t);
static OGS_POOL(smf_info_pool, ogs_sbi_smf_info_t);
static OGS_POOL(nf_info_pool, ogs_sbi_nf_info_t);
@@ -51,6 +52,9 @@ void ogs_sbi_context_init(void)
ogs_pool_init(&xact_pool, ogs_app()->pool.xact);
ogs_list_init(&self.subscription_spec_list);
ogs_pool_init(&subscription_spec_pool, ogs_app()->pool.subscription);
ogs_list_init(&self.subscription_data_list);
ogs_pool_init(&subscription_data_pool, ogs_app()->pool.subscription);
@@ -58,15 +62,24 @@ void ogs_sbi_context_init(void)
ogs_pool_init(&nf_info_pool, ogs_app()->pool.nf * OGS_MAX_NUM_OF_NF_INFO);
/* Add SELF NF instance */
/* Add AELF NF-Instance */
self.nf_instance = ogs_sbi_nf_instance_add();
ogs_assert(self.nf_instance);
ogs_uuid_get(&self.uuid);
ogs_uuid_format(nf_instance_id, &self.uuid);
ogs_sbi_nf_instance_set_id(self.nf_instance, nf_instance_id);
/* Add NRF NF-Instance */
self.nrf_instance = ogs_sbi_nf_instance_add();
ogs_assert(self.nrf_instance);
ogs_sbi_nf_instance_set_type(self.nrf_instance, OpenAPI_nf_type_NRF);
/* Add SCP NF-Instance */
self.scp_instance = ogs_sbi_nf_instance_add();
ogs_assert(self.scp_instance);
ogs_sbi_nf_instance_set_type(self.scp_instance, OpenAPI_nf_type_SCP);
context_initialized = 1;
}
@@ -77,6 +90,9 @@ void ogs_sbi_context_final(void)
ogs_sbi_subscription_data_remove_all();
ogs_pool_final(&subscription_data_pool);
ogs_sbi_subscription_spec_remove_all();
ogs_pool_final(&subscription_spec_pool);
ogs_pool_final(&xact_pool);
ogs_sbi_nf_instance_remove_all();
@@ -123,24 +139,31 @@ static int ogs_sbi_context_validation(
ogs_assert(context_initialized == 1);
switch (self.discovery_config.delegated) {
case OGS_SBI_DISCOVERY_DELEGATED_AUTO:
if (strcmp(local, "nrf") != 0 && /* Skip NRF */
strcmp(local, "smf") != 0 && /* Skip SMF since SMF can run 4G */
ogs_sbi_self()->nrf_instance == NULL &&
ogs_sbi_self()->scp_instance == NULL) {
ogs_error("DELEGATED_AUTO - Both NRF and %s are unavailable",
strcmp(scp, "next_scp") == 0 ? "Next-hop SCP" : "SCP");
return OGS_ERROR;
if (strcmp(local, "nrf") == 0) {
/* Skip NRF */
} else if (strcmp(local, "scp") == 0) {
/* Skip SCP */
} else if (strcmp(local, "smf") == 0) {
/* Skip SMF since SMF can run 4G */
} else {
if (NF_INSTANCE_CLIENT(self.nrf_instance) ||
NF_INSTANCE_CLIENT(self.scp_instance)) {
} else {
ogs_error("DELEGATED_AUTO - Both NRF and %s are unavailable",
strcmp(scp, "next_scp") == 0 ? "Next-hop SCP" : "SCP");
return OGS_ERROR;
}
}
break;
case OGS_SBI_DISCOVERY_DELEGATED_YES:
if (ogs_sbi_self()->scp_instance == NULL) {
if (NF_INSTANCE_CLIENT(self.scp_instance) == NULL) {
ogs_error("DELEGATED_YES - no %s available",
strcmp(scp, "next_scp") == 0 ? "Next-hop SCP" : "SCP");
return OGS_ERROR;
}
break;
case OGS_SBI_DISCOVERY_DELEGATED_NO:
if (ogs_sbi_self()->nrf_instance == NULL) {
if (NF_INSTANCE_CLIENT(self.nrf_instance) == NULL) {
ogs_error("DELEGATED_NO - no NRF available");
return OGS_ERROR;
}
@@ -154,11 +177,6 @@ static int ogs_sbi_context_validation(
return OGS_OK;
}
ogs_sbi_nf_instance_t *ogs_sbi_scp_instance(void)
{
return NULL;
}
int ogs_sbi_context_parse_config(
const char *local, const char *nrf, const char *scp)
{
@@ -478,7 +496,6 @@ int ogs_sbi_context_parse_config(
ogs_yaml_iter_t sbi_array, sbi_iter;
ogs_yaml_iter_recurse(&nrf_iter, &sbi_array);
do {
ogs_sbi_nf_instance_t *nrf_instance = NULL;
ogs_sbi_client_t *client = NULL;
ogs_sockaddr_t *addr = NULL;
int family = AF_UNSPEC;
@@ -580,14 +597,7 @@ int ogs_sbi_context_parse_config(
client = ogs_sbi_client_add(addr);
ogs_assert(client);
ogs_sbi_self()->nrf_instance =
nrf_instance = ogs_sbi_nf_instance_add();
ogs_assert(nrf_instance);
ogs_sbi_nf_instance_set_type(
nrf_instance, OpenAPI_nf_type_NRF);
OGS_SBI_SETUP_CLIENT(nrf_instance, client);
OGS_SBI_SETUP_CLIENT(self.nrf_instance, client);
if (key) client->tls.key = key;
if (pem) client->tls.pem = pem;
@@ -598,7 +608,8 @@ int ogs_sbi_context_parse_config(
YAML_SEQUENCE_NODE);
}
}
} else if (scp && !strcmp(root_key, scp)) {
} else if (ogs_app()->parameter.no_scp == false &&
scp && !strcmp(root_key, scp)) {
ogs_yaml_iter_t scp_iter;
ogs_yaml_iter_recurse(&root_iter, &scp_iter);
while (ogs_yaml_iter_next(&scp_iter)) {
@@ -608,7 +619,6 @@ int ogs_sbi_context_parse_config(
ogs_yaml_iter_t sbi_array, sbi_iter;
ogs_yaml_iter_recurse(&scp_iter, &sbi_array);
do {
ogs_sbi_nf_instance_t *scp_instance = NULL;
ogs_sbi_client_t *client = NULL;
ogs_sockaddr_t *addr = NULL;
int family = AF_UNSPEC;
@@ -710,14 +720,7 @@ int ogs_sbi_context_parse_config(
client = ogs_sbi_client_add(addr);
ogs_assert(client);
ogs_sbi_self()->scp_instance =
scp_instance = ogs_sbi_nf_instance_add();
ogs_assert(scp_instance);
ogs_sbi_nf_instance_set_type(
scp_instance, OpenAPI_nf_type_SCP);
OGS_SBI_SETUP_CLIENT(scp_instance, client);
OGS_SBI_SETUP_CLIENT(self.scp_instance, client);
if (key) client->tls.key = key;
if (pem) client->tls.pem = pem;
@@ -922,15 +925,18 @@ ogs_sbi_nf_instance_t *ogs_sbi_nf_instance_find(char *id)
ogs_sbi_nf_instance_t *ogs_sbi_nf_instance_find_by_discovery_param(
OpenAPI_nf_type_e target_nf_type,
OpenAPI_nf_type_e requester_nf_type,
ogs_sbi_discovery_option_t *discovery_option)
{
ogs_sbi_nf_instance_t *nf_instance = NULL;
ogs_assert(target_nf_type);
ogs_assert(requester_nf_type);
ogs_list_for_each(&ogs_sbi_self()->nf_instance_list, nf_instance) {
if (ogs_sbi_discovery_param_is_matched(
nf_instance, target_nf_type, discovery_option) == false)
nf_instance, target_nf_type, requester_nf_type,
discovery_option) == false)
continue;
return nf_instance;
@@ -940,7 +946,8 @@ ogs_sbi_nf_instance_t *ogs_sbi_nf_instance_find_by_discovery_param(
}
ogs_sbi_nf_instance_t *ogs_sbi_nf_instance_find_by_service_type(
ogs_sbi_service_type_e service_type)
ogs_sbi_service_type_e service_type,
OpenAPI_nf_type_e requester_nf_type)
{
ogs_sbi_nf_instance_t *nf_instance = NULL;
ogs_sbi_discovery_option_t *discovery_option = NULL;
@@ -948,6 +955,7 @@ ogs_sbi_nf_instance_t *ogs_sbi_nf_instance_find_by_service_type(
OpenAPI_nf_type_e target_nf_type = OpenAPI_nf_type_NULL;
char *service_name = NULL;
ogs_assert(requester_nf_type);
ogs_assert(service_type);
target_nf_type = ogs_sbi_service_type_to_nf_type(service_type);
ogs_assert(target_nf_type);
@@ -959,7 +967,7 @@ ogs_sbi_nf_instance_t *ogs_sbi_nf_instance_find_by_service_type(
ogs_sbi_discovery_option_add_service_names(discovery_option, service_name);
nf_instance = ogs_sbi_nf_instance_find_by_discovery_param(
target_nf_type, discovery_option);
target_nf_type, requester_nf_type, discovery_option);
ogs_sbi_discovery_option_free(discovery_option);
@@ -1536,14 +1544,11 @@ bool ogs_sbi_discovery_option_is_matched(
bool ogs_sbi_discovery_param_is_matched(
ogs_sbi_nf_instance_t *nf_instance,
OpenAPI_nf_type_e target_nf_type,
OpenAPI_nf_type_e requester_nf_type,
ogs_sbi_discovery_option_t *discovery_option)
{
OpenAPI_nf_type_e requester_nf_type = OpenAPI_nf_type_NULL;
ogs_assert(nf_instance);
ogs_assert(target_nf_type);
ogs_assert(ogs_sbi_self()->nf_instance);
requester_nf_type = ogs_sbi_self()->nf_instance->nf_type;
ogs_assert(requester_nf_type);
if (!OGS_FSM_CHECK(&nf_instance->sm, ogs_sbi_nf_state_registered))
@@ -1600,7 +1605,24 @@ ogs_sbi_client_t *ogs_sbi_client_find_by_service_name(
}
}
ogs_error("[Fallback] Cannot find NF service[%s:%s]", name, version);
return nf_instance->client;
}
ogs_sbi_client_t *ogs_sbi_client_find_by_service_type(
ogs_sbi_nf_instance_t *nf_instance,
ogs_sbi_service_type_e service_type)
{
ogs_sbi_nf_service_t *nf_service = NULL;
ogs_assert(nf_instance);
ogs_assert(service_type);
ogs_list_for_each(&nf_instance->nf_service_list, nf_service) {
ogs_assert(nf_service->name);
if (ogs_sbi_service_type_from_name(nf_service->name) == service_type)
return nf_service->client;
}
return nf_instance->client;
}
@@ -1643,8 +1665,15 @@ ogs_sbi_xact_t *ogs_sbi_xact_add(
xact->sbi_object = sbi_object;
xact->service_type = service_type;
xact->requester_nf_type = NF_INSTANCE_TYPE(ogs_sbi_self()->nf_instance);
ogs_assert(xact->requester_nf_type);
/* Always insert one service-name in the discovery option */
/*
* Insert one service-name in the discovery option in the function below.
*
* - ogs_sbi_xact_add()
* - ogs_sbi_send_notification_request()
*/
if (!discovery_option) {
discovery_option = ogs_sbi_discovery_option_new();
ogs_assert(discovery_option);
@@ -1661,7 +1690,11 @@ ogs_sbi_xact_t *ogs_sbi_xact_add(
ogs_app()->timer_mgr, ogs_timer_sbi_client_wait_expire, xact);
if (!xact->t_response) {
ogs_error("ogs_timer_add() failed");
if (xact->discovery_option)
ogs_sbi_discovery_option_free(xact->discovery_option);
ogs_pool_free(&xact_pool, xact);
return NULL;
}
@@ -1672,8 +1705,13 @@ ogs_sbi_xact_t *ogs_sbi_xact_add(
xact->request = (*build)(context, data);
if (!xact->request) {
ogs_error("SBI build failed");
if (xact->discovery_option)
ogs_sbi_discovery_option_free(xact->discovery_option);
ogs_timer_delete(xact->t_response);
ogs_pool_free(&xact_pool, xact);
return NULL;
}
if (!xact->request->h.uri) {
@@ -1746,6 +1784,49 @@ ogs_sbi_xact_t *ogs_sbi_xact_cycle(ogs_sbi_xact_t *xact)
return ogs_pool_cycle(&xact_pool, xact);
}
ogs_sbi_subscription_spec_t *ogs_sbi_subscription_spec_add(
OpenAPI_nf_type_e nf_type, const char *service_name)
{
ogs_sbi_subscription_spec_t *subscription_spec = NULL;
ogs_assert(nf_type);
ogs_pool_alloc(&subscription_spec_pool, &subscription_spec);
ogs_assert(subscription_spec);
memset(subscription_spec, 0, sizeof(ogs_sbi_subscription_spec_t));
subscription_spec->subscr_cond.nf_type = nf_type;
if (service_name)
subscription_spec->subscr_cond.service_name = ogs_strdup(service_name);
ogs_list_add(&ogs_sbi_self()->subscription_spec_list, subscription_spec);
return subscription_spec;
}
void ogs_sbi_subscription_spec_remove(
ogs_sbi_subscription_spec_t *subscription_spec)
{
ogs_assert(subscription_spec);
ogs_list_remove(&ogs_sbi_self()->subscription_spec_list, subscription_spec);
if (subscription_spec->subscr_cond.service_name)
ogs_free(subscription_spec->subscr_cond.service_name);
ogs_pool_free(&subscription_spec_pool, subscription_spec);
}
void ogs_sbi_subscription_spec_remove_all(void)
{
ogs_sbi_subscription_spec_t *subscription_spec = NULL;
ogs_sbi_subscription_spec_t *next_subscription_spec = NULL;
ogs_list_for_each_safe(&ogs_sbi_self()->subscription_spec_list,
next_subscription_spec, subscription_spec)
ogs_sbi_subscription_spec_remove(subscription_spec);
}
ogs_sbi_subscription_data_t *ogs_sbi_subscription_data_add(void)
{
ogs_sbi_subscription_data_t *subscription_data = NULL;
@@ -1843,39 +1924,3 @@ ogs_sbi_subscription_data_t *ogs_sbi_subscription_data_find(char *id)
return subscription_data;
}
void ogs_sbi_subscription_data_build_default(
OpenAPI_nf_type_e nf_type, const char *service_name)
{
ogs_sbi_subscription_data_t *subscription_data = NULL;
ogs_sbi_nf_instance_t *nf_instance = NULL, *nrf_instance = NULL;
ogs_sbi_client_t *client = NULL;
ogs_assert(nf_type);
nrf_instance = ogs_sbi_self()->nrf_instance;
if (!nrf_instance) {
ogs_warn("[%s:%s] has no NRF",
OpenAPI_nf_type_ToString(nf_type), service_name);
return;
}
client = nrf_instance->client;
ogs_assert(client);
nf_instance = ogs_sbi_self()->nf_instance;
ogs_assert(nf_instance);
ogs_assert(nf_instance->id);
ogs_assert(nf_instance->nf_type);
subscription_data = ogs_sbi_subscription_data_add();
ogs_assert(subscription_data);
OGS_SBI_SETUP_CLIENT(subscription_data, client);
subscription_data->req_nf_type = nf_instance->nf_type;
if (nf_instance->id)
subscription_data->req_nf_instance_id = ogs_strdup(nf_instance->id);
subscription_data->subscr_cond.nf_type = nf_type;
if (service_name)
subscription_data->subscr_cond.service_name = ogs_strdup(service_name);
}

View File

@@ -57,6 +57,7 @@ typedef struct ogs_sbi_context_s {
ogs_uuid_t uuid;
ogs_list_t nf_instance_list;
ogs_list_t subscription_spec_list;
ogs_list_t subscription_data_list;
ogs_sbi_nf_instance_t *nf_instance; /* SELF NF Instance */
@@ -84,18 +85,20 @@ typedef struct ogs_sbi_nf_instance_s {
ogs_timer_t *t_no_heartbeat; /* check heartbeat */
ogs_timer_t *t_validity; /* check validation */
#define NF_INSTANCE_ID(__nFInstance) \
((__nFInstance) ? ((__nFInstance)->id) : NULL)
#define NF_INSTANCE_ID_IS_SELF(_iD) \
(_iD) && ogs_sbi_self()->nf_instance && \
strcmp((_iD), ogs_sbi_self()->nf_instance->id) == 0
#define NF_INSTANCE_ID_IS_OTHERS(_iD) \
(_iD) && ogs_sbi_self()->nf_instance && \
strcmp((_iD), ogs_sbi_self()->nf_instance->id) != 0
char *id;
#define NF_INSTANCE_TYPE(__nFInstance) \
((__nFInstance) ? ((__nFInstance)->nf_type) : OpenAPI_nf_type_NULL)
#define NF_INSTANCE_TYPE_IS_NRF(__nFInstance) \
((__nFInstance->nf_type) == OpenAPI_nf_type_NRF)
char *id; /* NFInstanceId */
(NF_INSTANCE_TYPE(__nFInstance) == OpenAPI_nf_type_NRF)
OpenAPI_nf_type_e nf_type;
OpenAPI_nf_status_e nf_status;
@@ -121,6 +124,8 @@ typedef struct ogs_sbi_nf_instance_s {
ogs_list_t nf_service_list;
ogs_list_t nf_info_list;
#define NF_INSTANCE_CLIENT(__nFInstance) \
((__nFInstance) ? ((__nFInstance)->client) : NULL)
void *client; /* only used in CLIENT */
unsigned int reference_count; /* reference count for memory free */
} ogs_sbi_nf_instance_t;
@@ -155,6 +160,7 @@ typedef struct ogs_sbi_xact_s {
ogs_lnode_t lnode;
ogs_sbi_service_type_e service_type;
OpenAPI_nf_type_e requester_nf_type;
ogs_sbi_discovery_option_t *discovery_option;
ogs_sbi_request_t *request;
@@ -203,6 +209,16 @@ typedef struct ogs_sbi_nf_service_s {
void *client;
} ogs_sbi_nf_service_t;
typedef struct ogs_sbi_subscription_spec_s {
ogs_lnode_t lnode;
struct {
OpenAPI_nf_type_e nf_type; /* nfType */
char *service_name; /* ServiceName */
} subscr_cond;
} ogs_sbi_subscription_spec_t;
typedef struct ogs_sbi_subscription_data_s {
ogs_lnode_t lnode;
@@ -220,7 +236,7 @@ typedef struct ogs_sbi_subscription_data_s {
struct {
OpenAPI_nf_type_e nf_type; /* nfType */
char *service_name; /* ServiceName */
char *service_name; /* ServiceName */
} subscr_cond;
uint64_t requester_features;
@@ -297,8 +313,6 @@ int ogs_sbi_context_parse_config(
bool ogs_sbi_nf_service_is_available(const char *name);
ogs_sbi_nf_instance_t *ogs_sbi_scp_instance(void);
ogs_sbi_nf_instance_t *ogs_sbi_nf_instance_add(void);
void ogs_sbi_nf_instance_set_id(ogs_sbi_nf_instance_t *nf_instance, char *id);
void ogs_sbi_nf_instance_set_type(
@@ -315,9 +329,11 @@ void ogs_sbi_nf_instance_remove_all(void);
ogs_sbi_nf_instance_t *ogs_sbi_nf_instance_find(char *id);
ogs_sbi_nf_instance_t *ogs_sbi_nf_instance_find_by_discovery_param(
OpenAPI_nf_type_e nf_type,
OpenAPI_nf_type_e requester_nf_type,
ogs_sbi_discovery_option_t *discovery_option);
ogs_sbi_nf_instance_t *ogs_sbi_nf_instance_find_by_service_type(
ogs_sbi_service_type_e service_type);
ogs_sbi_service_type_e service_type,
OpenAPI_nf_type_e requester_nf_type);
bool ogs_sbi_nf_instance_maximum_number_is_reached(void);
ogs_sbi_nf_service_t *ogs_sbi_nf_service_add(
@@ -352,6 +368,9 @@ ogs_sbi_nf_service_t *ogs_sbi_nf_service_build_default(
ogs_sbi_client_t *ogs_sbi_client_find_by_service_name(
ogs_sbi_nf_instance_t *nf_instance, char *name, char *version);
ogs_sbi_client_t *ogs_sbi_client_find_by_service_type(
ogs_sbi_nf_instance_t *nf_instance,
ogs_sbi_service_type_e service_type);
void ogs_sbi_client_associate(ogs_sbi_nf_instance_t *nf_instance);
@@ -373,6 +392,7 @@ OpenAPI_uri_scheme_e ogs_sbi_default_uri_scheme(void);
bool ogs_sbi_discovery_param_is_matched(
ogs_sbi_nf_instance_t *nf_instance,
OpenAPI_nf_type_e target_nf_type,
OpenAPI_nf_type_e requester_nf_type,
ogs_sbi_discovery_option_t *discovery_option);
bool ogs_sbi_discovery_option_is_matched(
@@ -391,6 +411,12 @@ void ogs_sbi_xact_remove(ogs_sbi_xact_t *xact);
void ogs_sbi_xact_remove_all(ogs_sbi_object_t *sbi_object);
ogs_sbi_xact_t *ogs_sbi_xact_cycle(ogs_sbi_xact_t *xact);
ogs_sbi_subscription_spec_t *ogs_sbi_subscription_spec_add(
OpenAPI_nf_type_e nf_type, const char *service_name);
void ogs_sbi_subscription_spec_remove(
ogs_sbi_subscription_spec_t *subscription_spec);
void ogs_sbi_subscription_spec_remove_all(void);
ogs_sbi_subscription_data_t *ogs_sbi_subscription_data_add(void);
void ogs_sbi_subscription_data_set_id(
ogs_sbi_subscription_data_t *subscription_data, char *id);
@@ -400,8 +426,6 @@ void ogs_sbi_subscription_data_remove_all_by_nf_instance_id(
char *nf_instance_id);
void ogs_sbi_subscription_data_remove_all(void);
ogs_sbi_subscription_data_t *ogs_sbi_subscription_data_find(char *id);
void ogs_sbi_subscription_data_build_default(
OpenAPI_nf_type_e nf_type, const char *service_name);
#ifdef __cplusplus
}

View File

@@ -451,6 +451,72 @@ bool ogs_sbi_time_from_string(ogs_time_t *timestamp, char *str)
return true;
}
int ogs_sbi_rfc7231_string(char *date_str, ogs_time_t time)
{
const char ogs_month_snames[12][4] = {
"Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul",
"Aug", "Sep", "Oct", "Nov", "Dec"
};
const char ogs_day_snames[7][4] = {
"Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat"
};
struct tm gmt;
const char *s;
int real_year;
ogs_time_t sec = ogs_time_sec(time);
ogs_time_t msec = ogs_time_msec(time);
ogs_assert(date_str);
ogs_gmtime(sec, &gmt);
/* example: "Sun, 04 Aug 2019 08:49:37.845 GMT" */
/* 123456789012345678901234567890123 */
s = &ogs_day_snames[gmt.tm_wday][0];
*date_str++ = *s++;
*date_str++ = *s++;
*date_str++ = *s++;
*date_str++ = ',';
*date_str++ = ' ';
*date_str++ = gmt.tm_mday / 10 + '0';
*date_str++ = gmt.tm_mday % 10 + '0';
*date_str++ = ' ';
s = &ogs_month_snames[gmt.tm_mon][0];
*date_str++ = *s++;
*date_str++ = *s++;
*date_str++ = *s++;
*date_str++ = ' ';
real_year = 1900 + gmt.tm_year;
/* This routine isn't y10k ready. */
*date_str++ = real_year / 1000 + '0';
*date_str++ = real_year % 1000 / 100 + '0';
*date_str++ = real_year % 100 / 10 + '0';
*date_str++ = real_year % 10 + '0';
*date_str++ = ' ';
*date_str++ = gmt.tm_hour / 10 + '0';
*date_str++ = gmt.tm_hour % 10 + '0';
*date_str++ = ':';
*date_str++ = gmt.tm_min / 10 + '0';
*date_str++ = gmt.tm_min % 10 + '0';
*date_str++ = ':';
*date_str++ = gmt.tm_sec / 10 + '0';
*date_str++ = gmt.tm_sec % 10 + '0';
*date_str++ = '.';
*date_str++ = msec / 100 + '0';
*date_str++ = msec % 100 / 10 + '0';
*date_str++ = msec % 10 + '0';
*date_str++ = ' ';
*date_str++ = 'G';
*date_str++ = 'M';
*date_str++ = 'T';
*date_str++ = 0;
return OGS_OK;
}
char *ogs_sbi_s_nssai_to_string(ogs_s_nssai_t *s_nssai)
{
cJSON *item = NULL;

View File

@@ -56,6 +56,9 @@ char *ogs_sbi_gmtime_string(ogs_time_t time);
char *ogs_sbi_timezone_string(int tm_gmtoff);
bool ogs_sbi_time_from_string(ogs_time_t *time, char *str);
#define OGS_SBI_RFC7231_DATE_LEN (34)
int ogs_sbi_rfc7231_string(char *date_str, ogs_time_t time);
char *ogs_sbi_s_nssai_to_string(ogs_s_nssai_t *s_nssai);
bool ogs_sbi_s_nssai_from_string(ogs_s_nssai_t *s_nssai, char *str);

View File

@@ -41,6 +41,7 @@ libsbi_sources = files('''
nnrf-build.c
nnrf-handler.c
nnrf-path.c
path.c
nf-sm.c

View File

@@ -179,6 +179,10 @@ void ogs_sbi_message_free(ogs_sbi_message_t *message)
OpenAPI_termination_notification_free(message->TerminationNotification);
if (message->DeregistrationData)
OpenAPI_deregistration_data_free(message->DeregistrationData);
if (message->SDMSubscription)
OpenAPI_sdm_subscription_free(message->SDMSubscription);
if (message->ModificationNotification)
OpenAPI_modification_notification_free(message->ModificationNotification);
/* HTTP Part */
for (i = 0; i < message->num_of_part; i++) {
@@ -249,6 +253,9 @@ ogs_sbi_request_t *ogs_sbi_build_request(ogs_sbi_message_t *message)
{
int i;
ogs_sbi_request_t *request = NULL;
OpenAPI_nf_type_e nf_type = OpenAPI_nf_type_NULL;
char sender_timestamp[OGS_SBI_RFC7231_DATE_LEN];
char *max_rsp_time = NULL;
ogs_assert(message);
@@ -307,21 +314,17 @@ ogs_sbi_request_t *ogs_sbi_build_request(ogs_sbi_message_t *message)
discovery_option->num_of_service_names) {
/* send array items separated by a comma */
char *v = NULL;
v = ogs_strdup(discovery_option->service_names[0]);
ogs_expect_or_return_val(v, NULL);
if (discovery_option->num_of_service_names > 1)
{
int i;
for (i = 1; i < discovery_option->num_of_service_names; i++)
v = ogs_mstrcatf(v, ",%s", discovery_option->service_names[i]);
char *v = ogs_sbi_discovery_option_build_service_names(
discovery_option);
if (v) {
ogs_sbi_header_set(request->http.params,
OGS_SBI_PARAM_SERVICE_NAMES, v);
ogs_free(v);
} else {
ogs_warn("invalid service names failed[%d:%s]",
discovery_option->num_of_service_names,
discovery_option->service_names[0]);
}
ogs_sbi_header_set(
request->http.params, OGS_SBI_PARAM_SERVICE_NAMES, v);
ogs_free(v);
}
}
@@ -443,10 +446,38 @@ ogs_sbi_request_t *ogs_sbi_build_request(ogs_sbi_message_t *message)
END
}
nf_type = NF_INSTANCE_TYPE(ogs_sbi_self()->nf_instance);
if (nf_type) {
char *user_agent = OpenAPI_nf_type_ToString(nf_type);
if (user_agent)
ogs_sbi_header_set(request->http.headers,
OGS_SBI_USER_AGENT, user_agent);
}
ogs_assert(OGS_OK ==
ogs_sbi_rfc7231_string(sender_timestamp, ogs_time_now()));
ogs_sbi_header_set(request->http.headers,
OGS_SBI_OPTIONAL_CUSTOM_SENDER_TIMESTAMP, sender_timestamp);
ogs_assert(ogs_time_to_msec(ogs_app()->time.message.duration));
max_rsp_time = ogs_msprintf("%d",
(int)ogs_time_to_msec(ogs_app()->time.message.duration));
ogs_sbi_header_set(request->http.headers,
OGS_SBI_OPTIONAL_CUSTOM_MAX_RSP_TIME, max_rsp_time);
ogs_free(max_rsp_time);
if (message->http.content_encoding)
ogs_sbi_header_set(request->http.headers,
OGS_SBI_ACCEPT_ENCODING, message->http.content_encoding);
if (message->http.custom.callback)
ogs_sbi_header_set(request->http.headers,
OGS_SBI_CUSTOM_CALLBACK, message->http.custom.callback);
if (message->http.custom.nrf_uri)
ogs_sbi_header_set(request->http.headers,
OGS_SBI_CUSTOM_NRF_URI, message->http.custom.nrf_uri);
return request;
}
@@ -514,37 +545,33 @@ int ogs_sbi_parse_request(
/* Discovery Option Parameter */
} else if (!strcmp(ogs_hash_this_key(hi),
OGS_SBI_PARAM_TARGET_NF_INSTANCE_ID)) {
discovery_option_presence = true;
ogs_sbi_discovery_option_set_target_nf_instance_id(
discovery_option, ogs_hash_this_val(hi));
char *v = NULL;
v = ogs_hash_this_val(hi);
if (v) {
ogs_sbi_discovery_option_set_target_nf_instance_id(
discovery_option, v);
discovery_option_presence = true;
}
} else if (!strcmp(ogs_hash_this_key(hi),
OGS_SBI_PARAM_REQUESTER_NF_INSTANCE_ID)) {
discovery_option_presence = true;
ogs_sbi_discovery_option_set_requester_nf_instance_id(
discovery_option, ogs_hash_this_val(hi));
char *v = NULL;
v = ogs_hash_this_val(hi);
if (v) {
ogs_sbi_discovery_option_set_requester_nf_instance_id(
discovery_option, v);
discovery_option_presence = true;
}
} else if (!strcmp(ogs_hash_this_key(hi),
OGS_SBI_PARAM_SERVICE_NAMES)) {
char *v = NULL;
char *service_names;
char *token;
char *saveptr;
v = ogs_hash_this_val(hi);
if (v) {
service_names = ogs_strdup(v);
ogs_assert(service_names);
token = ogs_strtok_r(service_names, ",", &saveptr);
while (token != NULL)
{
discovery_option_presence = true;
ogs_sbi_discovery_option_add_service_names(
discovery_option, token);
token = ogs_strtok_r(NULL, ",", &saveptr);
}
ogs_free(service_names);
ogs_sbi_discovery_option_parse_service_names(
discovery_option, v);
discovery_option_presence = true;
}
/* URL Query Parameter */
@@ -653,11 +680,26 @@ int ogs_sbi_parse_request(
message->http.content_type = ogs_hash_this_val(hi);
} else if (!ogs_strcasecmp(ogs_hash_this_key(hi), OGS_SBI_ACCEPT)) {
message->http.accept = ogs_hash_this_val(hi);
} else if (!ogs_strcasecmp(ogs_hash_this_key(hi), OGS_SBI_USER_AGENT)) {
char *v = ogs_hash_this_val(hi);
if (v)
message->http.requester_nf_type =
OpenAPI_nf_type_FromString(v);
} else if (!ogs_strcasecmp(ogs_hash_this_key(hi),
OGS_SBI_CUSTOM_CALLBACK)) {
message->http.custom.callback = ogs_hash_this_val(hi);
}
}
if (!message->http.requester_nf_type) {
ogs_error("No User-Agent in HTTP2 Header");
ogs_sbi_message_free(message);
return OGS_ERROR;
}
if (parse_content(message, &request->http) != OGS_OK) {
ogs_error("parse_content() failed");
ogs_sbi_message_free(message);
return OGS_ERROR;
}
@@ -1008,6 +1050,15 @@ static char *build_json(ogs_sbi_message_t *message)
item = OpenAPI_deregistration_data_convertToJSON(
message->DeregistrationData);
ogs_assert(item);
} else if (message->SDMSubscription) {
item = OpenAPI_sdm_subscription_convertToJSON(
message->SDMSubscription);
ogs_assert(item);
}
else if (message->ModificationNotification) {
item = OpenAPI_modification_notification_convertToJSON(
message->ModificationNotification);
ogs_assert(item);
}
if (item) {
@@ -1312,6 +1363,15 @@ static int parse_json(ogs_sbi_message_t *message,
}
break;
CASE(OGS_SBI_RESOURCE_NAME_SDM_SUBSCRIPTIONS)
message->SDMSubscription =
OpenAPI_sdm_subscription_parseFromJSON(item);
if (!message->SDMSubscription) {
rv = OGS_ERROR;
ogs_error("JSON parse error");
}
break;
DEFAULT
rv = OGS_ERROR;
ogs_error("Unknown resource name [%s]",
@@ -1855,6 +1915,15 @@ static int parse_json(ogs_sbi_message_t *message,
}
break;
CASE(OGS_SBI_RESOURCE_NAME_SDMSUBSCRIPTION_NOTIFY)
message->ModificationNotification =
OpenAPI_modification_notification_parseFromJSON(item);
if (!message->ModificationNotification) {
rv = OGS_ERROR;
ogs_error("JSON parse error");
}
break;
DEFAULT
rv = OGS_ERROR;
ogs_error("Unknown resource name [%s]",
@@ -2351,3 +2420,46 @@ void ogs_sbi_discovery_option_add_service_names(
[discovery_option->num_of_service_names]);
discovery_option->num_of_service_names++;
}
char *ogs_sbi_discovery_option_build_service_names(
ogs_sbi_discovery_option_t *discovery_option)
{
int i;
char *service_names = NULL;
ogs_assert(discovery_option);
service_names = ogs_strdup(discovery_option->service_names[0]);
ogs_expect_or_return_val(service_names, NULL);
if (discovery_option->num_of_service_names > 1) {
for (i = 1; i < discovery_option->num_of_service_names; i++)
service_names = ogs_mstrcatf(
service_names, ",%s", discovery_option->service_names[i]);
}
return service_names;
}
void ogs_sbi_discovery_option_parse_service_names(
ogs_sbi_discovery_option_t *discovery_option,
char *service_names)
{
char *v = NULL;
char *token = NULL;
char *saveptr = NULL;
ogs_assert(discovery_option);
ogs_assert(service_names);
v = ogs_strdup(service_names);
ogs_assert(v);
token = ogs_strtok_r(v, ",", &saveptr);
while (token != NULL) {
ogs_sbi_discovery_option_add_service_names(discovery_option, token);
token = ogs_strtok_r(NULL, ",", &saveptr);
}
ogs_free(v);
}

View File

@@ -95,6 +95,7 @@ extern "C" {
#define OGS_SBI_RESOURCE_NAME_UE_CONTEXT_IN_SMF_DATA "ue-context-in-smf-data"
#define OGS_SBI_RESOURCE_NAME_SMF_SELECTION_SUBSCRIPTION_DATA \
"smf-selection-subscription-data"
#define OGS_SBI_RESOURCE_NAME_SDM_SUBSCRIPTIONS "sdm-subscriptions"
#define OGS_SBI_RESOURCE_NAME_SECURITY_INFORMATION "security-information"
#define OGS_SBI_RESOURCE_NAME_GENERATE_AUTH_DATA "generate-auth-data"
@@ -126,6 +127,8 @@ extern "C" {
#define OGS_SBI_RESOURCE_NAME_SM_CONTEXT_STATUS "sm-context-status"
#define OGS_SBI_RESOURCE_NAME_AM_POLICY_NOTIFY "am-policy-notify"
#define OGS_SBI_RESOURCE_NAME_DEREG_NOTIFY "dereg-notify"
#define OGS_SBI_RESOURCE_NAME_SDMSUBSCRIPTION_NOTIFY \
"sdmsubscription-notify"
#define OGS_SBI_RESOURCE_NAME_POLICIES "policies"
#define OGS_SBI_RESOURCE_NAME_SM_POLICIES "sm-policies"
@@ -230,8 +233,11 @@ extern "C" {
#define OGS_SBI_NBSF_MANAGEMENT_ES3XX 4
#define OGS_SBI_NBSF_MANAGEMENT_EXTENDED_SAME_PCF 5
#define OGS_SBI_SCHEME ":scheme"
#define OGS_SBI_AUTHORITY ":authority"
#define OGS_SBI_ACCEPT "Accept"
#define OGS_SBI_ACCEPT_ENCODING "Accept-Encoding"
#define OGS_SBI_USER_AGENT "User-Agent"
#define OGS_SBI_CONTENT_TYPE "Content-Type"
#define OGS_SBI_LOCATION "Location"
#define OGS_SBI_EXPECT "Expect"
@@ -280,6 +286,10 @@ extern "C" {
OGS_SBI_CUSTOM_3GPP_COMMON "Access-Scope"
#define OGS_SBI_CUSTOM_ACCESS_TOKEN \
OGS_SBI_CUSTOM_3GPP_COMMON "Access-Token"
#define OGS_SBI_OPTIONAL_CUSTOM_SENDER_TIMESTAMP \
OGS_SBI_CUSTOM_3GPP_COMMON "Sender-Timestamp"
#define OGS_SBI_OPTIONAL_CUSTOM_MAX_RSP_TIME \
OGS_SBI_CUSTOM_3GPP_COMMON "Max-Rsp-Time"
#define OGS_SBI_PARAM_TARGET_NF_TYPE "target-nf-type"
#define OGS_SBI_PARAM_REQUESTER_NF_TYPE "requester-nf-type"
@@ -321,6 +331,39 @@ extern "C" {
#define OGS_SBI_CONTENT_5GNAS_SM_ID "5gnas-sm"
#define OGS_SBI_CONTENT_NGAP_SM_ID "ngap-sm"
#define OGS_SBI_CALLBACK_NSMF_PDUSESSION_UPDATE \
"Nsmf_PDUSession_Update"
#define OGS_SBI_CALLBACK_NSMF_PDUSESSION_STATUS_NOTIFY \
"Nsmf_PDUSession_StatusNotify"
#define OGS_SBI_CALLBACK_NUDM_SDM_NOTIFICATION \
"Nudm_SDM_Notification"
#define OGS_SBI_CALLBACK_NUDM_UECM_DEREGISTRATION_NOTIFICATION \
"Nudm_UECM_DeregistrationNotification"
#define OGS_SBI_CALLBACK_NUDM_UECM_PCSCF_RESTORATION_NOTIFICATION \
"Nudm_UECM_PCSCFRestorationNotification"
#define OGS_SBI_CALLBACK_NNRF_NFMANAGEMENT_NF_STATUS_NOTIFY \
"Nnrf_NFManagement_NFStatusNotify"
#define OGS_SBI_CALLBACK_NAMF_EVENTEXPOSURE_NOTIFY \
"Namf_EventExposure_Notify"
#define OGS_SBI_CALLBACK_NPCF_UEPOLICYCONTROL_UPDATE_NOTIFY \
"Npcf_UEPolicyControl_UpdateNotify"
#define OGS_SBI_CALLBACK_NNSSF_NSSAIAVAILABILITY_NOTIFICATION \
"Nnssf_NSSAIAvailability_Notification"
#define OGS_SBI_CALLBACK_NAMF_COMMUNICATION_AMF_STATUS_CHANGE_NOTIFY \
"Namf_Communication_AMFStatusChangeNotify"
#define OGS_SBI_CALLBACK_NGMLC_LOCATION_EVENT_NOTIFY \
"Ngmlc_Location_EventNotify"
#define OGS_SBI_CALLBACK_NCHF_CONVERGEDCHARGING_NOTIFY \
"Nchf_ConvergedCharging_Notify"
#define OGS_SBI_CALLBACK_NNSSAAF_NSSAA_RE_AUTHENTICATION \
"Nnssaaf_NSSAA_ReAuthentication"
#define OGS_SBI_CALLBACK_NNSSAAF_NSSAA_REVOCATION \
"Nnssaaf_NSSAA_Revocation"
#define OGS_SBI_CALLBACK_N5G_DDNMF_DISCOVERY_MONITOR_UPDATE_RESULT \
"N5g-ddnmf_Discovery_MonitorUpdateResult"
#define OGS_SBI_CALLBACK_N5G_DDNMF_DISCOVERY_MATCH_INFORMATION \
"N5g-ddnmf_Discovery_MatchInformation"
typedef struct ogs_sbi_header_s {
char *method;
char *uri;
@@ -359,11 +402,18 @@ typedef struct ogs_sbi_message_s {
ogs_sbi_header_t h;
struct {
OpenAPI_nf_type_e requester_nf_type;
char *accept;
char *content_encoding;
char *content_type;
char *location;
char *cache_control;
struct {
char *callback;
char *nrf_uri;
} custom;
} http;
struct {
@@ -448,6 +498,8 @@ typedef struct ogs_sbi_message_s {
OpenAPI_sm_policy_notification_t *SmPolicyNotification;
OpenAPI_termination_notification_t *TerminationNotification;
OpenAPI_deregistration_data_t *DeregistrationData;
OpenAPI_sdm_subscription_t *SDMSubscription;
OpenAPI_modification_notification_t *ModificationNotification;
ogs_sbi_links_t *links;
@@ -528,9 +580,15 @@ void ogs_sbi_discovery_option_set_target_nf_instance_id(
void ogs_sbi_discovery_option_set_requester_nf_instance_id(
ogs_sbi_discovery_option_t *discovery_option,
char *requester_nf_instance_id);
void ogs_sbi_discovery_option_add_service_names(
ogs_sbi_discovery_option_t *discovery_option,
char *service_name);
char *ogs_sbi_discovery_option_build_service_names(
ogs_sbi_discovery_option_t *discovery_option);
void ogs_sbi_discovery_option_parse_service_names(
ogs_sbi_discovery_option_t *discovery_option,
char *service_names);
#ifdef __cplusplus
}

View File

@@ -110,9 +110,7 @@ void ogs_sbi_nf_state_final(ogs_fsm_t *s, ogs_event_t *e)
void ogs_sbi_nf_state_will_register(ogs_fsm_t *s, ogs_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);
@@ -121,7 +119,6 @@ void ogs_sbi_nf_state_will_register(ogs_fsm_t *s, ogs_event_t *e)
nf_instance = e->sbi.data;
ogs_assert(nf_instance);
ogs_assert(ogs_sbi_self()->nf_instance);
ogs_assert(NF_INSTANCE_TYPE_IS_NRF(nf_instance));
switch (e->id) {
@@ -148,11 +145,11 @@ void ogs_sbi_nf_state_will_register(ogs_fsm_t *s, ogs_event_t *e)
if (message->res_status == OGS_SBI_HTTP_STATUS_OK ||
message->res_status == OGS_SBI_HTTP_STATUS_CREATED) {
ogs_sbi_nnrf_handle_nf_register(nf_instance, message);
ogs_nnrf_nfm_handle_nf_register(nf_instance, message);
OGS_FSM_TRAN(s, &ogs_sbi_nf_state_registered);
} else {
ogs_error("[%s] HTTP Response Status Code [%d]",
ogs_sbi_self()->nf_instance->id,
NF_INSTANCE_ID(ogs_sbi_self()->nf_instance),
message->res_status);
OGS_FSM_TRAN(s, &ogs_sbi_nf_state_exception);
}
@@ -160,27 +157,23 @@ void ogs_sbi_nf_state_will_register(ogs_fsm_t *s, ogs_event_t *e)
DEFAULT
ogs_error("[%s] Invalid resource name [%s]",
ogs_sbi_self()->nf_instance->id,
NF_INSTANCE_ID(ogs_sbi_self()->nf_instance),
message->h.resource.component[0]);
END
break;
DEFAULT
ogs_error("[%s] Invalid API name [%s]",
ogs_sbi_self()->nf_instance->id, message->h.service.name);
NF_INSTANCE_ID(ogs_sbi_self()->nf_instance),
message->h.service.name);
END
break;
case OGS_EVENT_SBI_TIMER:
switch(e->timer_id) {
case OGS_TIMER_NF_INSTANCE_REGISTRATION_INTERVAL:
client = nf_instance->client;
ogs_assert(client);
addr = client->node.addr;
ogs_assert(addr);
ogs_warn("[%s] Retry to registration with NRF",
ogs_sbi_self()->nf_instance->id);
NF_INSTANCE_ID(ogs_sbi_self()->nf_instance));
ogs_timer_start(nf_instance->t_registration_interval,
ogs_app()->time.message.sbi.nf_register_interval);
@@ -190,7 +183,7 @@ void ogs_sbi_nf_state_will_register(ogs_fsm_t *s, ogs_event_t *e)
default:
ogs_error("[%s] Unknown timer[%s:%d]",
ogs_sbi_self()->nf_instance->id,
NF_INSTANCE_ID(ogs_sbi_self()->nf_instance),
ogs_timer_get_name(e->timer_id), e->timer_id);
}
break;
@@ -212,15 +205,14 @@ void ogs_sbi_nf_state_registered(ogs_fsm_t *s, ogs_event_t *e)
nf_instance = e->sbi.data;
ogs_assert(nf_instance);
ogs_assert(ogs_sbi_self()->nf_instance);
switch (e->id) {
case OGS_FSM_ENTRY_SIG:
if (NF_INSTANCE_TYPE_IS_NRF(nf_instance)) {
ogs_sbi_subscription_data_t *subscription_data = NULL;
ogs_sbi_subscription_spec_t *subscription_spec = NULL;
ogs_info("[%s] NF registered [Heartbeat:%ds]",
ogs_sbi_self()->nf_instance->id,
NF_INSTANCE_ID(ogs_sbi_self()->nf_instance),
nf_instance->time.heartbeat_interval);
if (nf_instance->time.heartbeat_interval) {
@@ -233,16 +225,20 @@ void ogs_sbi_nf_state_registered(ogs_fsm_t *s, ogs_event_t *e)
}
ogs_list_for_each(
&ogs_sbi_self()->subscription_data_list, subscription_data) {
ogs_assert(true ==
ogs_nnrf_nfm_send_nf_status_subscribe(subscription_data));
&ogs_sbi_self()->subscription_spec_list, subscription_spec) {
ogs_nnrf_nfm_send_nf_status_subscribe(
ogs_sbi_self()->nf_instance->nf_type,
ogs_sbi_self()->nf_instance->id,
subscription_spec->subscr_cond.nf_type,
subscription_spec->subscr_cond.service_name);
}
}
break;
case OGS_FSM_EXIT_SIG:
if (NF_INSTANCE_TYPE_IS_NRF(nf_instance)) {
ogs_info("[%s] NF de-registered", ogs_sbi_self()->nf_instance->id);
ogs_info("[%s] NF de-registered",
NF_INSTANCE_ID(ogs_sbi_self()->nf_instance));
if (nf_instance->time.heartbeat_interval) {
ogs_timer_stop(nf_instance->t_heartbeat_interval);
@@ -276,7 +272,7 @@ void ogs_sbi_nf_state_registered(ogs_fsm_t *s, ogs_event_t *e)
no_heartbeat_margin));
} else {
ogs_warn("[%s] HTTP response error [%d]",
ogs_sbi_self()->nf_instance->id,
NF_INSTANCE_ID(ogs_sbi_self()->nf_instance),
message->res_status);
OGS_FSM_TRAN(s, &ogs_sbi_nf_state_exception);
}
@@ -285,14 +281,15 @@ void ogs_sbi_nf_state_registered(ogs_fsm_t *s, ogs_event_t *e)
DEFAULT
ogs_error("[%s] Invalid resource name [%s]",
ogs_sbi_self()->nf_instance->id,
NF_INSTANCE_ID(ogs_sbi_self()->nf_instance),
message->h.resource.component[0]);
END
break;
DEFAULT
ogs_error("[%s] Invalid API name [%s]",
ogs_sbi_self()->nf_instance->id, message->h.service.name);
NF_INSTANCE_ID(ogs_sbi_self()->nf_instance),
message->h.service.name);
END
break;
@@ -307,7 +304,10 @@ void ogs_sbi_nf_state_registered(ogs_fsm_t *s, ogs_event_t *e)
break;
case OGS_TIMER_NF_INSTANCE_NO_HEARTBEAT:
ogs_error("[%s] No heartbeat", ogs_sbi_self()->nf_instance->id);
ogs_error("[%s:%s] No heartbeat",
NF_INSTANCE_ID(ogs_sbi_self()->nf_instance),
OpenAPI_nf_type_ToString(
NF_INSTANCE_TYPE(ogs_sbi_self()->nf_instance)));
OGS_FSM_TRAN(s, &ogs_sbi_nf_state_will_register);
break;
@@ -351,7 +351,8 @@ void ogs_sbi_nf_state_de_registered(ogs_fsm_t *s, ogs_event_t *e)
switch (e->id) {
case OGS_FSM_ENTRY_SIG:
if (NF_INSTANCE_TYPE_IS_NRF(nf_instance)) {
ogs_info("[%s] NF de-registered", ogs_sbi_self()->nf_instance->id);
ogs_info("[%s] NF de-registered",
NF_INSTANCE_ID(ogs_sbi_self()->nf_instance));
}
break;
@@ -370,9 +371,7 @@ void ogs_sbi_nf_state_de_registered(ogs_fsm_t *s, ogs_event_t *e)
void ogs_sbi_nf_state_exception(ogs_fsm_t *s, ogs_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);
@@ -400,13 +399,8 @@ void ogs_sbi_nf_state_exception(ogs_fsm_t *s, ogs_event_t *e)
case OGS_EVENT_SBI_TIMER:
switch(e->timer_id) {
case OGS_TIMER_NF_INSTANCE_REGISTRATION_INTERVAL:
client = nf_instance->client;
ogs_assert(client);
addr = client->node.addr;
ogs_assert(addr);
ogs_warn("[%s] Retry to registration with NRF",
ogs_sbi_self()->nf_instance->id);
NF_INSTANCE_ID(ogs_sbi_self()->nf_instance));
OGS_FSM_TRAN(s, &ogs_sbi_nf_state_will_register);
break;

View File

@@ -1,5 +1,5 @@
/*
* Copyright (C) 2019,2020 by Sukchan Lee <acetcom@gmail.com>
* Copyright (C) 2019-2022 by Sukchan Lee <acetcom@gmail.com>
*
* This file is part of Open5GS.
*

View File

@@ -55,13 +55,20 @@ ogs_sbi_request_t *ogs_nnrf_nfm_build_register(void)
NFProfile = ogs_nnrf_nfm_build_nf_profile(
ogs_sbi_self()->nf_instance,
NULL, NULL, supported_features);
ogs_expect_or_return_val(NFProfile, NULL);
if (!NFProfile) {
ogs_error("No NFProfile");
goto end;
}
message.NFProfile = NFProfile;
request = ogs_sbi_build_request(&message);
ogs_expect(request);
ogs_nnrf_nfm_free_nf_profile(NFProfile);
end:
if (NFProfile)
ogs_nnrf_nfm_free_nf_profile(NFProfile);
return request;
}
@@ -97,7 +104,10 @@ OpenAPI_nf_profile_t *ogs_nnrf_nfm_build_nf_profile(
ogs_assert(nf_instance->id);
NFProfile = ogs_calloc(1, sizeof(*NFProfile));
ogs_expect_or_return_val(NFProfile, NULL);
if (!NFProfile) {
ogs_error("No NFProfile");
return NULL;
}
NFProfile->nf_instance_id = nf_instance->id;
NFProfile->nf_type = nf_instance->nf_type;
@@ -128,9 +138,11 @@ OpenAPI_nf_profile_t *ogs_nnrf_nfm_build_nf_profile(
NFProfile->load = nf_instance->load;
Ipv4AddrList = OpenAPI_list_create();
ogs_assert(Ipv4AddrList);
Ipv6AddrList = OpenAPI_list_create();
ogs_assert(Ipv6AddrList);
if (!Ipv4AddrList) {
ogs_error("No Ipv4AddrList");
ogs_nnrf_nfm_free_nf_profile(NFProfile);
return NULL;
}
for (i = 0; i < nf_instance->num_of_ipv4; i++) {
if (nf_instance->ipv4[i]) {
@@ -140,33 +152,56 @@ OpenAPI_nf_profile_t *ogs_nnrf_nfm_build_nf_profile(
nf_instance->ipv4[i]->ogs_sin_port);
ogs_assert(nf_instance->ipv4[i]->ogs_sa_family == AF_INET);
ipstr = ogs_ipstrdup(nf_instance->ipv4[i]);
ogs_expect_or_return_val(ipstr, NULL);
if (!ipstr) {
ogs_error("No ipstr");
ogs_nnrf_nfm_free_nf_profile(NFProfile);
OpenAPI_list_free(Ipv4AddrList);
return NULL;
}
OpenAPI_list_add(Ipv4AddrList, ipstr);
}
}
for (i = 0; i < nf_instance->num_of_ipv6; i++) {
if (nf_instance->ipv6[i]) {
ogs_trace("IPv6 [family:%d, port:%d]",
nf_instance->ipv6[i]->ogs_sa_family,
nf_instance->ipv6[i]->ogs_sin_port);
ogs_assert(nf_instance->ipv6[i]->ogs_sa_family == AF_INET6);
ipstr = ogs_ipstrdup(nf_instance->ipv6[i]);
ogs_expect_or_return_val(ipstr, NULL);
OpenAPI_list_add(Ipv6AddrList, ipstr);
}
}
if (Ipv4AddrList->count)
NFProfile->ipv4_addresses = Ipv4AddrList;
else
OpenAPI_list_free(Ipv4AddrList);
Ipv6AddrList = OpenAPI_list_create();
if (!Ipv6AddrList) {
ogs_error("No IPv6AddrList");
ogs_nnrf_nfm_free_nf_profile(NFProfile);
return NULL;
}
for (i = 0; i < nf_instance->num_of_ipv6; i++) {
if (nf_instance->ipv6[i]) {
ogs_trace("IPv6 [family:%d, port:%d]",
nf_instance->ipv6[i]->ogs_sa_family,
nf_instance->ipv6[i]->ogs_sin_port);
ogs_assert(nf_instance->ipv6[i]->ogs_sa_family == AF_INET6);
ipstr = ogs_ipstrdup(nf_instance->ipv6[i]);
if (!ipstr) {
ogs_error("No ipstr");
ogs_nnrf_nfm_free_nf_profile(NFProfile);
OpenAPI_list_free(Ipv6AddrList);
return NULL;
}
OpenAPI_list_add(Ipv6AddrList, ipstr);
}
}
if (Ipv6AddrList->count)
NFProfile->ipv6_addresses = Ipv6AddrList;
else
OpenAPI_list_free(Ipv6AddrList);
AllowedNfTypeList = OpenAPI_list_create();
ogs_assert(AllowedNfTypeList);
if (!AllowedNfTypeList) {
ogs_error("No AllowedNfTypeList");
ogs_nnrf_nfm_free_nf_profile(NFProfile);
return NULL;
}
for (i = 0; i < nf_instance->num_of_allowed_nf_type; i++) {
OpenAPI_list_add(AllowedNfTypeList,
@@ -179,7 +214,18 @@ OpenAPI_nf_profile_t *ogs_nnrf_nfm_build_nf_profile(
OpenAPI_list_free(AllowedNfTypeList);
NFServiceList = OpenAPI_list_create();
ogs_assert(NFServiceList);
if (!NFServiceList) {
ogs_error("No nf_service_list");
ogs_nnrf_nfm_free_nf_profile(NFProfile);
return NULL;
}
if (OGS_SBI_FEATURES_IS_SET(
supported_features, OGS_SBI_NNRF_NFM_SERVICE_MAP)) {
NFProfile->nf_service_list = NFServiceList;
} else {
NFProfile->nf_services = NFServiceList;
}
ogs_list_for_each(&nf_instance->nf_service_list, nf_service) {
OpenAPI_nf_service_t *NFService = NULL;
@@ -203,12 +249,20 @@ OpenAPI_nf_profile_t *ogs_nnrf_nfm_build_nf_profile(
}
NFService = build_nf_service(nf_service);
ogs_expect_or_return_val(NFService, NULL);
if (!NFService) {
ogs_error("No NFService");
ogs_nnrf_nfm_free_nf_profile(NFProfile);
return NULL;
}
if (OGS_SBI_FEATURES_IS_SET(
supported_features, OGS_SBI_NNRF_NFM_SERVICE_MAP)) {
NFServiceMap = OpenAPI_map_create(nf_service->id, NFService);
ogs_assert(NFServiceMap);
if (!NFServiceMap) {
ogs_error("No NFServiceMap");
ogs_nnrf_nfm_free_nf_profile(NFProfile);
return NULL;
}
OpenAPI_list_add(NFServiceList, NFServiceMap);
} else {
@@ -216,16 +270,6 @@ OpenAPI_nf_profile_t *ogs_nnrf_nfm_build_nf_profile(
}
}
if (NFServiceList->count) {
if (OGS_SBI_FEATURES_IS_SET(
supported_features, OGS_SBI_NNRF_NFM_SERVICE_MAP)) {
NFProfile->nf_service_list = NFServiceList;
} else {
NFProfile->nf_services = NFServiceList;
}
} else
OpenAPI_list_free(NFServiceList);
InfoList = OpenAPI_list_create();
ogs_assert(InfoList);
@@ -240,7 +284,7 @@ OpenAPI_nf_profile_t *ogs_nnrf_nfm_build_nf_profile(
}
SmfInfo = build_smf_info(nf_info);
ogs_expect_or_return_val(SmfInfo, NULL);
ogs_assert(SmfInfo);
InfoMap = OpenAPI_map_create(
ogs_msprintf("%d", ++InfoMapKey), SmfInfo);
@@ -250,7 +294,7 @@ OpenAPI_nf_profile_t *ogs_nnrf_nfm_build_nf_profile(
} else if (nf_info->nf_type == OpenAPI_nf_type_AMF) {
AmfInfo = build_amf_info(nf_info);
ogs_expect_or_return_val(AmfInfo, NULL);
ogs_assert(AmfInfo);
InfoMap = OpenAPI_map_create(
ogs_msprintf("%d", ++InfoMapKey), AmfInfo);
@@ -390,37 +434,83 @@ static OpenAPI_nf_service_t *build_nf_service(
ogs_assert(nf_service->name);
NFService = ogs_calloc(1, sizeof(*NFService));
ogs_expect_or_return_val(NFService, NULL);
if (!NFService) {
ogs_error("No NFService");
return NULL;
}
NFService->service_instance_id = ogs_strdup(nf_service->id);
ogs_expect_or_return_val(NFService->service_instance_id, NULL);
if (!NFService->service_instance_id) {
ogs_error("No service_instance_id");
free_nf_service(NFService);
return NULL;
}
NFService->service_name = ogs_strdup(nf_service->name);
ogs_expect_or_return_val(NFService->service_name, NULL);
if (!NFService->service_name) {
ogs_error("No service_name");
free_nf_service(NFService);
return NULL;
}
VersionList = OpenAPI_list_create();
ogs_assert(VersionList);
if (!VersionList) {
ogs_error("No VersionList");
free_nf_service(NFService);
return NULL;
}
for (i = 0; i < nf_service->num_of_version; i++) {
OpenAPI_nf_service_version_t *NFServiceVersion = NULL;
NFServiceVersion = ogs_calloc(1, sizeof(*NFServiceVersion));
ogs_expect_or_return_val(NFServiceVersion, NULL);
if (!NFServiceVersion) {
ogs_error("No NFServiceVersion");
free_nf_service(NFService);
OpenAPI_list_free(VersionList);
return NULL;
}
if (nf_service->version[i].in_uri) {
NFServiceVersion->api_version_in_uri =
ogs_strdup(nf_service->version[i].in_uri);
ogs_expect_or_return_val(
NFServiceVersion->api_version_in_uri, NULL);
if (!NFServiceVersion->api_version_in_uri) {
ogs_error("No api_version_in_uri");
if (NFServiceVersion)
ogs_free(NFServiceVersion);
free_nf_service(NFService);
OpenAPI_list_free(VersionList);
return NULL;
}
}
if (nf_service->version[i].full) {
NFServiceVersion->api_full_version =
ogs_strdup(nf_service->version[i].full);
ogs_expect_or_return_val(
NFServiceVersion->api_full_version, NULL);
if (!NFServiceVersion->api_full_version) {
ogs_error("No api_full_version");
if (NFServiceVersion) {
if (NFServiceVersion->api_version_in_uri)
ogs_free(NFServiceVersion->api_version_in_uri);
ogs_free(NFServiceVersion);
}
free_nf_service(NFService);
OpenAPI_list_free(VersionList);
return NULL;
}
}
if (nf_service->version[i].expiry) {
NFServiceVersion->expiry =
ogs_strdup(nf_service->version[i].expiry);
ogs_expect_or_return_val(
NFServiceVersion->expiry, NULL);
if (!NFServiceVersion->expiry) {
ogs_error("No expiry");
if (NFServiceVersion) {
if (NFServiceVersion->api_version_in_uri)
ogs_free(NFServiceVersion->api_version_in_uri);
if (NFServiceVersion->api_full_version)
ogs_free(NFServiceVersion->api_full_version);
ogs_free(NFServiceVersion);
}
free_nf_service(NFService);
OpenAPI_list_free(VersionList);
return NULL;
}
}
OpenAPI_list_add(VersionList, NFServiceVersion);
@@ -436,7 +526,11 @@ static OpenAPI_nf_service_t *build_nf_service(
NFService->fqdn = ogs_strdup(nf_service->fqdn);
IpEndPointList = OpenAPI_list_create();
ogs_assert(IpEndPointList);
if (!IpEndPointList) {
ogs_error("No IpEndPointList");
free_nf_service(NFService);
return NULL;
}
for (i = 0; i < nf_service->num_of_addr; i++) {
ogs_sockaddr_t *ipv4 = NULL;
@@ -449,14 +543,36 @@ static OpenAPI_nf_service_t *build_nf_service(
if (ipv4 || ipv6) {
IpEndPoint = ogs_calloc(1, sizeof(*IpEndPoint));
ogs_expect_or_return_val(IpEndPoint, NULL);
if (!IpEndPoint) {
ogs_error("No IpEndPoint");
free_nf_service(NFService);
OpenAPI_list_free(IpEndPointList);
return NULL;
}
if (ipv4) {
IpEndPoint->ipv4_address = ogs_ipstrdup(ipv4);
ogs_expect_or_return_val(IpEndPoint->ipv4_address, NULL);
if (!IpEndPoint->ipv4_address) {
ogs_error("No ipv4_address");
if (IpEndPoint)
ogs_free(IpEndPoint);
free_nf_service(NFService);
OpenAPI_list_free(IpEndPointList);
return NULL;
}
}
if (ipv6) {
IpEndPoint->ipv6_address = ogs_ipstrdup(ipv6);
ogs_expect_or_return_val(IpEndPoint->ipv6_address, NULL);
if (!IpEndPoint->ipv6_address) {
ogs_error("No ipv6_address");
if (IpEndPoint) {
if (IpEndPoint->ipv4_address)
ogs_free(IpEndPoint->ipv4_address);
ogs_free(IpEndPoint);
}
free_nf_service(NFService);
OpenAPI_list_free(IpEndPointList);
return NULL;
}
}
IpEndPoint->is_port = true;
IpEndPoint->port = nf_service->addr[i].port;
@@ -470,7 +586,11 @@ static OpenAPI_nf_service_t *build_nf_service(
OpenAPI_list_free(IpEndPointList);
AllowedNfTypeList = OpenAPI_list_create();
ogs_assert(AllowedNfTypeList);
if (!AllowedNfTypeList) {
ogs_error("No AllowedNfTypeList");
free_nf_service(NFService);
return NULL;
}
for (i = 0; i < nf_service->num_of_allowed_nf_type; i++) {
OpenAPI_list_add(AllowedNfTypeList,
@@ -552,38 +672,52 @@ static OpenAPI_smf_info_t *build_smf_info(ogs_sbi_nf_info_t *nf_info)
ogs_assert(nf_info);
SmfInfo = ogs_calloc(1, sizeof(*SmfInfo));
ogs_expect_or_return_val(SmfInfo, NULL);
if (!SmfInfo) {
ogs_error("No SmfInfo");
return NULL;
}
sNssaiSmfInfoList = OpenAPI_list_create();
ogs_assert(sNssaiSmfInfoList);
if (!sNssaiSmfInfoList) {
ogs_error("No sNssaiSmfInfoList");
free_smf_info(SmfInfo);
return NULL;
}
for (i = 0; i < nf_info->smf.num_of_slice; i++) {
DnnSmfInfoList = OpenAPI_list_create();
ogs_assert(DnnSmfInfoList);
if (!DnnSmfInfoList) {
ogs_error("No DnnSmfInfoList");
free_smf_info(SmfInfo);
OpenAPI_list_free(sNssaiSmfInfoList);
return NULL;
}
for (j = 0; j < nf_info->smf.slice[i].num_of_dnn; j++) {
DnnSmfInfoItem = ogs_calloc(1, sizeof(*DnnSmfInfoItem));
ogs_expect_or_return_val(DnnSmfInfoItem, NULL);
ogs_assert(DnnSmfInfoItem);
DnnSmfInfoItem->dnn = nf_info->smf.slice[i].dnn[j];
OpenAPI_list_add(DnnSmfInfoList, DnnSmfInfoItem);
}
if (!DnnSmfInfoList->count) {
OpenAPI_list_free(DnnSmfInfoList);
ogs_error("CHECK CONFIGURATION: No DNN");
ogs_expect_or_return_val(0, NULL);
OpenAPI_list_free(DnnSmfInfoList);
free_smf_info(SmfInfo);
OpenAPI_list_free(sNssaiSmfInfoList);
return NULL;
}
sNssaiSmfInfoItem = ogs_calloc(1, sizeof(*sNssaiSmfInfoItem));
ogs_expect_or_return_val(sNssaiSmfInfoItem, NULL);
ogs_assert(sNssaiSmfInfoItem);
sNssaiSmfInfoItem->dnn_smf_info_list = DnnSmfInfoList;
sNssaiSmfInfoItem->s_nssai = sNssai =
ogs_calloc(1, sizeof(*sNssai));
ogs_expect_or_return_val(sNssai, NULL);
sNssaiSmfInfoItem->s_nssai = sNssai = ogs_calloc(1, sizeof(*sNssai));
ogs_assert(sNssai);
sNssai->sst = nf_info->smf.slice[i].s_nssai.sst;
sNssai->sd =
ogs_s_nssai_sd_to_string(nf_info->smf.slice[i].s_nssai.sd);
@@ -597,17 +731,43 @@ static OpenAPI_smf_info_t *build_smf_info(ogs_sbi_nf_info_t *nf_info)
OpenAPI_list_free(sNssaiSmfInfoList);
TaiList = OpenAPI_list_create();
ogs_assert(TaiList);
if (!TaiList) {
ogs_error("No TaiList");
free_smf_info(SmfInfo);
return NULL;
}
for (i = 0; i < nf_info->smf.num_of_nr_tai; i++) {
TaiItem = ogs_calloc(1, sizeof(*TaiItem));
ogs_expect_or_return_val(TaiItem, NULL);
if (!TaiItem) {
ogs_error("No TaiItem");
free_smf_info(SmfInfo);
OpenAPI_list_free(TaiList);
return NULL;
}
TaiItem->plmn_id = ogs_sbi_build_plmn_id(
&nf_info->smf.nr_tai[i].plmn_id);
ogs_expect_or_return_val(TaiItem->plmn_id, NULL);
if (!TaiItem->plmn_id) {
ogs_error("No TaiItem->plmn_id");
if (TaiItem)
ogs_free(TaiItem);
free_smf_info(SmfInfo);
OpenAPI_list_free(TaiList);
return NULL;
}
TaiItem->tac =
ogs_uint24_to_0string(nf_info->smf.nr_tai[i].tac);
ogs_expect_or_return_val(TaiItem->tac, NULL);
if (!TaiItem->tac) {
ogs_error("No TaiItem->tac");
if (TaiItem) {
if (TaiItem->plmn_id)
ogs_free(TaiItem->plmn_id);
ogs_free(TaiItem);
}
free_smf_info(SmfInfo);
OpenAPI_list_free(TaiList);
return NULL;
}
OpenAPI_list_add(TaiList, TaiItem);
}
@@ -618,42 +778,54 @@ static OpenAPI_smf_info_t *build_smf_info(ogs_sbi_nf_info_t *nf_info)
OpenAPI_list_free(TaiList);
TaiRangeList = OpenAPI_list_create();
ogs_assert(TaiRangeList);
if (!TaiRangeList) {
ogs_error("No TaiRangeList");
free_smf_info(SmfInfo);
return NULL;
}
for (i = 0; i < nf_info->smf.num_of_nr_tai_range; i++) {
TacRangeList = OpenAPI_list_create();
ogs_assert(TacRangeList);
if (!TacRangeList) {
ogs_error("No TacRangeList");
free_smf_info(SmfInfo);
OpenAPI_list_free(TaiRangeList);
return NULL;
}
for (j = 0;
j < nf_info->smf.nr_tai_range[i].num_of_tac_range;
j++) {
TacRangeItem = ogs_calloc(1, sizeof(*TacRangeItem));
ogs_expect_or_return_val(TacRangeItem, NULL);
ogs_assert(TacRangeItem);
TacRangeItem->start = ogs_uint24_to_0string(
nf_info->smf.nr_tai_range[i].start[j]);
ogs_expect_or_return_val(TacRangeItem->start, NULL);
ogs_assert(TacRangeItem->start);
TacRangeItem->end =
ogs_uint24_to_0string(
nf_info->smf.nr_tai_range[i].end[j]);
ogs_expect_or_return_val(TacRangeItem->end, NULL);
ogs_assert(TacRangeItem->end);
OpenAPI_list_add(TacRangeList, TacRangeItem);
}
if (!TacRangeList->count) {
OpenAPI_list_free(TacRangeList);
ogs_error("CHECK CONFIGURATION: No Start/End in TacRange");
ogs_expect_or_return_val(0, NULL);
OpenAPI_list_free(TacRangeList);
free_smf_info(SmfInfo);
OpenAPI_list_free(TaiRangeList);
return NULL;
}
TaiRangeItem = ogs_calloc(1, sizeof(*TaiRangeItem));
ogs_expect_or_return_val(TaiRangeItem, NULL);
ogs_assert(TaiRangeItem);
TaiRangeItem->plmn_id = ogs_sbi_build_plmn_id(
&nf_info->smf.nr_tai_range[i].plmn_id);
ogs_expect_or_return_val(TaiRangeItem->plmn_id, NULL);
ogs_assert(TaiRangeItem->plmn_id);
TaiRangeItem->tac_range_list = TacRangeList;
@@ -686,25 +858,64 @@ static OpenAPI_amf_info_t *build_amf_info(ogs_sbi_nf_info_t *nf_info)
ogs_assert(nf_info);
AmfInfo = ogs_calloc(1, sizeof(*AmfInfo));
ogs_expect_or_return_val(AmfInfo, NULL);
if (!AmfInfo) {
ogs_error("No AmfInfo");
return NULL;
}
AmfInfo->amf_set_id = ogs_msprintf("%03x", nf_info->amf.amf_set_id);
if (!AmfInfo->amf_set_id) {
ogs_error("No amf_set_id");
free_amf_info(AmfInfo);
return NULL;
}
AmfInfo->amf_region_id = ogs_msprintf("%02x", nf_info->amf.amf_region_id);
if (!AmfInfo->amf_region_id) {
ogs_error("No amf_region_id");
free_amf_info(AmfInfo);
return NULL;
}
guamiAmfInfoList = OpenAPI_list_create();
ogs_assert(guamiAmfInfoList);
if (!guamiAmfInfoList) {
ogs_error("No guamiAmfInfoList");
free_amf_info(AmfInfo);
return NULL;
}
for (i = 0; i < nf_info->amf.num_of_guami; i++) {
guamiAmfInfoItem = ogs_calloc(1, sizeof(*guamiAmfInfoItem));
ogs_expect_or_return_val(guamiAmfInfoItem, NULL);
if (!guamiAmfInfoItem) {
ogs_error("guamiAmfInfoItem");
free_amf_info(AmfInfo);
OpenAPI_list_free(guamiAmfInfoList);
return NULL;
}
guamiAmfInfoItem->plmn_id =
ogs_sbi_build_plmn_id_nid(&nf_info->amf.guami[i].plmn_id);
ogs_expect_or_return_val(guamiAmfInfoItem->plmn_id, NULL);
if (!guamiAmfInfoItem->plmn_id) {
ogs_error("guamiAmfInfoItem->plmn_id");
if (guamiAmfInfoItem)
ogs_free(guamiAmfInfoItem);
free_amf_info(AmfInfo);
OpenAPI_list_free(guamiAmfInfoList);
return NULL;
}
guamiAmfInfoItem->amf_id =
ogs_amf_id_to_string(&nf_info->amf.guami[i].amf_id);
ogs_expect_or_return_val(guamiAmfInfoItem->amf_id, NULL);
if (!guamiAmfInfoItem->amf_id) {
ogs_error("guamiAmfInfoItem->amf_id");
if (guamiAmfInfoItem) {
if (guamiAmfInfoItem->plmn_id)
ogs_free(guamiAmfInfoItem->plmn_id);
ogs_free(guamiAmfInfoItem);
}
free_amf_info(AmfInfo);
OpenAPI_list_free(guamiAmfInfoList);
return NULL;
}
OpenAPI_list_add(guamiAmfInfoList, guamiAmfInfoItem);
}
@@ -715,17 +926,43 @@ static OpenAPI_amf_info_t *build_amf_info(ogs_sbi_nf_info_t *nf_info)
OpenAPI_list_free(guamiAmfInfoList);
TaiList = OpenAPI_list_create();
ogs_assert(TaiList);
if (!TaiList) {
ogs_error("No TaiList");
free_amf_info(AmfInfo);
return NULL;
}
for (i = 0; i < nf_info->amf.num_of_nr_tai; i++) {
TaiItem = ogs_calloc(1, sizeof(*TaiItem));
ogs_expect_or_return_val(TaiItem, NULL);
if (!TaiList) {
ogs_error("No TaiItem");
free_amf_info(AmfInfo);
OpenAPI_list_free(TaiList);
return NULL;
}
TaiItem->plmn_id = ogs_sbi_build_plmn_id(
&nf_info->amf.nr_tai[i].plmn_id);
ogs_expect_or_return_val(TaiItem->plmn_id, NULL);
if (!TaiItem->plmn_id) {
ogs_error("No TaiItem->plmn_id");
if (TaiItem)
ogs_free(TaiItem);
free_amf_info(AmfInfo);
OpenAPI_list_free(TaiList);
return NULL;
}
TaiItem->tac =
ogs_uint24_to_0string(nf_info->amf.nr_tai[i].tac);
ogs_expect_or_return_val(TaiItem->tac, NULL);
if (!TaiItem->tac) {
ogs_error("No TaiItem->tac");
if (TaiItem) {
if (TaiItem->plmn_id)
ogs_free(TaiItem->plmn_id);
ogs_free(TaiItem);
}
free_amf_info(AmfInfo);
OpenAPI_list_free(TaiList);
return NULL;
}
OpenAPI_list_add(TaiList, TaiItem);
}
@@ -736,42 +973,65 @@ static OpenAPI_amf_info_t *build_amf_info(ogs_sbi_nf_info_t *nf_info)
OpenAPI_list_free(TaiList);
TaiRangeList = OpenAPI_list_create();
ogs_assert(TaiRangeList);
if (!TaiRangeList) {
ogs_error("No TaiRangeList");
free_amf_info(AmfInfo);
return NULL;
}
for (i = 0; i < nf_info->amf.num_of_nr_tai_range; i++) {
TacRangeList = OpenAPI_list_create();
ogs_assert(TacRangeList);
if (!TacRangeList) {
ogs_error("No TacRangeList");
free_amf_info(AmfInfo);
OpenAPI_list_free(TaiRangeList);
return NULL;
}
for (j = 0;
j < nf_info->amf.nr_tai_range[i].num_of_tac_range;
j++) {
TacRangeItem = ogs_calloc(1, sizeof(*TacRangeItem));
ogs_expect_or_return_val(TacRangeItem, NULL);
ogs_assert(TacRangeItem);
TacRangeItem->start = ogs_uint24_to_0string(
nf_info->amf.nr_tai_range[i].start[j]);
ogs_expect_or_return_val(TacRangeItem->start, NULL);
ogs_assert(TacRangeItem->start);
TacRangeItem->end =
ogs_uint24_to_0string(
nf_info->amf.nr_tai_range[i].end[j]);
ogs_expect_or_return_val(TacRangeItem->end, NULL);
ogs_assert(TacRangeItem->end);
OpenAPI_list_add(TacRangeList, TacRangeItem);
}
if (!TacRangeList->count) {
OpenAPI_list_free(TacRangeList);
ogs_error("CHECK CONFIGURATION: No Start/End in TacRange");
ogs_expect_or_return_val(0, NULL);
OpenAPI_list_free(TacRangeList);
free_amf_info(AmfInfo);
OpenAPI_list_free(TaiRangeList);
return NULL;
}
TaiRangeItem = ogs_calloc(1, sizeof(*TaiRangeItem));
ogs_expect_or_return_val(TaiRangeItem, NULL);
if (!TaiRangeItem) {
ogs_error("No TaiRangeItem");
free_amf_info(AmfInfo);
OpenAPI_list_free(TaiRangeList);
return NULL;
}
TaiRangeItem->plmn_id = ogs_sbi_build_plmn_id(
&nf_info->amf.nr_tai_range[i].plmn_id);
ogs_expect_or_return_val(TaiRangeItem->plmn_id, NULL);
if (!TaiRangeItem->plmn_id) {
ogs_error("No TaiRangeItem->plmn_id");
ogs_free(TaiRangeItem);
free_amf_info(AmfInfo);
OpenAPI_list_free(TaiRangeList);
return NULL;
}
TaiRangeItem->tac_range_list = TacRangeList;
@@ -885,8 +1145,10 @@ static void free_amf_info(OpenAPI_amf_info_t *AmfInfo)
ogs_assert(AmfInfo);
ogs_free(AmfInfo->amf_set_id);
ogs_free(AmfInfo->amf_region_id);
if (AmfInfo->amf_set_id)
ogs_free(AmfInfo->amf_set_id);
if (AmfInfo->amf_region_id)
ogs_free(AmfInfo->amf_region_id);
guamiAmfInfoList = AmfInfo->guami_list;
OpenAPI_list_for_each(guamiAmfInfoList, node) {
@@ -972,21 +1234,29 @@ ogs_sbi_request_t *ogs_nnrf_nfm_build_update(void)
message.http.content_type = (char *)OGS_SBI_CONTENT_PATCH_TYPE;
PatchItemList = OpenAPI_list_create();
ogs_assert(PatchItemList);
if (!PatchItemList) {
ogs_error("No PatchItemList");
goto end;
}
memset(&item, 0, sizeof(item));
item.op = OpenAPI_patch_operation_replace;
item.path = (char *)"/nfStatus";
item.value = OpenAPI_any_type_create_string(
OpenAPI_nf_status_ToString(OpenAPI_nf_status_REGISTERED));
ogs_assert(item.value);
if (!item.value) {
ogs_error("No item.value");
goto end;
}
OpenAPI_list_add(PatchItemList, &item);
message.PatchItemList = PatchItemList;
request = ogs_sbi_build_request(&message);
ogs_expect(request);
end:
OpenAPI_list_free(PatchItemList);
OpenAPI_any_type_free(item.value);
@@ -1013,6 +1283,7 @@ ogs_sbi_request_t *ogs_nnrf_nfm_build_de_register(void)
message.h.resource.component[1] = nf_instance->id;
request = ogs_sbi_build_request(&message);
ogs_expect(request);
return request;
}
@@ -1039,10 +1310,16 @@ ogs_sbi_request_t *ogs_nnrf_nfm_build_status_subscribe(
(char *)OGS_SBI_RESOURCE_NAME_SUBSCRIPTIONS;
SubscriptionData = ogs_calloc(1, sizeof(*SubscriptionData));
ogs_expect_or_return_val(SubscriptionData, NULL);
if (!SubscriptionData) {
ogs_error("No SubscriptionData");
goto end;
}
server = ogs_list_first(&ogs_sbi_self()->server_list);
ogs_expect_or_return_val(server, NULL);
if (!server) {
ogs_error("No server");
goto end;
}
memset(&header, 0, sizeof(header));
header.service.name = (char *)OGS_SBI_SERVICE_NAME_NNRF_NFM;
@@ -1051,8 +1328,10 @@ ogs_sbi_request_t *ogs_nnrf_nfm_build_status_subscribe(
(char *)OGS_SBI_RESOURCE_NAME_NF_STATUS_NOTIFY;
SubscriptionData->nf_status_notification_uri =
ogs_sbi_server_uri(server, &header);
ogs_expect_or_return_val(
SubscriptionData->nf_status_notification_uri, NULL);
if (!SubscriptionData->nf_status_notification_uri) {
ogs_error("No nf_status_notification_uri");
goto end;
}
SubscriptionData->req_nf_type = subscription_data->req_nf_type;
SubscriptionData->req_nf_instance_id =
@@ -1062,7 +1341,10 @@ ogs_sbi_request_t *ogs_nnrf_nfm_build_status_subscribe(
OGS_SBI_NNRF_NFM_SERVICE_MAP);
SubscriptionData->requester_features =
ogs_uint64_to_string(subscription_data->requester_features);
ogs_expect_or_return_val(SubscriptionData->requester_features, NULL);
if (!SubscriptionData->requester_features) {
ogs_error("No requester_features");
goto end;
}
memset(&SubscrCond, 0, sizeof(SubscrCond));
if (subscription_data->subscr_cond.nf_type) {
@@ -1076,11 +1358,20 @@ ogs_sbi_request_t *ogs_nnrf_nfm_build_status_subscribe(
message.SubscriptionData = SubscriptionData;
request = ogs_sbi_build_request(&message);
message.http.custom.callback =
(char *)OGS_SBI_CALLBACK_NNRF_NFMANAGEMENT_NF_STATUS_NOTIFY;
ogs_free(SubscriptionData->nf_status_notification_uri);
ogs_free(SubscriptionData->requester_features);
ogs_free(SubscriptionData);
request = ogs_sbi_build_request(&message);
ogs_expect(request);
end:
if (SubscriptionData) {
if (SubscriptionData->nf_status_notification_uri)
ogs_free(SubscriptionData->nf_status_notification_uri);
if (SubscriptionData->requester_features)
ogs_free(SubscriptionData->requester_features);
ogs_free(SubscriptionData);
}
return request;
}
@@ -1102,7 +1393,11 @@ ogs_sbi_request_t *ogs_nnrf_nfm_build_status_unsubscribe(
(char *)OGS_SBI_RESOURCE_NAME_SUBSCRIPTIONS;
message.h.resource.component[1] = subscription_data->id;
message.http.custom.callback =
(char *)OGS_SBI_CALLBACK_NNRF_NFMANAGEMENT_NF_STATUS_NOTIFY;
request = ogs_sbi_build_request(&message);
ogs_expect(request);
return request;
}
@@ -1123,23 +1418,20 @@ ogs_sbi_request_t *ogs_nnrf_nfm_build_profile_retrieve(char *nf_instance_id)
message.h.resource.component[1] = nf_instance_id;
request = ogs_sbi_build_request(&message);
ogs_expect(request);
return request;
}
ogs_sbi_request_t *ogs_nnrf_disc_build_discover(
OpenAPI_nf_type_e target_nf_type,
OpenAPI_nf_type_e requester_nf_type,
ogs_sbi_discovery_option_t *discovery_option)
{
ogs_sbi_message_t message;
ogs_sbi_request_t *request = NULL;
OpenAPI_nf_type_e requester_nf_type = OpenAPI_nf_type_NULL;
ogs_assert(target_nf_type);
ogs_assert(ogs_sbi_self()->nf_instance);
requester_nf_type = ogs_sbi_self()->nf_instance->nf_type;
ogs_assert(requester_nf_type);
memset(&message, 0, sizeof(message));
@@ -1155,6 +1447,7 @@ ogs_sbi_request_t *ogs_nnrf_disc_build_discover(
message.param.discovery_option = discovery_option;
request = ogs_sbi_build_request(&message);
ogs_expect(request);
return request;
}

View File

@@ -43,6 +43,7 @@ ogs_sbi_request_t *ogs_nnrf_nfm_build_profile_retrieve(char *nf_instance_id);
ogs_sbi_request_t *ogs_nnrf_disc_build_discover(
OpenAPI_nf_type_e target_nf_type,
OpenAPI_nf_type_e requester_nf_type,
ogs_sbi_discovery_option_t *discovery_option);
#ifdef __cplusplus

View File

@@ -24,16 +24,13 @@ static void handle_nf_service(
static void handle_smf_info(
ogs_sbi_nf_instance_t *nf_instance, OpenAPI_smf_info_t *SmfInfo);
void ogs_sbi_nnrf_handle_nf_register(
void ogs_nnrf_nfm_handle_nf_register(
ogs_sbi_nf_instance_t *nf_instance, ogs_sbi_message_t *recvmsg)
{
OpenAPI_nf_profile_t *NFProfile = NULL;
ogs_sbi_client_t *client = NULL;
ogs_assert(recvmsg);
ogs_assert(nf_instance);
client = nf_instance->client;
ogs_assert(client);
NFProfile = recvmsg->NFProfile;
if (!NFProfile) {
@@ -46,7 +43,7 @@ void ogs_sbi_nnrf_handle_nf_register(
nf_instance->time.heartbeat_interval = NFProfile->heart_beat_timer;
}
void ogs_sbi_nnrf_handle_nf_profile(
void ogs_nnrf_nfm_handle_nf_profile(
ogs_sbi_nf_instance_t *nf_instance, OpenAPI_nf_profile_t *NFProfile)
{
int rv;
@@ -451,17 +448,14 @@ static void handle_smf_info(
}
}
void ogs_nnrf_handle_nf_status_subscribe(
void ogs_nnrf_nfm_handle_nf_status_subscribe(
ogs_sbi_subscription_data_t *subscription_data,
ogs_sbi_message_t *recvmsg)
{
OpenAPI_subscription_data_t *SubscriptionData = NULL;
ogs_sbi_client_t *client = NULL;
ogs_assert(recvmsg);
ogs_assert(subscription_data);
client = subscription_data->client;
ogs_assert(client);
SubscriptionData = recvmsg->SubscriptionData;
if (!SubscriptionData) {
@@ -506,7 +500,7 @@ void ogs_nnrf_handle_nf_status_subscribe(
}
}
bool ogs_nnrf_handle_nf_status_notify(
bool ogs_nnrf_nfm_handle_nf_status_notify(
ogs_sbi_stream_t *stream, ogs_sbi_message_t *recvmsg)
{
int rv;
@@ -633,7 +627,7 @@ bool ogs_nnrf_handle_nf_status_notify(
message.h.resource.component[1]);
}
ogs_sbi_nnrf_handle_nf_profile(nf_instance, NFProfile);
ogs_nnrf_nfm_handle_nf_profile(nf_instance, NFProfile);
ogs_info("[%s] (NRF-notify) NF Profile updated", nf_instance->id);
@@ -685,7 +679,7 @@ bool ogs_nnrf_handle_nf_status_notify(
return true;
}
void ogs_nnrf_handle_nf_discover_search_result(
void ogs_nnrf_disc_handle_nf_discover_search_result(
OpenAPI_search_result_t *SearchResult)
{
OpenAPI_lnode_t *node = NULL;
@@ -737,7 +731,7 @@ void ogs_nnrf_handle_nf_discover_search_result(
}
if (NF_INSTANCE_ID_IS_OTHERS(nf_instance->id)) {
ogs_sbi_nnrf_handle_nf_profile(nf_instance, NFProfile);
ogs_nnrf_nfm_handle_nf_profile(nf_instance, NFProfile);
ogs_sbi_client_associate(nf_instance);

View File

@@ -24,18 +24,18 @@
extern "C" {
#endif
void ogs_sbi_nnrf_handle_nf_register(
void ogs_nnrf_nfm_handle_nf_register(
ogs_sbi_nf_instance_t *nf_instance, ogs_sbi_message_t *recvmsg);
void ogs_sbi_nnrf_handle_nf_profile(
void ogs_nnrf_nfm_handle_nf_profile(
ogs_sbi_nf_instance_t *nf_instance, OpenAPI_nf_profile_t *NFProfile);
void ogs_nnrf_handle_nf_status_subscribe(
void ogs_nnrf_nfm_handle_nf_status_subscribe(
ogs_sbi_subscription_data_t *subscription_data,
ogs_sbi_message_t *recvmsg);
bool ogs_nnrf_handle_nf_status_notify(
bool ogs_nnrf_nfm_handle_nf_status_notify(
ogs_sbi_stream_t *stream, ogs_sbi_message_t *recvmsg);
void ogs_nnrf_handle_nf_discover_search_result(
void ogs_nnrf_disc_handle_nf_discover_search_result(
OpenAPI_search_result_t *SearchResult);
#ifdef __cplusplus

144
lib/sbi/nnrf-path.c Normal file
View File

@@ -0,0 +1,144 @@
/*
* Copyright (C) 2022 by Sukchan Lee <acetcom@gmail.com>
*
* 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 <https://www.gnu.org/licenses/>.
*/
#include "ogs-sbi.h"
bool ogs_nnrf_nfm_send_nf_register(ogs_sbi_nf_instance_t *nf_instance)
{
bool rc;
ogs_sbi_request_t *request = NULL;
ogs_assert(nf_instance);
request = ogs_nnrf_nfm_build_register();
if (!request) {
ogs_error("No Request");
return false;
}
rc = ogs_sbi_send_notification_request(
OGS_SBI_SERVICE_TYPE_NNRF_NFM, NULL, request, nf_instance);
ogs_expect(rc == true);
ogs_sbi_request_free(request);
return rc;
}
bool ogs_nnrf_nfm_send_nf_update(ogs_sbi_nf_instance_t *nf_instance)
{
bool rc;
ogs_sbi_request_t *request = NULL;
ogs_assert(nf_instance);
request = ogs_nnrf_nfm_build_update();
if (!request) {
ogs_error("No Request");
return false;
}
rc = ogs_sbi_send_notification_request(
OGS_SBI_SERVICE_TYPE_NNRF_NFM, NULL, request, nf_instance);
ogs_expect(rc == true);
ogs_sbi_request_free(request);
return rc;
}
bool ogs_nnrf_nfm_send_nf_de_register(ogs_sbi_nf_instance_t *nf_instance)
{
bool rc;
ogs_sbi_request_t *request = NULL;
ogs_assert(nf_instance);
request = ogs_nnrf_nfm_build_de_register();
if (!request) {
ogs_error("No Request");
return false;
}
rc = ogs_sbi_send_notification_request(
OGS_SBI_SERVICE_TYPE_NNRF_NFM, NULL, request, nf_instance);
ogs_expect(rc == true);
ogs_sbi_request_free(request);
return rc;
}
bool ogs_nnrf_nfm_send_nf_status_subscribe(
OpenAPI_nf_type_e req_nf_type, char *req_nf_instance_id,
OpenAPI_nf_type_e subscr_cond_nf_type,
char *subscr_cond_service_name)
{
bool rc;
ogs_sbi_request_t *request = NULL;
ogs_sbi_subscription_data_t *subscription_data = NULL;
subscription_data = ogs_sbi_subscription_data_add();
ogs_assert(subscription_data);
subscription_data->req_nf_type = req_nf_type;
if (req_nf_instance_id)
subscription_data->req_nf_instance_id = ogs_strdup(req_nf_instance_id);
subscription_data->subscr_cond.nf_type = subscr_cond_nf_type;
if (subscr_cond_service_name)
subscription_data->subscr_cond.service_name =
ogs_strdup(subscr_cond_service_name);
request = ogs_nnrf_nfm_build_status_subscribe(subscription_data);
if (!request) {
ogs_error("No Request");
return false;
}
rc = ogs_sbi_send_notification_request(
OGS_SBI_SERVICE_TYPE_NNRF_NFM, NULL, request, subscription_data);
ogs_expect(rc == true);
ogs_sbi_request_free(request);
return rc;
}
bool ogs_nnrf_nfm_send_nf_status_unsubscribe(
ogs_sbi_subscription_data_t *subscription_data)
{
bool rc;
ogs_sbi_request_t *request = NULL;
ogs_assert(subscription_data);
request = ogs_nnrf_nfm_build_status_unsubscribe(subscription_data);
if (!request) {
ogs_error("No Request");
return false;
}
rc = ogs_sbi_send_notification_request(
OGS_SBI_SERVICE_TYPE_NNRF_NFM, NULL, request, subscription_data);
ogs_expect(rc == true);
ogs_sbi_request_free(request);
return rc;
}

47
lib/sbi/nnrf-path.h Normal file
View File

@@ -0,0 +1,47 @@
/*
* Copyright (C) 2022 by Sukchan Lee <acetcom@gmail.com>
*
* 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 <https://www.gnu.org/licenses/>.
*/
#ifndef OGS_NNRF_PATH_H
#define OGS_NNRF_PATH_H
#include "nnrf-build.h"
#ifdef __cplusplus
extern "C" {
#endif
bool ogs_nnrf_nfm_send_nf_register(ogs_sbi_nf_instance_t *nf_instance);
bool ogs_nnrf_nfm_send_nf_update(ogs_sbi_nf_instance_t *nf_instance);
bool ogs_nnrf_nfm_send_nf_de_register(ogs_sbi_nf_instance_t *nf_instance);
bool ogs_nnrf_nfm_send_nf_status_subscribe(
OpenAPI_nf_type_e req_nf_type, char *req_nf_instance_id,
OpenAPI_nf_type_e subscr_cond_nf_type,
char *subscr_cond_service_name);
bool ogs_nnrf_nfm_send_nf_status_unsubscribe(
ogs_sbi_subscription_data_t *subscription_data);
bool ogs_nnrf_nfm_send_to_nrf(
ogs_sbi_client_t *client, ogs_sbi_client_cb_f client_cb,
ogs_sbi_request_t *request, void *data);
#ifdef __cplusplus
}
#endif
#endif /* OGS_NNRF_PATH_H */

View File

@@ -1,5 +1,5 @@
/*
* Copyright (C) 2019 by Sukchan Lee <acetcom@gmail.com>
* Copyright (C) 2019-2022 by Sukchan Lee <acetcom@gmail.com>
*
* This file is part of Open5GS.
*
@@ -75,6 +75,8 @@
#include "model/sm_policy_notification.h"
#include "model/termination_notification.h"
#include "model/deregistration_data.h"
#include "model/sdm_subscription.h"
#include "model/modification_notification.h"
#include "custom/links.h"
#include "custom/ue_authentication_ctx.h"
@@ -99,6 +101,7 @@
#include "sbi/nnrf-build.h"
#include "sbi/nnrf-handler.h"
#include "sbi/nnrf-path.h"
#include "sbi/path.h"

View File

@@ -1,5 +1,5 @@
/*
* Copyright (C) 2019,2020 by Sukchan Lee <acetcom@gmail.com>
* Copyright (C) 2019-2022 by Sukchan Lee <acetcom@gmail.com>
*
* This file is part of Open5GS.
*
@@ -19,11 +19,351 @@
#include "ogs-sbi.h"
bool ogs_sbi_send_request(ogs_sbi_nf_instance_t *nf_instance,
ogs_sbi_client_cb_f client_cb, ogs_sbi_xact_t *xact)
static void build_default_discovery_parameter(
ogs_sbi_request_t *request,
ogs_sbi_service_type_e service_type,
ogs_sbi_discovery_option_t *discovery_option);
int ogs_sbi_server_handler(ogs_sbi_request_t *request, void *data)
{
ogs_event_t *e = NULL;
int rv;
ogs_assert(request);
ogs_assert(data);
e = ogs_event_new(OGS_EVENT_SBI_SERVER);
ogs_assert(e);
e->sbi.request = request;
e->sbi.data = data;
rv = ogs_queue_push(ogs_app()->queue, e);
if (rv != OGS_OK) {
ogs_error("ogs_queue_push() failed:%d", (int)rv);
ogs_sbi_request_free(request);
ogs_event_free(e);
return OGS_ERROR;
}
return OGS_OK;
}
int ogs_sbi_client_handler(
int status, ogs_sbi_response_t *response, void *data)
{
ogs_event_t *e = NULL;
int rv;
if (status != OGS_OK) {
ogs_log_message(
status == OGS_DONE ? OGS_LOG_DEBUG : OGS_LOG_WARN, 0,
"ogs_sbi_client_handler() failed [%d]", status);
return OGS_ERROR;
}
ogs_assert(response);
e = ogs_event_new(OGS_EVENT_SBI_CLIENT);
ogs_assert(e);
e->sbi.response = response;
e->sbi.data = data;
rv = ogs_queue_push(ogs_app()->queue, e);
if (rv != OGS_OK) {
ogs_error("ogs_queue_push() failed:%d", (int)rv);
ogs_sbi_response_free(response);
ogs_event_free(e);
return OGS_ERROR;
}
return OGS_OK;
}
static int client_discover_cb(
int status, ogs_sbi_response_t *response, void *data)
{
int rv;
ogs_event_t *e = NULL;
ogs_sbi_xact_t *xact = NULL;
ogs_sbi_object_t *sbi_object = NULL;
ogs_sbi_service_type_e service_type = OGS_SBI_SERVICE_TYPE_NULL;
OpenAPI_nf_type_e target_nf_type = OpenAPI_nf_type_NULL;
OpenAPI_nf_type_e requester_nf_type = OpenAPI_nf_type_NULL;
ogs_hash_index_t *hi = NULL;
char *producer_id = NULL;
xact = data;
ogs_assert(xact);
xact = ogs_sbi_xact_cycle(xact);
if (!xact) {
ogs_error("SBI transaction has already been removed");
if (response)
ogs_sbi_response_free(response);
return OGS_ERROR;
}
sbi_object = xact->sbi_object;
ogs_assert(sbi_object);
service_type = xact->service_type;
ogs_assert(service_type);
target_nf_type = ogs_sbi_service_type_to_nf_type(service_type);
requester_nf_type = xact->requester_nf_type;
ogs_assert(requester_nf_type);
if (status != OGS_OK) {
ogs_log_message(
status == OGS_DONE ? OGS_LOG_DEBUG : OGS_LOG_WARN, 0,
"ogs_sbi_client_handler() failed [%d]", status);
ogs_sbi_xact_remove(xact);
return OGS_ERROR;
}
ogs_assert(response);
/* Check if 3gpp-Sbi-Producer-Id in HTTP2 Header */
for (hi = ogs_hash_first(response->http.headers);
hi; hi = ogs_hash_next(hi)) {
if (!ogs_strcasecmp(ogs_hash_this_key(hi), OGS_SBI_CUSTOM_PRODUCER_ID)) {
producer_id = ogs_hash_this_val(hi);
break;
}
}
/* Added newly discovered NF Instance */
if (producer_id) {
ogs_sbi_nf_instance_t *nf_instance =
ogs_sbi_nf_instance_find(producer_id);
if (!nf_instance) {
nf_instance = ogs_sbi_nf_instance_add();
ogs_assert(nf_instance);
ogs_sbi_nf_instance_set_id(nf_instance, producer_id);
ogs_sbi_nf_instance_set_type(nf_instance, target_nf_type);
}
OGS_SBI_SETUP_NF_INSTANCE(
sbi_object->service_type_array[service_type], nf_instance);
}
e = ogs_event_new(OGS_EVENT_SBI_CLIENT);
ogs_assert(e);
e->sbi.response = response;
e->sbi.data = data;
rv = ogs_queue_push(ogs_app()->queue, e);
if (rv != OGS_OK) {
ogs_error("ogs_queue_push() failed:%d", (int)rv);
ogs_sbi_response_free(response);
ogs_event_free(e);
return OGS_ERROR;
}
return OGS_OK;
}
bool ogs_sbi_discover_and_send(ogs_sbi_xact_t *xact)
{
ogs_sbi_client_t *client = NULL, *scp_client = NULL;
ogs_sbi_nf_instance_t *nf_instance = NULL;
ogs_sbi_object_t *sbi_object = NULL;
ogs_sbi_service_type_e service_type = OGS_SBI_SERVICE_TYPE_NULL;
ogs_sbi_discovery_option_t *discovery_option = NULL;
ogs_sbi_request_t *request = NULL;
OpenAPI_nf_type_e target_nf_type = OpenAPI_nf_type_NULL;
OpenAPI_nf_type_e requester_nf_type = OpenAPI_nf_type_NULL;
char *apiroot = NULL;
sbi_object = xact->sbi_object;
ogs_assert(sbi_object);
service_type = xact->service_type;
ogs_assert(service_type);
target_nf_type = ogs_sbi_service_type_to_nf_type(service_type);
ogs_assert(target_nf_type);
requester_nf_type = xact->requester_nf_type;
ogs_assert(requester_nf_type);
request = xact->request;
ogs_assert(request);
discovery_option = xact->discovery_option;
/* SCP Availability */
if (ogs_sbi_self()->discovery_config.delegated ==
OGS_SBI_DISCOVERY_DELEGATED_AUTO) {
scp_client = NF_INSTANCE_CLIENT(ogs_sbi_self()->scp_instance);
} else if (ogs_sbi_self()->discovery_config.delegated ==
OGS_SBI_DISCOVERY_DELEGATED_YES) {
scp_client = NF_INSTANCE_CLIENT(ogs_sbi_self()->scp_instance);
ogs_assert(scp_client);
}
/* Target NF-Instance */
nf_instance = sbi_object->service_type_array[service_type].nf_instance;
if (!nf_instance) {
nf_instance = ogs_sbi_nf_instance_find_by_discovery_param(
target_nf_type, requester_nf_type, discovery_option);
if (nf_instance)
OGS_SBI_SETUP_NF_INSTANCE(
sbi_object->service_type_array[service_type], nf_instance);
}
/* Target Client */
if (request->h.uri == NULL) {
if (nf_instance) {
client = ogs_sbi_client_find_by_service_name(nf_instance,
request->h.service.name, request->h.api.version);
}
} else {
ogs_sockaddr_t *addr = NULL;
addr = ogs_sbi_getaddr_from_uri(request->h.uri);
if (!addr) {
ogs_error("Invalid URL [%s]", request->h.uri);
return false;
}
client = ogs_sbi_client_find(addr);
ogs_freeaddrinfo(addr);
}
if (scp_client) {
/*************************
* INDIRECT COMMUNICATION
*************************/
build_default_discovery_parameter(
request, service_type, discovery_option);
if (client) {
/*
* If `client` instance is avaiable,
* 3gpp-Sbi-Target-apiRoot is added to HTTP header.
*/
apiroot = ogs_sbi_client_apiroot(client);
ogs_assert(apiroot);
ogs_sbi_header_set(request->http.headers,
OGS_SBI_CUSTOM_TARGET_APIROOT, apiroot);
ogs_free(apiroot);
ogs_expect_or_return_val(true ==
ogs_sbi_client_send_via_scp(
scp_client, ogs_sbi_client_handler, request, xact), false);
} else {
/*
* If no `client` instance,
*
* Discovery-*** is added to HTTP header.
*/
if (discovery_option &&
discovery_option->target_nf_instance_id) {
ogs_sbi_header_set(request->http.headers,
OGS_SBI_CUSTOM_DISCOVERY_TARGET_NF_INSTANCE_ID,
discovery_option->target_nf_instance_id);
} else if (nf_instance && nf_instance->id) {
ogs_sbi_header_set(request->http.headers,
OGS_SBI_CUSTOM_DISCOVERY_TARGET_NF_INSTANCE_ID,
nf_instance->id);
}
ogs_expect_or_return_val(true ==
ogs_sbi_client_send_via_scp(
scp_client, client_discover_cb, request, xact), false);
}
} else if (client) {
/***********************
* DIRECT COMMUNICATION
***********************/
/* If `client` instance is available, use direct communication */
ogs_expect_or_return_val(true ==
ogs_sbi_client_send_request(
client, ogs_sbi_client_handler, request, xact), false);
} else {
/**********************************************
* No SCP and Client, Use NRF for NF-Discovery
**********************************************/
return ogs_sbi_discover_only(xact);
}
return true;
}
bool ogs_sbi_discover_only(ogs_sbi_xact_t *xact)
{
ogs_sbi_nf_instance_t *nf_instance = NULL;
ogs_sbi_object_t *sbi_object = NULL;
ogs_sbi_service_type_e service_type = OGS_SBI_SERVICE_TYPE_NULL;
ogs_sbi_discovery_option_t *discovery_option = NULL;
OpenAPI_nf_type_e target_nf_type = OpenAPI_nf_type_NULL;
OpenAPI_nf_type_e requester_nf_type = OpenAPI_nf_type_NULL;
sbi_object = xact->sbi_object;
ogs_assert(sbi_object);
service_type = xact->service_type;
ogs_assert(service_type);
target_nf_type = ogs_sbi_service_type_to_nf_type(service_type);
ogs_assert(target_nf_type);
requester_nf_type = xact->requester_nf_type;
ogs_assert(requester_nf_type);
discovery_option = xact->discovery_option;
/* NRF NF-Instance */
nf_instance = sbi_object->nf_type_array[OpenAPI_nf_type_NRF].nf_instance;
if (!nf_instance) {
nf_instance = ogs_sbi_nf_instance_find_by_discovery_param(
OpenAPI_nf_type_NRF, requester_nf_type, NULL);
if (nf_instance)
OGS_SBI_SETUP_NF_INSTANCE(
sbi_object->nf_type_array[OpenAPI_nf_type_NRF], nf_instance);
}
if (nf_instance) {
bool rc;
ogs_sbi_client_t *client = NULL;
ogs_sbi_request_t *request = NULL;
ogs_warn("Try to discover [%s]",
ogs_sbi_service_type_to_name(service_type));
client = NF_INSTANCE_CLIENT(nf_instance);
ogs_expect_or_return_val(client, false);
request = ogs_nnrf_disc_build_discover(
target_nf_type, requester_nf_type, discovery_option);
ogs_expect_or_return_val(request, false);
rc = ogs_sbi_client_send_request(
client, ogs_sbi_client_handler, request, xact);
ogs_expect(rc == true);
ogs_sbi_request_free(request);
return rc;
}
ogs_error("Cannot discover [%s]",
ogs_sbi_service_type_to_name(service_type));
return false;
}
bool ogs_sbi_send_request_to_nf_instance(
ogs_sbi_nf_instance_t *nf_instance, ogs_sbi_xact_t *xact)
{
ogs_sbi_request_t *request = NULL;
ogs_sbi_client_t *client = NULL;
ogs_sbi_object_t *sbi_object = NULL;
ogs_assert(xact);
@@ -67,225 +407,119 @@ bool ogs_sbi_send_request(ogs_sbi_nf_instance_t *nf_instance,
ogs_freeaddrinfo(addr);
}
/* ogs_sbi_xact_remove() will call ogs_sbi_request_free()
* As such, we'll use ogs_sbi_client_send_reqmem_persistent() */
ogs_expect_or_return_val(true ==
ogs_sbi_scp_send_reqmem_persistent(
client, client_cb, request, xact), false);
ogs_sbi_send_request_to_client(
client, ogs_sbi_client_handler, request, xact), false);
return true;
}
bool ogs_sbi_discover_only(
ogs_sbi_xact_t *xact, ogs_sbi_client_cb_f client_cb)
bool ogs_sbi_send_request_to_client(
ogs_sbi_client_t *client, ogs_sbi_client_cb_f client_cb,
ogs_sbi_request_t *request, void *data)
{
ogs_sbi_nf_instance_t *nf_instance = NULL;
ogs_sbi_client_t *scp_client = NULL;
char *apiroot = NULL;
ogs_sbi_object_t *sbi_object = NULL;
ogs_sbi_service_type_e service_type = OGS_SBI_SERVICE_TYPE_NULL;
ogs_sbi_discovery_option_t *discovery_option = NULL;
/*
* If the HTTP2 Server's EndPoint is known,
* 3gpp-Sbi-Target-apiRoot should always be included in the HTTP2 Request.
*/
ogs_assert(client);
ogs_assert(request);
OpenAPI_nf_type_e target_nf_type = OpenAPI_nf_type_NULL;
scp_client = NF_INSTANCE_CLIENT(ogs_sbi_self()->scp_instance);
sbi_object = xact->sbi_object;
ogs_assert(sbi_object);
service_type = xact->service_type;
ogs_assert(service_type);
target_nf_type = ogs_sbi_service_type_to_nf_type(service_type);
ogs_assert(target_nf_type);
ogs_assert(client_cb);
if (scp_client && scp_client != client) {
discovery_option = xact->discovery_option;
/*************************
* INDIRECT COMMUNICATION
*************************/
/* Added 3gpp-Sbi-Target-apiRoot to HTTP header */
apiroot = ogs_sbi_client_apiroot(client);
ogs_assert(apiroot);
ogs_sbi_header_set(request->http.headers,
OGS_SBI_CUSTOM_TARGET_APIROOT, apiroot);
ogs_free(apiroot);
ogs_expect_or_return_val(true ==
ogs_sbi_client_send_via_scp(
scp_client, client_cb, request, data), false);
} else {
/***********************
* DIRECT COMMUNICATION
***********************/
/* Direct communication since `client' instance is always avaiable */
ogs_expect_or_return_val(true ==
ogs_sbi_client_send_request(
client, client_cb, request, data), false);
/* NRF NF-Instance */
nf_instance = sbi_object->nf_type_array[OpenAPI_nf_type_NRF].nf_instance;
if (!nf_instance) {
nf_instance = ogs_sbi_nf_instance_find_by_discovery_param(
OpenAPI_nf_type_NRF, NULL);
if (nf_instance)
OGS_SBI_SETUP_NF_INSTANCE(
sbi_object->nf_type_array[OpenAPI_nf_type_NRF], nf_instance);
}
if (nf_instance) {
ogs_sbi_client_t *client = NULL;
ogs_sbi_request_t *request = NULL;
ogs_warn("Try to discover [%s]",
ogs_sbi_service_type_to_name(service_type));
request = ogs_nnrf_disc_build_discover(
target_nf_type, discovery_option);
ogs_expect_or_return_val(request, false);
client = nf_instance->client;
ogs_assert(client);
return ogs_sbi_client_send_request(client, client_cb, request, xact);
}
ogs_error("Cannot discover [%s]",
ogs_sbi_service_type_to_name(service_type));
return false;
return true;
}
bool ogs_sbi_discover_and_send(
ogs_sbi_xact_t *xact, ogs_sbi_client_cb_f client_cb)
{
ogs_sbi_nf_instance_t *nf_instance = NULL;
ogs_sbi_object_t *sbi_object = NULL;
ogs_sbi_service_type_e service_type = OGS_SBI_SERVICE_TYPE_NULL;
ogs_sbi_discovery_option_t *discovery_option = NULL;
OpenAPI_nf_type_e target_nf_type = OpenAPI_nf_type_NULL;
sbi_object = xact->sbi_object;
ogs_assert(sbi_object);
service_type = xact->service_type;
ogs_assert(service_type);
target_nf_type = ogs_sbi_service_type_to_nf_type(service_type);
ogs_assert(target_nf_type);
ogs_assert(client_cb);
discovery_option = xact->discovery_option;
/* Target NF-Instance */
nf_instance = sbi_object->service_type_array[service_type].nf_instance;
if (!nf_instance) {
nf_instance = ogs_sbi_nf_instance_find_by_discovery_param(
target_nf_type, discovery_option);
if (nf_instance)
OGS_SBI_SETUP_NF_INSTANCE(
sbi_object->service_type_array[service_type], nf_instance);
}
if (nf_instance) {
return ogs_sbi_send_request(nf_instance, client_cb, xact);
}
return ogs_sbi_discover_only(xact, client_cb);
}
bool ogs_nnrf_nfm_send_nf_register(ogs_sbi_nf_instance_t *nf_instance)
{
ogs_sbi_request_t *request = NULL;
ogs_sbi_client_t *client = NULL;
ogs_assert(nf_instance);
client = nf_instance->client;
ogs_assert(client);
request = ogs_nnrf_nfm_build_register();
ogs_expect_or_return_val(request, false);
return ogs_sbi_scp_send_request(client, client->cb, request, nf_instance);
}
bool ogs_nnrf_nfm_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 = ogs_nnrf_nfm_build_update();
ogs_expect_or_return_val(request, false);
return ogs_sbi_scp_send_request(client, client->cb, request, nf_instance);
}
bool ogs_nnrf_nfm_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 = ogs_nnrf_nfm_build_de_register();
ogs_expect_or_return_val(request, false);
return ogs_sbi_scp_send_request(client, client->cb, request, nf_instance);
}
bool ogs_nnrf_nfm_send_nf_profile_retrieve(ogs_sbi_nf_instance_t *nf_instance,
char *nf_instance_id, void *data)
{
ogs_sbi_request_t *request = NULL;
ogs_sbi_client_t *client = NULL;
ogs_assert(nf_instance);
client = nf_instance->client;
ogs_assert(client);
ogs_assert(nf_instance_id);
request = ogs_nnrf_nfm_build_profile_retrieve(nf_instance_id);
ogs_expect_or_return_val(request, false);
return ogs_sbi_client_send_request(
client, client->cb, request, data);
}
bool ogs_nnrf_nfm_send_nf_status_subscribe(
ogs_sbi_subscription_data_t *subscription_data)
{
ogs_sbi_request_t *request = NULL;
ogs_sbi_client_t *client = NULL;
ogs_assert(subscription_data);
request = ogs_nnrf_nfm_build_status_subscribe(subscription_data);
ogs_expect_or_return_val(request, false);
client = subscription_data->client;
ogs_assert(client);
return ogs_sbi_scp_send_request(
client, client->cb, request, subscription_data);
}
bool ogs_nnrf_nfm_send_nf_status_unsubscribe(
ogs_sbi_subscription_data_t *subscription_data)
{
ogs_sbi_request_t *request = NULL;
ogs_sbi_client_t *client = NULL;
ogs_assert(subscription_data);
request = ogs_nnrf_nfm_build_status_unsubscribe(subscription_data);
ogs_expect_or_return_val(request, false);
client = subscription_data->client;
ogs_assert(client);
return ogs_sbi_scp_send_request(
client, client->cb, request, subscription_data);
}
bool ogs_nnrf_disc_send_nf_discover(
ogs_sbi_nf_instance_t *nf_instance,
OpenAPI_nf_type_e target_nf_type,
bool ogs_sbi_send_notification_request(
ogs_sbi_service_type_e service_type,
ogs_sbi_discovery_option_t *discovery_option,
void *data)
ogs_sbi_request_t *request, void *data)
{
ogs_sbi_client_t *client = NULL;
ogs_sbi_request_t *request = NULL;
ogs_sbi_client_t *client = NULL, *scp_client = NULL;
OpenAPI_nf_type_e target_nf_type = OpenAPI_nf_type_NULL;
ogs_assert(nf_instance);
ogs_assert(service_type);
target_nf_type = ogs_sbi_service_type_to_nf_type(service_type);
ogs_assert(target_nf_type);
ogs_assert(request);
request = ogs_nnrf_disc_build_discover(target_nf_type, discovery_option);
ogs_expect_or_return_val(request, false);
scp_client = NF_INSTANCE_CLIENT(ogs_sbi_self()->scp_instance);
if (target_nf_type == OpenAPI_nf_type_NRF)
client = NF_INSTANCE_CLIENT(ogs_sbi_self()->nrf_instance);
else {
ogs_fatal("Not implemented[%s]",
ogs_sbi_service_type_to_name(service_type));
ogs_assert_if_reached();
}
client = nf_instance->client;
ogs_assert(client);
if (scp_client) {
/*************************
* INDIRECT COMMUNICATION
*************************/
build_default_discovery_parameter(
request, service_type, discovery_option);
return ogs_sbi_client_send_request(client, client->cb, request, data);
ogs_expect_or_return_val(true ==
ogs_sbi_client_send_via_scp(
scp_client, ogs_sbi_client_handler, request, data), false);
} else if (client) {
/***********************
* DIRECT COMMUNICATION
***********************/
/* NRF is avaiable */
ogs_expect_or_return_val(true ==
ogs_sbi_client_send_request(
client, ogs_sbi_client_handler, request, data), false);
} else {
ogs_fatal("[%s:%s] Cannot send request [%s:%s:%s]",
client ? "CLIENT" : "No-CLIENT",
scp_client ? "SCP" : "No-SCP",
ogs_sbi_service_type_to_name(service_type),
request->h.service.name, request->h.api.version);
ogs_assert_if_reached();
}
return true;
}
bool ogs_sbi_send_response(ogs_sbi_stream_t *stream, int status)
@@ -299,5 +533,77 @@ bool ogs_sbi_send_response(ogs_sbi_stream_t *stream, int status)
response = ogs_sbi_build_response(&sendmsg, status);
ogs_expect_or_return_val(response, false);
return ogs_sbi_server_send_response(stream, response);
}
static void build_default_discovery_parameter(
ogs_sbi_request_t *request,
ogs_sbi_service_type_e service_type,
ogs_sbi_discovery_option_t *discovery_option)
{
OpenAPI_nf_type_e target_nf_type = OpenAPI_nf_type_NULL;
OpenAPI_nf_type_e requester_nf_type = OpenAPI_nf_type_NULL;
ogs_sbi_discovery_option_t *local_discovery_option = NULL;
ogs_assert(service_type);
target_nf_type = ogs_sbi_service_type_to_nf_type(service_type);
ogs_assert(target_nf_type);
requester_nf_type = NF_INSTANCE_TYPE(ogs_sbi_self()->nf_instance);
ogs_assert(requester_nf_type);
/*
* Insert one service-name in the discovery option
* in the function below.
*
* - ogs_sbi_xact_add()
* - ogs_sbi_send_notification_request()
*/
if (!discovery_option) {
local_discovery_option = ogs_sbi_discovery_option_new();
ogs_assert(local_discovery_option);
discovery_option = local_discovery_option;
}
if (!discovery_option->num_of_service_names) {
ogs_sbi_discovery_option_add_service_names(
discovery_option,
(char *)ogs_sbi_service_type_to_name(service_type));
}
ogs_sbi_header_set(request->http.headers,
OGS_SBI_CUSTOM_DISCOVERY_TARGET_NF_TYPE,
OpenAPI_nf_type_ToString(target_nf_type));
/* Instead of Discovery-requester-nf-type,
* Open5GS uses User-Agent for requester-nf-type */
if (discovery_option) {
if (discovery_option->requester_nf_instance_id) {
ogs_sbi_header_set(request->http.headers,
OGS_SBI_CUSTOM_DISCOVERY_REQUESTER_NF_INSTANCE_ID,
discovery_option->requester_nf_instance_id);
}
if (ogs_sbi_self()->discovery_config.
no_service_names == false &&
discovery_option->num_of_service_names) {
/* send array items separated by a comma */
char *v = ogs_sbi_discovery_option_build_service_names(
discovery_option);
if (v) {
ogs_sbi_header_set(request->http.headers,
OGS_SBI_CUSTOM_DISCOVERY_SERVICE_NAMES, v);
ogs_free(v);
} else {
ogs_warn("invalid service names failed[%d:%s]",
discovery_option->num_of_service_names,
discovery_option->service_names[0]);
}
}
}
if (local_discovery_option)
ogs_sbi_discovery_option_free(local_discovery_option);
}

View File

@@ -1,5 +1,5 @@
/*
* Copyright (C) 2019,2020 by Sukchan Lee <acetcom@gmail.com>
* Copyright (C) 2019-2022 by Sukchan Lee <acetcom@gmail.com>
*
* This file is part of Open5GS.
*
@@ -26,30 +26,22 @@
extern "C" {
#endif
bool ogs_sbi_send_request(ogs_sbi_nf_instance_t *nf_instance,
ogs_sbi_client_cb_f client_cb, ogs_sbi_xact_t *xact);
bool ogs_sbi_discover_only(
ogs_sbi_xact_t *xact, ogs_sbi_client_cb_f client_cb);
bool ogs_sbi_discover_and_send(
ogs_sbi_xact_t *xact, ogs_sbi_client_cb_f client_cb);
int ogs_sbi_server_handler(ogs_sbi_request_t *request, void *data);
int ogs_sbi_client_handler(
int status, ogs_sbi_response_t *response, void *data);
bool ogs_nnrf_nfm_send_nf_register(ogs_sbi_nf_instance_t *nf_instance);
bool ogs_nnrf_nfm_send_nf_update(ogs_sbi_nf_instance_t *nf_instance);
bool ogs_nnrf_nfm_send_nf_de_register(ogs_sbi_nf_instance_t *nf_instance);
bool ogs_nnrf_nfm_send_nf_profile_retrieve(ogs_sbi_nf_instance_t *nf_instance,
char *nf_instance_id, void *data);
bool ogs_sbi_discover_and_send(ogs_sbi_xact_t *xact);
bool ogs_sbi_discover_only(ogs_sbi_xact_t *xact);
bool ogs_nnrf_nfm_send_nf_status_subscribe(
ogs_sbi_subscription_data_t *subscription_data);
bool ogs_nnrf_nfm_send_nf_status_unsubscribe(
ogs_sbi_subscription_data_t *subscription_data);
bool ogs_nnrf_disc_send_nf_discover(
ogs_sbi_nf_instance_t *nf_instance,
OpenAPI_nf_type_e target_nf_type,
bool ogs_sbi_send_request_to_nf_instance(
ogs_sbi_nf_instance_t *nf_instance, ogs_sbi_xact_t *xact);
bool ogs_sbi_send_request_to_client(
ogs_sbi_client_t *client, ogs_sbi_client_cb_f client_cb,
ogs_sbi_request_t *request, void *data);
bool ogs_sbi_send_notification_request(
ogs_sbi_service_type_e service_type,
ogs_sbi_discovery_option_t *discovery_option,
void *data);
ogs_sbi_request_t *request, void *data);
#define ogs_sbi_send_http_status_no_content(__sTREAM) \
ogs_sbi_send_response(__sTREAM, OGS_SBI_HTTP_STATUS_NO_CONTENT)

View File

@@ -16,7 +16,7 @@
# along with this program. If not, see <https://www.gnu.org/licenses/>.
project('open5gs', 'c', 'cpp',
version : '2.4.11',
version : '2.5.6',
license : 'AGPL-3.0-or-later',
meson_version : '>= 0.43.0',
default_options : [
@@ -24,7 +24,7 @@ project('open5gs', 'c', 'cpp',
],
)
libogslib_version = '2.4.11'
libogslib_version = '2.5.6'
prefix = get_option('prefix')
bindir = join_paths(prefix, get_option('bindir'))

View File

@@ -38,6 +38,8 @@ else
ifconfig lo0 alias 127.0.0.19 netmask 255.255.255.255
ifconfig lo0 alias 127.0.0.20 netmask 255.255.255.255
ifconfig lo0 alias 127.0.1.10 netmask 255.255.255.255
ifconfig lo0 alias 127.0.1.11 netmask 255.255.255.255
ifconfig lo0 alias 127.0.1.12 netmask 255.255.255.255
if [ "$SYSTEM" = "Darwin" ]; then
if ! test -f /etc/pf.anchors/org.open5gs; then
sudo sh -c "echo 'nat on {en0} from 10.45.0.0/16 to any -> {en0}' > /etc/pf.anchors/org.open5gs"

View File

@@ -129,7 +129,7 @@ void amf_state_operational(ogs_fsm_t *s, amf_event_t *e)
CASE(OGS_SBI_RESOURCE_NAME_NF_STATUS_NOTIFY)
SWITCH(sbi_message.h.method)
CASE(OGS_SBI_HTTP_METHOD_POST)
ogs_nnrf_handle_nf_status_notify(stream, &sbi_message);
ogs_nnrf_nfm_handle_nf_status_notify(stream, &sbi_message);
break;
DEFAULT
@@ -213,6 +213,11 @@ void amf_state_operational(ogs_fsm_t *s, amf_event_t *e)
amf_namf_callback_handle_dereg_notify(stream, &sbi_message);
break;
CASE(OGS_SBI_RESOURCE_NAME_SDMSUBSCRIPTION_NOTIFY)
amf_namf_callback_handle_sdm_data_change_notify(
stream, &sbi_message);
break;
CASE(OGS_SBI_RESOURCE_NAME_AM_POLICY_NOTIFY)
ogs_assert(true == ogs_sbi_send_http_status_no_content(stream));
break;
@@ -291,7 +296,7 @@ void amf_state_operational(ogs_fsm_t *s, amf_event_t *e)
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) {
ogs_nnrf_handle_nf_status_subscribe(
ogs_nnrf_nfm_handle_nf_status_subscribe(
subscription_data, &sbi_message);
} else {
ogs_error("[%s] HTTP response error [%d]",
@@ -574,7 +579,11 @@ void amf_state_operational(ogs_fsm_t *s, amf_event_t *e)
ogs_assert(subscription_data);
ogs_assert(true ==
ogs_nnrf_nfm_send_nf_status_subscribe(subscription_data));
ogs_nnrf_nfm_send_nf_status_subscribe(
ogs_sbi_self()->nf_instance->nf_type,
subscription_data->req_nf_instance_id,
subscription_data->subscr_cond.nf_type,
subscription_data->subscr_cond.service_name));
ogs_info("Subscription validity expired [%s]",
subscription_data->id);
@@ -795,7 +804,15 @@ void amf_state_operational(ogs_fsm_t *s, amf_event_t *e)
amf_ue = amf_ue_find_by_message(&nas_message);
if (!amf_ue) {
amf_ue = amf_ue_add(ran_ue);
ogs_assert(amf_ue);
if (amf_ue == NULL) {
ogs_expect(OGS_OK ==
ngap_send_ran_ue_context_release_command(ran_ue,
NGAP_Cause_PR_misc,
NGAP_CauseMisc_control_processing_overload,
NGAP_UE_CTX_REL_NG_CONTEXT_REMOVE, 0));
ogs_pkbuf_free(pkbuf);
return;
}
} else {
/* Here, if the AMF_UE Context is found,
* the integrity check is not performed

View File

@@ -60,7 +60,7 @@ void amf_context_init(void)
ogs_pool_init(&amf_ue_pool, ogs_app()->max.ue);
ogs_pool_init(&ran_ue_pool, ogs_app()->max.ue);
ogs_pool_init(&amf_sess_pool, ogs_app()->pool.sess);
ogs_pool_init(&self.m_tmsi, ogs_app()->max.ue);
ogs_pool_init(&self.m_tmsi, ogs_app()->max.ue*2);
ogs_list_init(&self.gnb_list);
ogs_list_init(&self.amf_ue_list);
@@ -1063,7 +1063,11 @@ ran_ue_t *ran_ue_add(amf_gnb_t *gnb, uint32_t ran_ue_ngap_id)
ogs_assert(gnb);
ogs_pool_alloc(&ran_ue_pool, &ran_ue);
ogs_assert(ran_ue);
if (ran_ue == NULL) {
ogs_error("Could not allocate ran_ue context from pool");
return NULL;
}
memset(ran_ue, 0, sizeof *ran_ue);
ran_ue->t_ng_holding = ogs_timer_add(
@@ -1257,7 +1261,11 @@ amf_ue_t *amf_ue_add(ran_ue_t *ran_ue)
ogs_assert(gnb);
ogs_pool_alloc(&amf_ue_pool, &amf_ue);
ogs_assert(amf_ue);
if (amf_ue == NULL) {
ogs_error("Could not allocate amf_ue context from pool");
return NULL;
}
memset(amf_ue, 0, sizeof *amf_ue);
/* Add All Timers */
@@ -1387,6 +1395,8 @@ void amf_ue_remove(amf_ue_t *amf_ue)
if (amf_ue->policy_association_id)
ogs_free(amf_ue->policy_association_id);
if (amf_ue->data_change_subscription_id)
ogs_free(amf_ue->data_change_subscription_id);
if (amf_ue->confirmation_url_for_5g_aka)
ogs_free(amf_ue->confirmation_url_for_5g_aka);
@@ -1912,6 +1922,7 @@ static bool check_smf_info(ogs_sbi_nf_info_t *nf_info, void *context);
void amf_sbi_select_nf(
ogs_sbi_object_t *sbi_object,
ogs_sbi_service_type_e service_type,
OpenAPI_nf_type_e requester_nf_type,
ogs_sbi_discovery_option_t *discovery_option)
{
OpenAPI_nf_type_e target_nf_type = OpenAPI_nf_type_NULL;
@@ -1923,11 +1934,12 @@ void amf_sbi_select_nf(
ogs_assert(service_type);
target_nf_type = ogs_sbi_service_type_to_nf_type(service_type);
ogs_assert(target_nf_type);
ogs_assert(requester_nf_type);
switch(sbi_object->type) {
case OGS_SBI_OBJ_UE_TYPE:
nf_instance = ogs_sbi_nf_instance_find_by_discovery_param(
target_nf_type, discovery_option);
target_nf_type, requester_nf_type, discovery_option);
if (nf_instance)
OGS_SBI_SETUP_NF_INSTANCE(
sbi_object->service_type_array[service_type], nf_instance);
@@ -1938,7 +1950,9 @@ void amf_sbi_select_nf(
ogs_list_for_each(&ogs_sbi_self()->nf_instance_list, nf_instance) {
if (ogs_sbi_discovery_param_is_matched(
nf_instance, target_nf_type, discovery_option) == false)
nf_instance,
target_nf_type, requester_nf_type, discovery_option) ==
false)
continue;
nf_info = ogs_sbi_nf_info_find(
@@ -2118,7 +2132,7 @@ int amf_m_tmsi_pool_generate()
int index = 0;
ogs_trace("M-TMSI Pool try to generate...");
for (i = 0; index < ogs_app()->max.ue; i++) {
for (i = 0; index < ogs_app()->max.ue*2; i++) {
amf_m_tmsi_t *m_tmsi = NULL;
int conflict = 0;

View File

@@ -393,6 +393,9 @@ struct amf_ue_s {
/* Network Initiated De-Registration */
bool network_initiated_de_reg;
/* SubscriptionId of Subscription to Data Change Notification to UDM */
char *data_change_subscription_id;
ogs_list_t sess_list;
};
@@ -738,6 +741,7 @@ amf_sess_t *amf_sess_cycle(amf_sess_t *sess);
void amf_sbi_select_nf(
ogs_sbi_object_t *sbi_object,
ogs_sbi_service_type_e service_type,
OpenAPI_nf_type_e requester_nf_type,
ogs_sbi_discovery_option_t *discovery_option);
#define AMF_SESSION_SYNC_DONE(__aMF, __sTATE) \

View File

@@ -83,6 +83,8 @@ typedef struct amf_event_s {
ogs_timer_t *timer;
} amf_event_t;
OGS_STATIC_ASSERT(OGS_EVENT_SIZE >= sizeof(amf_event_t));
amf_event_t *amf_event_new(int id);
const char *amf_event_get_name(amf_event_t *e);

View File

@@ -276,7 +276,8 @@ ogs_pkbuf_t *gmm_build_de_registration_accept(amf_ue_t *amf_ue)
return nas_5gs_security_encode(amf_ue, &message);
}
ogs_pkbuf_t *gmm_build_de_registration_request(amf_ue_t *amf_ue)
ogs_pkbuf_t *gmm_build_de_registration_request(amf_ue_t *amf_ue,
OpenAPI_deregistration_reason_e dereg_reason)
{
ogs_nas_5gs_message_t message;
ogs_nas_5gs_deregistration_request_to_ue_t *dereg_req =
@@ -295,12 +296,16 @@ ogs_pkbuf_t *gmm_build_de_registration_request(amf_ue_t *amf_ue)
message.gmm.h.message_type = OGS_NAS_5GS_DEREGISTRATION_REQUEST_TO_UE;
dereg_req->de_registration_type.switch_off = 1;
dereg_req->de_registration_type.re_registration_required = 0;
dereg_req->de_registration_type.re_registration_required =
dereg_reason == OpenAPI_deregistration_reason_REREGISTRATION_REQUIRED;
dereg_req->de_registration_type.access_type = OGS_ACCESS_TYPE_3GPP;
dereg_req->presencemask |=
OGS_NAS_5GS_DEREGISTRATION_REQUEST_TO_UE_5GMM_CAUSE_PRESENT;
dereg_req->gmm_cause = OGS_5GMM_CAUSE_5GS_SERVICES_NOT_ALLOWED;
dereg_req->gmm_cause =
(dereg_reason == OpenAPI_deregistration_reason_REREGISTRATION_REQUIRED
? OGS_5GMM_CAUSE_IMPLICITLY_DE_REGISTERED
: OGS_5GMM_CAUSE_5GS_SERVICES_NOT_ALLOWED);
return nas_5gs_security_encode(amf_ue, &message);
}

View File

@@ -34,7 +34,8 @@ ogs_pkbuf_t *gmm_build_service_reject(
amf_ue_t *amf_ue, ogs_nas_5gmm_cause_t gmm_cause);
ogs_pkbuf_t *gmm_build_de_registration_accept(amf_ue_t *amf_ue);
ogs_pkbuf_t *gmm_build_de_registration_request(amf_ue_t *amf_ue);
ogs_pkbuf_t *gmm_build_de_registration_request(amf_ue_t *amf_ue,
OpenAPI_deregistration_reason_e dereg_reason);
ogs_pkbuf_t *gmm_build_identity_request(amf_ue_t *amf_ue);
ogs_pkbuf_t *gmm_build_security_mode_command(amf_ue_t *amf_ue);

View File

@@ -1070,8 +1070,12 @@ int gmm_handle_ul_nas_transport(amf_ue_t *amf_ue,
nf_instance = sess->sbi.
service_type_array[service_type].nf_instance;
if (!nf_instance) {
nf_instance =
ogs_sbi_nf_instance_find_by_service_type(service_type);
OpenAPI_nf_type_e requester_nf_type =
NF_INSTANCE_TYPE(ogs_sbi_self()->nf_instance);
ogs_assert(requester_nf_type);
nf_instance = ogs_sbi_nf_instance_find_by_service_type(
service_type, requester_nf_type);
if (nf_instance)
OGS_SBI_SETUP_NF_INSTANCE(
sess->sbi.service_type_array[service_type],

View File

@@ -454,7 +454,8 @@ static void common_register_state(ogs_fsm_t *s, amf_event_t *e)
} else {
amf_ue->t3522.retry_count++;
ogs_assert(OGS_OK ==
nas_5gs_send_de_registration_request(amf_ue));
nas_5gs_send_de_registration_request(amf_ue,
OpenAPI_deregistration_reason_NULL));
}
break;
@@ -796,29 +797,35 @@ void gmm_state_security_mode(ogs_fsm_t *s, amf_event_t *e)
case OGS_NAS_5GS_SECURITY_MODE_COMPLETE:
ogs_debug("[%s] Security mode complete", amf_ue->supi);
CLEAR_AMF_UE_TIMER(amf_ue->t3560);
/* Now, We will check the MAC in the NAS message*/
/*
* TS24.501
* Section 4.4.4.3
* Integrity checking of NAS signalling messages in the AMF
*
* Once the secure exchange of NAS messages has been established
* for the NAS signalling connection, the receiving 5GMM entity
* in the AMF shall not process any NAS signalling messages
* unless they have been successfully integrity checked by the NAS.
* If any NAS signalling message, having not successfully passed
* the integrity check, is received, then the NAS in the AMF shall
* discard that message. If any NAS signalling message is received,
* as not integrity protected even though the secure exchange
* of NAS messages has been established, then the NAS shall discard
* this message.
*/
if (h.integrity_protected == 0) {
ogs_error("[%s] Security-mode : No Integrity Protected",
amf_ue->supi);
ogs_assert(OGS_OK ==
nas_5gs_send_gmm_reject(amf_ue,
OGS_5GMM_CAUSE_SECURITY_MODE_REJECTED_UNSPECIFIED));
OGS_FSM_TRAN(s, &gmm_state_exception);
break;
}
if (!SECURITY_CONTEXT_IS_VALID(amf_ue)) {
ogs_warn("[%s] No Security Context", amf_ue->supi);
ogs_assert(OGS_OK ==
nas_5gs_send_gmm_reject(amf_ue,
OGS_5GMM_CAUSE_SECURITY_MODE_REJECTED_UNSPECIFIED));
OGS_FSM_TRAN(s, &gmm_state_exception);
break;
}
CLEAR_AMF_UE_TIMER(amf_ue->t3560);
gmm_cause = gmm_handle_security_mode_complete(
amf_ue, &nas_message->gmm.security_mode_complete);
if (gmm_cause != OGS_5GMM_CAUSE_REQUEST_ACCEPTED) {
@@ -988,6 +995,7 @@ void gmm_state_initial_context_setup(ogs_fsm_t *s, amf_event_t *e)
SWITCH(sbi_message->h.resource.component[1])
CASE(OGS_SBI_RESOURCE_NAME_REGISTRATIONS)
if (sbi_message->res_status != OGS_SBI_HTTP_STATUS_CREATED &&
sbi_message->res_status != OGS_SBI_HTTP_STATUS_NO_CONTENT &&
sbi_message->res_status != OGS_SBI_HTTP_STATUS_OK) {
ogs_error("[%s] HTTP response error [%d]",
amf_ue->supi, sbi_message->res_status);
@@ -1027,7 +1035,9 @@ void gmm_state_initial_context_setup(ogs_fsm_t *s, amf_event_t *e)
CASE(OGS_SBI_RESOURCE_NAME_AM_DATA)
CASE(OGS_SBI_RESOURCE_NAME_SMF_SELECT_DATA)
CASE(OGS_SBI_RESOURCE_NAME_UE_CONTEXT_IN_SMF_DATA)
if (sbi_message->res_status != OGS_SBI_HTTP_STATUS_OK) {
CASE(OGS_SBI_RESOURCE_NAME_SDM_SUBSCRIPTIONS)
if ((sbi_message->res_status != OGS_SBI_HTTP_STATUS_OK) &&
(sbi_message->res_status != OGS_SBI_HTTP_STATUS_CREATED)) {
ogs_error("[%s] HTTP response error [%d]",
amf_ue->supi, sbi_message->res_status);
ogs_assert(OGS_OK ==

View File

@@ -571,7 +571,8 @@ int amf_namf_callback_handle_dereg_notify(
amf_ue->network_initiated_de_reg = true;
ogs_assert(OGS_OK ==
nas_5gs_send_de_registration_request(amf_ue));
nas_5gs_send_de_registration_request(amf_ue,
DeregistrationData->dereg_reason));
amf_sbi_send_release_all_sessions(
amf_ue, AMF_RELEASE_SM_CONTEXT_NO_STATE);
@@ -606,3 +607,114 @@ cleanup:
return OGS_OK;
}
int amf_namf_callback_handle_sdm_data_change_notify(
ogs_sbi_stream_t *stream, ogs_sbi_message_t *recvmsg)
{
int status = OGS_SBI_HTTP_STATUS_NO_CONTENT;
amf_ue_t *amf_ue = NULL;
ogs_sbi_message_t sendmsg;
ogs_sbi_response_t *response = NULL;
OpenAPI_modification_notification_t *ModificationNotification;
OpenAPI_lnode_t *node;
char *ueid = NULL;
char *res_name = NULL;
ogs_assert(stream);
ogs_assert(recvmsg);
ModificationNotification = recvmsg->ModificationNotification;
if (!ModificationNotification) {
status = OGS_SBI_HTTP_STATUS_BAD_REQUEST;
ogs_error("[%s] No ModificationNotification", amf_ue->supi);
goto cleanup;
}
OpenAPI_list_for_each(ModificationNotification->notify_items, node)
{
OpenAPI_notify_item_t *item = node->data;
char *saveptr = NULL;
ueid = ogs_sbi_parse_uri(item->resource_id, "/", &saveptr);
if (!ueid) {
status = OGS_SBI_HTTP_STATUS_BAD_REQUEST;
ogs_error("[%s] No UeId", item->resource_id);
goto cleanup;
}
amf_ue = amf_ue_find_by_supi(ueid);
if (!amf_ue) {
status = OGS_SBI_HTTP_STATUS_NOT_FOUND;
ogs_error("Cannot find SUPI [%s]", ueid);
goto cleanup;
}
res_name = ogs_sbi_parse_uri(NULL, "/", &saveptr);
if (!res_name) {
status = OGS_SBI_HTTP_STATUS_BAD_REQUEST;
ogs_error("[%s] No Resource Name", item->resource_id);
goto cleanup;
}
SWITCH(res_name)
CASE(OGS_SBI_RESOURCE_NAME_AM_DATA)
OpenAPI_lnode_t *node_ci;
OpenAPI_list_for_each(item->changes, node_ci)
{
/*
OpenAPI_change_item_t *item_change = node_ci->data;
item_change->path;
item_change->from;
item_change->new_value;
item_change->orig_value;
*/
/*
switch (item_change->op) {
case OpenAPI_change_type_ADD:
break;
case OpenAPI_change_type_MOVE:
break;
case OpenAPI_change_type__REMOVE:
break;
case OpenAPI_change_type_REPLACE:
break;
default:
break;
}
*/
}
break;
DEFAULT
status = OGS_SBI_HTTP_STATUS_BAD_REQUEST;
ogs_error("Unknown Resource Name: [%s]", res_name);
goto cleanup;
END
ogs_free(ueid);
ogs_free(res_name);
ueid = NULL;
res_name = NULL;
}
cleanup:
if (ueid)
ogs_free(ueid);
if (res_name)
ogs_free(res_name);
memset(&sendmsg, 0, sizeof(sendmsg));
response = ogs_sbi_build_response(&sendmsg, status);
ogs_assert(response);
ogs_assert(true == ogs_sbi_server_send_response(stream, response));
return OGS_OK;
}

View File

@@ -32,6 +32,8 @@ int amf_namf_callback_handle_sm_context_status(
ogs_sbi_stream_t *stream, ogs_sbi_message_t *recvmsg);
int amf_namf_callback_handle_dereg_notify(
ogs_sbi_stream_t *stream, ogs_sbi_message_t *recvmsg);
int amf_namf_callback_handle_sdm_data_change_notify(
ogs_sbi_stream_t *stream, ogs_sbi_message_t *recvmsg);
#ifdef __cplusplus
}

View File

@@ -285,7 +285,8 @@ int nas_5gs_send_de_registration_accept(amf_ue_t *amf_ue)
return rv;
}
int nas_5gs_send_de_registration_request(amf_ue_t *amf_ue)
int nas_5gs_send_de_registration_request(amf_ue_t *amf_ue,
OpenAPI_deregistration_reason_e dereg_reason)
{
int rv;
@@ -302,7 +303,7 @@ int nas_5gs_send_de_registration_request(amf_ue_t *amf_ue)
gmmbuf = amf_ue->t3522.pkbuf;
ogs_expect_or_return_val(gmmbuf, OGS_ERROR);
} else {
gmmbuf = gmm_build_de_registration_request(amf_ue);
gmmbuf = gmm_build_de_registration_request(amf_ue, dereg_reason);
ogs_expect_or_return_val(gmmbuf, OGS_ERROR);
}

View File

@@ -41,7 +41,8 @@ int nas_5gs_send_service_reject(
amf_ue_t *amf_ue, ogs_nas_5gmm_cause_t gmm_cause);
int nas_5gs_send_de_registration_accept(amf_ue_t *amf_ue);
int nas_5gs_send_de_registration_request(amf_ue_t *amf_ue);
int nas_5gs_send_de_registration_request(amf_ue_t *amf_ue,
OpenAPI_deregistration_reason_e dereg_reason);
int nas_5gs_send_identity_request(amf_ue_t *amf_ue);

View File

@@ -50,7 +50,10 @@ ogs_sbi_request_t *amf_nausf_auth_build_authenticate(
AuthenticationInfo.supi_or_suci = amf_ue->suci;
AuthenticationInfo.serving_network_name =
ogs_serving_network_name_from_plmn_id(&amf_ue->nr_tai.plmn_id);
ogs_expect_or_return_val(AuthenticationInfo.serving_network_name, NULL);
if (!AuthenticationInfo.serving_network_name) {
ogs_error("No serving_network_name");
goto end;
}
if (auts) {
memset(&ResynchronizationInfo, 0, sizeof(ResynchronizationInfo));
@@ -70,7 +73,9 @@ ogs_sbi_request_t *amf_nausf_auth_build_authenticate(
request = ogs_sbi_build_request(&message);
ogs_expect(request);
ogs_free(AuthenticationInfo.serving_network_name);
end:
if (AuthenticationInfo.serving_network_name)
ogs_free(AuthenticationInfo.serving_network_name);
return request;
}
@@ -93,7 +98,10 @@ ogs_sbi_request_t *amf_nausf_auth_build_authenticate_confirmation(
message.h.uri = amf_ue->confirmation_url_for_5g_aka;
ConfirmationData = ogs_calloc(1, sizeof(*ConfirmationData));
ogs_expect_or_return_val(ConfirmationData, NULL);
if (!ConfirmationData) {
ogs_error("No ConfirmationData");
goto end;
}
ogs_hex_to_ascii(amf_ue->xres_star, sizeof(amf_ue->xres_star),
xres_star_string, sizeof(xres_star_string));
@@ -105,7 +113,9 @@ ogs_sbi_request_t *amf_nausf_auth_build_authenticate_confirmation(
request = ogs_sbi_build_request(&message);
ogs_expect(request);
ogs_free(ConfirmationData);
end:
if (ConfirmationData)
ogs_free(ConfirmationData);
return request;
}

View File

@@ -398,7 +398,13 @@ void ngap_handle_initial_ue_message(amf_gnb_t *gnb, ogs_ngap_message_t *message)
ran_ue = ran_ue_find_by_ran_ue_ngap_id(gnb, *RAN_UE_NGAP_ID);
if (!ran_ue) {
ran_ue = ran_ue_add(gnb, *RAN_UE_NGAP_ID);
ogs_assert(ran_ue);
if (ran_ue == NULL) {
ogs_assert(OGS_OK ==
ngap_send_error_indication(gnb, NULL, NULL,
NGAP_Cause_PR_misc,
NGAP_CauseMisc_control_processing_overload));
return;
}
/* Find AMF_UE if 5G-S_TMSI included */
if (FiveG_S_TMSI) {
@@ -2771,7 +2777,12 @@ void ngap_handle_handover_required(
/* Target UE */
target_ue = ran_ue_add(target_gnb, INVALID_UE_NGAP_ID);
ogs_assert(target_ue);
if (target_ue == NULL) {
ogs_assert(OGS_OK ==
ngap_send_error_indication2(amf_ue, NGAP_Cause_PR_misc,
NGAP_CauseMisc_control_processing_overload));
return;
}
/* Source UE - Target UE associated */
source_ue_associate_target_ue(source_ue, target_ue);

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