SCP(Model D) is now the default setting.

This commit is contained in:
Sukchan Lee 2022-10-22 11:26:04 +09:00
parent 7a14f2c505
commit 5ccb5f0f99
140 changed files with 4019 additions and 2607 deletions

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

@ -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>
#
@ -446,6 +470,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 +552,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

@ -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

View File

@ -6,7 +6,7 @@ head_inline: "<style> .blue { color: blue; } </style>"
This post explains how to compile and install the source code on **Debian/Ubuntu** based Linux Distribution.
{: .blue}
**Note:** Ubuntu 16.04(xenial) and earlier versions, and Debian 9(stretch) and earlier versions are not supported.
**Note:** Ubuntu 22.04(focal) and earlier versions, and Debian 9(stretch) and earlier versions are not supported.
{: .notice--danger}
@ -15,11 +15,24 @@ This post explains how to compile and install the source code on **Debian/Ubuntu
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
$ 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 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)
$ 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)
```
### Setting up TUN device (not persistent after rebooting)
@ -99,12 +112,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 +134,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 +153,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 +171,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
gtpc:
- - addr: 127.0.0.2
+ - addr: 10.10.0.2
metrics:
addr: 127.0.0.2
port: 9090
gummei:
plmn_id:
- mcc: 999
@ -178,13 +192,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 +204,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 +221,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 +417,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_16.x | sudo -E bash -
$ sudo apt install nodejs
```
@ -390,7 +425,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 +582,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

@ -31,6 +31,7 @@ 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
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
@ -58,53 +59,52 @@ 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.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
@@ -253,20 +253,20 @@ mme:
s1ap:
- addr: 127.0.0.2
+ addr: 10.10.0.2
- addr: 127.0.0.2
gtpc:
- - addr: 127.0.0.2
+ - addr: 10.10.0.2
metrics:
addr: 127.0.0.2
gummei:
port: 9090
gummei:
plmn_id:
- mcc: 001
- mnc: 01
+ mcc: 999
+ mnc: 70
- mcc: 999
- mnc: 70
+ mcc: 001
+ mnc: 01
mme_gid: 2
mme_code: 1
tai:
plmn_id:
- mcc: 001
- mnc: 01
- tac: 7
+ mcc: 999
+ mnc: 70
+ tac: 1
- mcc: 999
- mnc: 70
+ mcc: 001
+ mnc: 01
tac: 1
security:
integrity_order : [ EIA1, EIA2, EIA0 ]
ciphering_order : [ EEA0, EEA1, EEA2 ]
integrity_order : [ EIA2, EIA1, EIA0 ]
```
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 @@
@@ -69,7 +69,7 @@ sgwc:
gtpc:
addr: 127.0.0.3
- addr: 127.0.0.3
pfcp:
- addr: 127.0.0.3
+ addr: 10.10.0.3
- - addr: 127.0.0.3
+ - addr: 10.10.0.3
#
# sgwu:
@@ -100,7 +100,7 @@
@@ -120,7 +120,7 @@ sgwc:
#
sgwu:
pfcp:
- addr: 127.0.0.6
+ addr: 10.10.0.6
- - addr: 127.0.0.6
+ - addr: 10.10.0.6
#
# parameter:
@ -115,17 +115,16 @@ Modify [install/etc/open5gs/smf.yaml](https://github.com/{{ site.github_username
$ 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 @@
@@ -446,7 +446,7 @@ smf:
- addr: 127.0.0.4
- addr: ::1
port: 7777
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 @@
- addr: ::1
gtpc:
- addr: 127.0.0.4
@@ -613,7 +613,7 @@ scp:
#
upf:
pfcp:
@ -134,7 +133,6 @@ $ diff -u /etc/open5gs/smf.yaml.old /etc/open5gs/smf.yaml
#
# 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.
@ -143,41 +141,40 @@ 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.old 2020-06-21 23:34:14.643114779 -0400
+++ amf.yaml 2020-06-21 23:34:28.718482095 -0400
@@ -67,25 +67,25 @@
@@ -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: 001
- mnc: 01
+ mcc: 999
+ mnc: 70
- mcc: 999
- mnc: 70
+ mcc: 001
+ mnc: 01
amf_id:
region: 2
set: 1
tai:
- plmn_id:
- mcc: 001
- mnc: 01
- tac: 7
+ mcc: 999
+ mnc: 70
+ tac: 1
- mcc: 999
- mnc: 70
+ mcc: 001
+ mnc: 01
tac: 1
plmn_support:
- plmn_id:
- mcc: 001
- mnc: 01
+ mcc: 999
+ mnc: 70
- mcc: 999
- mnc: 70
+ mcc: 001
+ mnc: 01
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.
@ -185,18 +182,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.old 2020-08-22 11:41:09.214670723 -0400
+++ sgwu.yaml 2020-08-22 11:41:27.433937124 -0400
@@ -51,9 +51,9 @@
@@ -98,7 +98,7 @@ logger:
#
sgwu:
gtpu:
- addr: 127.0.0.6
+ addr: 10.11.0.6
pfcp:
- addr: 127.0.0.6
+ addr: 10.10.0.6
#
# sgwc:
- - addr: 127.0.0.6
+ - addr: 10.11.0.6
gtpu:
- addr: 127.0.0.6
```
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.
@ -204,16 +197,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.old 2020-08-22 11:42:57.781750067 -0400
+++ upf.yaml 2020-08-22 11:43:13.268901616 -0400
@@ -59,11 +59,9 @@
#
upf:
@@ -168,7 +168,7 @@ upf:
pfcp:
- - addr: 127.0.0.7
+ - addr: 10.10.0.7
- 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

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

@ -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

@ -240,7 +240,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 ci && npm run build"
print_status "Install the Open5GS WebUI..."
exec_cmd "mv ./${PACKAGE}-${VERSION}/webui /usr/lib/node_modules/${PACKAGE}"

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

@ -70,6 +70,8 @@ typedef struct ogs_event_s {
} 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

@ -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.
*
@ -58,15 +58,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;
}
@ -123,25 +132,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, "scp") != 0 && /* Skip SCP */
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;
}
@ -155,11 +170,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)
{
@ -479,7 +489,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;
@ -581,14 +590,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;
@ -599,7 +601,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)) {
@ -609,7 +612,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;
@ -711,14 +713,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;
@ -923,15 +918,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;
@ -941,7 +939,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;
@ -949,6 +948,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);
@ -960,7 +960,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);
@ -1537,14 +1537,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))
@ -1601,7 +1598,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;
}
@ -1644,8 +1658,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);
@ -1662,7 +1683,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;
}
@ -1673,8 +1698,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) {
@ -1849,33 +1879,18 @@ 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->req_nf_type =
NF_INSTANCE_TYPE(ogs_sbi_self()->nf_instance);
ogs_assert(subscription_data->req_nf_type);
if (NF_INSTANCE_ID(ogs_sbi_self()->nf_instance))
subscription_data->req_nf_instance_id =
ogs_strdup(NF_INSTANCE_ID(ogs_sbi_self()->nf_instance));
subscription_data->subscr_cond.nf_type = nf_type;
if (service_name)
subscription_data->subscr_cond.service_name = ogs_strdup(service_name);

View File

@ -123,6 +123,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;
@ -157,6 +159,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;
@ -222,7 +225,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;
@ -299,8 +302,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(
@ -317,9 +318,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(
@ -354,6 +357,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);
@ -375,6 +381,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(

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

@ -253,6 +253,7 @@ 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;
@ -313,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);
}
}
@ -449,6 +446,14 @@ 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,
@ -465,6 +470,14 @@ ogs_sbi_request_t *ogs_sbi_build_request(ogs_sbi_message_t *message)
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;
}
@ -532,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 */
@ -671,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;
}
@ -2396,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

@ -233,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"
@ -328,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;
@ -366,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 {
@ -537,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);
@ -147,7 +145,7 @@ 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]",
@ -174,11 +172,6 @@ void ogs_sbi_nf_state_will_register(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",
NF_INSTANCE_ID(ogs_sbi_self()->nf_instance));
@ -373,9 +366,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);
@ -403,11 +394,6 @@ 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",
NF_INSTANCE_ID(ogs_sbi_self()->nf_instance));

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;
@ -127,10 +137,12 @@ OpenAPI_nf_profile_t *ogs_nnrf_nfm_build_nf_profile(
NFProfile->is_load = true;
NFProfile->load = nf_instance->load;
Ipv4AddrList = OpenAPI_list_create();
ogs_assert(Ipv4AddrList);
Ipv6AddrList = OpenAPI_list_create();
ogs_assert(Ipv6AddrList);
NFProfile->ipv4_addresses = Ipv4AddrList = OpenAPI_list_create();
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,10 +152,22 @@ 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);
return NULL;
}
OpenAPI_list_add(Ipv4AddrList, ipstr);
}
}
NFProfile->ipv6_addresses = 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]",
@ -151,35 +175,40 @@ OpenAPI_nf_profile_t *ogs_nnrf_nfm_build_nf_profile(
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);
if (!ipstr) {
ogs_error("No ipstr");
ogs_nnrf_nfm_free_nf_profile(NFProfile);
return NULL;
}
OpenAPI_list_add(Ipv6AddrList, ipstr);
}
}
if (Ipv4AddrList->count)
NFProfile->ipv4_addresses = Ipv4AddrList;
else
OpenAPI_list_free(Ipv4AddrList);
if (Ipv6AddrList->count)
NFProfile->ipv6_addresses = Ipv6AddrList;
else
OpenAPI_list_free(Ipv6AddrList);
AllowedNfTypeList = OpenAPI_list_create();
ogs_assert(AllowedNfTypeList);
NFProfile->allowed_nf_types = AllowedNfTypeList = OpenAPI_list_create();
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,
(void *)(uintptr_t)nf_instance->allowed_nf_type[i]);
}
if (AllowedNfTypeList->count)
NFProfile->allowed_nf_types = AllowedNfTypeList;
else
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 +232,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 +253,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 +267,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 +277,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,53 +417,96 @@ 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);
NFService->versions = VersionList = OpenAPI_list_create();
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);
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);
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);
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);
return NULL;
}
}
OpenAPI_list_add(VersionList, NFServiceVersion);
}
ogs_assert(VersionList->count);
NFService->versions = VersionList;
NFService->scheme = nf_service->scheme;
NFService->nf_service_status = nf_service->status;
if (nf_service->fqdn)
NFService->fqdn = ogs_strdup(nf_service->fqdn);
IpEndPointList = OpenAPI_list_create();
ogs_assert(IpEndPointList);
NFService->ip_end_points = IpEndPointList = OpenAPI_list_create();
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 +519,33 @@ 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);
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);
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);
return NULL;
}
}
IpEndPoint->is_port = true;
IpEndPoint->port = nf_service->addr[i].port;
@ -464,24 +553,18 @@ static OpenAPI_nf_service_t *build_nf_service(
}
}
if (IpEndPointList->count)
NFService->ip_end_points = IpEndPointList;
else
OpenAPI_list_free(IpEndPointList);
AllowedNfTypeList = OpenAPI_list_create();
ogs_assert(AllowedNfTypeList);
NFService->allowed_nf_types = AllowedNfTypeList = OpenAPI_list_create();
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,
(void *)(uintptr_t)nf_service->allowed_nf_type[i]);
}
if (AllowedNfTypeList->count)
NFService->allowed_nf_types = AllowedNfTypeList;
else
OpenAPI_list_free(AllowedNfTypeList);
NFService->is_priority = true;
NFService->priority = nf_service->priority;
NFService->is_capacity = true;
@ -552,38 +635,50 @@ 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);
SmfInfo->s_nssai_smf_info_list = sNssaiSmfInfoList = OpenAPI_list_create();
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);
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);
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);
@ -591,80 +686,98 @@ static OpenAPI_smf_info_t *build_smf_info(ogs_sbi_nf_info_t *nf_info)
OpenAPI_list_add(sNssaiSmfInfoList, sNssaiSmfInfoItem);
}
if (sNssaiSmfInfoList->count)
SmfInfo->s_nssai_smf_info_list = sNssaiSmfInfoList;
else
OpenAPI_list_free(sNssaiSmfInfoList);
TaiList = OpenAPI_list_create();
ogs_assert(TaiList);
SmfInfo->tai_list = TaiList = OpenAPI_list_create();
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);
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);
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);
return NULL;
}
OpenAPI_list_add(TaiList, TaiItem);
}
if (TaiList->count)
SmfInfo->tai_list = TaiList;
else
OpenAPI_list_free(TaiList);
TaiRangeList = OpenAPI_list_create();
ogs_assert(TaiRangeList);
SmfInfo->tai_range_list = TaiRangeList = OpenAPI_list_create();
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);
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);
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;
OpenAPI_list_add(TaiRangeList, TaiRangeItem);
}
if (TaiRangeList->count)
SmfInfo->tai_range_list = TaiRangeList;
else
OpenAPI_list_free(TaiRangeList);
return SmfInfo;
}
@ -686,103 +799,166 @@ 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);
AmfInfo->guami_list = guamiAmfInfoList = OpenAPI_list_create();
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);
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);
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);
return NULL;
}
OpenAPI_list_add(guamiAmfInfoList, guamiAmfInfoItem);
}
if (guamiAmfInfoList->count)
AmfInfo->guami_list = guamiAmfInfoList;
else
OpenAPI_list_free(guamiAmfInfoList);
TaiList = OpenAPI_list_create();
ogs_assert(TaiList);
AmfInfo->tai_list = TaiList = OpenAPI_list_create();
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);
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);
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);
return NULL;
}
OpenAPI_list_add(TaiList, TaiItem);
}
if (TaiList->count)
AmfInfo->tai_list = TaiList;
else
OpenAPI_list_free(TaiList);
TaiRangeList = OpenAPI_list_create();
ogs_assert(TaiRangeList);
AmfInfo->tai_range_list = TaiRangeList = OpenAPI_list_create();
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);
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);
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);
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);
return NULL;
}
TaiRangeItem->tac_range_list = TacRangeList;
OpenAPI_list_add(TaiRangeList, TaiRangeItem);
}
if (TaiRangeList->count)
AmfInfo->tai_range_list = TaiRangeList;
else
OpenAPI_list_free(TaiRangeList);
return AmfInfo;
}
@ -885,8 +1061,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 +1150,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 +1199,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 +1226,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 +1244,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 +1257,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 +1274,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 +1309,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 +1334,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 +1363,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

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

@ -0,0 +1,132 @@
/*
* 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(
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_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;
}

View File

@ -1,5 +1,5 @@
/*
* Copyright (C) 2019-2022 by Sukchan Lee <acetcom@gmail.com>
* Copyright (C) 2022 by Sukchan Lee <acetcom@gmail.com>
*
* This file is part of Open5GS.
*
@ -17,20 +17,29 @@
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
#ifndef SCP_NNRF_HANDLER_H
#define SCP_NNRF_HANDLER_H
#ifndef OGS_NNRF_PATH_H
#define OGS_NNRF_PATH_H
#include "context.h"
#include "nnrf-build.h"
#ifdef __cplusplus
extern "C" {
#endif
void scp_nnrf_handle_nf_discover(
ogs_sbi_xact_t *xact, ogs_sbi_message_t *recvmsg);
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(
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_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 /* SCP_NNRF_HANDLER_H */
#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.
*
@ -101,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

@ -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
@ -296,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]",

View File

@ -1922,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;
@ -1933,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);
@ -1948,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(

View File

@ -741,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

@ -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

@ -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

@ -50,6 +50,7 @@ ogs_sbi_request_t *amf_nnrf_disc_build_discover(
message.param.discovery_option = discovery_option;
request = ogs_sbi_build_request(&message);
ogs_expect(request);
return request;
}

View File

@ -28,6 +28,7 @@ void amf_nnrf_handle_nf_discover(
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;
OpenAPI_nf_type_e requester_nf_type = OpenAPI_nf_type_NULL;
ogs_sbi_discovery_option_t *discovery_option = NULL;
OpenAPI_search_result_t *SearchResult = NULL;
@ -38,6 +39,8 @@ void amf_nnrf_handle_nf_discover(
ogs_assert(sbi_object);
service_type = xact->service_type;
ogs_assert(service_type);
requester_nf_type = xact->requester_nf_type;
ogs_assert(requester_nf_type);
discovery_option = xact->discovery_option;
@ -47,9 +50,10 @@ void amf_nnrf_handle_nf_discover(
return;
}
ogs_nnrf_handle_nf_discover_search_result(SearchResult);
ogs_nnrf_disc_handle_nf_discover_search_result(SearchResult);
amf_sbi_select_nf(sbi_object, service_type, discovery_option);
amf_sbi_select_nf(sbi_object,
service_type, requester_nf_type, discovery_option);
nf_instance = sbi_object->service_type_array[service_type].nf_instance;
if (!nf_instance) {

View File

@ -35,9 +35,15 @@ ogs_sbi_request_t *amf_nnssf_nsselection_build_get(
(char *)OGS_SBI_RESOURCE_NAME_NETWORK_SLICE_INFORMATION;
message.param.nf_id = NF_INSTANCE_ID(ogs_sbi_self()->nf_instance);
ogs_assert(message.param.nf_id);
if (!message.param.nf_id) {
ogs_error("No nf_id");
goto end;
}
message.param.nf_type = NF_INSTANCE_TYPE(ogs_sbi_self()->nf_instance);
ogs_assert(message.param.nf_type);
if (!message.param.nf_type) {
ogs_error("No nf_type");
goto end;
}
message.param.slice_info_request_for_pdu_session_presence = true;
message.param.roaming_indication = OpenAPI_roaming_indication_NON_ROAMING;
@ -45,7 +51,9 @@ ogs_sbi_request_t *amf_nnssf_nsselection_build_get(
sizeof(message.param.s_nssai));
request = ogs_sbi_build_request(&message);
ogs_assert(request);
ogs_expect(request);
end:
return request;
}

View File

@ -26,7 +26,7 @@ int amf_nnssf_nsselection_handle_get(
{
amf_ue_t *amf_ue = NULL;
ogs_sbi_client_t *client = NULL;
ogs_sbi_client_t *client = NULL, *scp_client = NULL;
ogs_sockaddr_t *addr = NULL;
OpenAPI_authorized_network_slice_info_t *AuthorizedNetworkSliceInfo = NULL;
@ -78,28 +78,42 @@ int amf_nnssf_nsselection_handle_get(
sess->nssf.nrf.id = ogs_strdup(NsiInformation->nrf_id);
ogs_assert(sess->nssf.nrf.id);
addr = ogs_sbi_getaddr_from_uri(NsiInformation->nrf_id);
if (!addr) {
ogs_error("[%s:%d] Invalid URI [%s]",
amf_ue->supi, sess->psi, NsiInformation->nrf_id);
ogs_assert(OGS_OK ==
nas_5gs_send_gmm_reject_from_sbi(
amf_ue, OGS_SBI_HTTP_STATUS_INTERNAL_SERVER_ERROR));
return OGS_ERROR;;
scp_client = NF_INSTANCE_CLIENT(ogs_sbi_self()->scp_instance);
if (scp_client) {
amf_nsmf_pdusession_sm_context_param_t param;
memset(&param, 0, sizeof(param));
param.nrf_uri.nrf.id = sess->nssf.nrf.id;
amf_sess_sbi_discover_and_send(
OGS_SBI_SERVICE_TYPE_NSMF_PDUSESSION, NULL,
amf_nsmf_pdusession_build_create_sm_context,
sess, AMF_CREATE_SM_CONTEXT_NO_STATE, &param);
} else {
addr = ogs_sbi_getaddr_from_uri(NsiInformation->nrf_id);
if (!addr) {
ogs_error("[%s:%d] Invalid URI [%s]",
amf_ue->supi, sess->psi, NsiInformation->nrf_id);
ogs_assert(OGS_OK ==
nas_5gs_send_gmm_reject_from_sbi(
amf_ue, OGS_SBI_HTTP_STATUS_INTERNAL_SERVER_ERROR));
return OGS_ERROR;;
}
client = ogs_sbi_client_find(addr);
if (!client) {
client = ogs_sbi_client_add(addr);
ogs_assert(client);
}
OGS_SBI_SETUP_CLIENT(&sess->nssf.nrf, client);
ogs_freeaddrinfo(addr);
ogs_assert(true == amf_sess_sbi_discover_by_nsi(
sess, OGS_SBI_SERVICE_TYPE_NSMF_PDUSESSION, NULL));
}
client = ogs_sbi_client_find(addr);
if (!client) {
client = ogs_sbi_client_add(addr);
ogs_assert(client);
}
OGS_SBI_SETUP_CLIENT(&sess->nssf.nrf, client);
ogs_freeaddrinfo(addr);
ogs_assert(true == amf_sess_sbi_discover_by_nsi(
sess, OGS_SBI_SERVICE_TYPE_NSMF_PDUSESSION, NULL));
return OGS_OK;
}

View File

@ -49,7 +49,10 @@ ogs_sbi_request_t *amf_npcf_am_policy_control_build_create(
memset(&PolicyAssociationRequest, 0, sizeof(PolicyAssociationRequest));
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_NAMF_CALLBACK;
@ -59,7 +62,10 @@ ogs_sbi_request_t *amf_npcf_am_policy_control_build_create(
(char *)OGS_SBI_RESOURCE_NAME_AM_POLICY_NOTIFY;
PolicyAssociationRequest.notification_uri =
ogs_sbi_server_uri(server, &header);
ogs_expect_or_return_val(PolicyAssociationRequest.notification_uri, NULL);
if (!PolicyAssociationRequest.notification_uri) {
ogs_error("No notifiation_uri");
goto end;
}
PolicyAssociationRequest.supi = amf_ue->supi;
@ -67,7 +73,10 @@ ogs_sbi_request_t *amf_npcf_am_policy_control_build_create(
if (amf_ue->msisdn[0]) {
PolicyAssociationRequest.gpsi = ogs_msprintf("%s-%s",
OGS_ID_GPSI_TYPE_MSISDN, amf_ue->msisdn[0]);
ogs_assert(PolicyAssociationRequest.gpsi);
if (!PolicyAssociationRequest.gpsi) {
ogs_error("No gpsi");
goto end;
}
}
}
@ -77,20 +86,31 @@ ogs_sbi_request_t *amf_npcf_am_policy_control_build_create(
memset(&ueLocation, 0, sizeof(ueLocation));
ueLocation.nr_location = ogs_sbi_build_nr_location(
&amf_ue->nr_tai, &amf_ue->nr_cgi);
ogs_expect_or_return_val(ueLocation.nr_location, NULL);
if (!ueLocation.nr_location) {
ogs_error("No ueLocation.nr_location");
goto end;
}
ueLocation.nr_location->ue_location_timestamp =
ogs_sbi_gmtime_string(amf_ue->ue_location_timestamp);
ogs_expect_or_return_val(
ueLocation.nr_location->ue_location_timestamp, NULL);
if (!ueLocation.nr_location->ue_location_timestamp) {
ogs_error("No ueLocation.nr_location->ue_location_timestamp");
goto end;
}
PolicyAssociationRequest.user_loc = &ueLocation;
PolicyAssociationRequest.time_zone =
ogs_sbi_timezone_string(ogs_timezone());
ogs_expect_or_return_val(PolicyAssociationRequest.time_zone, NULL);
if (!PolicyAssociationRequest.time_zone) {
ogs_error("No time_zone");
goto end;
}
PolicyAssociationRequest.serving_plmn =
ogs_sbi_build_plmn_id_nid(&amf_ue->nr_tai.plmn_id);
ogs_expect_or_return_val(PolicyAssociationRequest.serving_plmn, NULL);
if (!PolicyAssociationRequest.serving_plmn) {
ogs_error("No serving_plmn");
goto end;
}
PolicyAssociationRequest.rat_type = amf_ue_rat_type(amf_ue);
@ -115,7 +135,10 @@ ogs_sbi_request_t *amf_npcf_am_policy_control_build_create(
for (i = 0; i < amf_ue->allowed_nssai.num_of_s_nssai; i++) {
struct OpenAPI_snssai_s *Snssai = ogs_calloc(1, sizeof(*Snssai));
ogs_expect_or_return_val(Snssai, NULL);
if (!Snssai) {
ogs_error("No Snssai");
goto end;
}
Snssai->sst = amf_ue->allowed_nssai.s_nssai[i].sst;
Snssai->sd = ogs_s_nssai_sd_to_string(
@ -130,22 +153,31 @@ ogs_sbi_request_t *amf_npcf_am_policy_control_build_create(
OpenAPI_list_free(AllowedSnssais);
PolicyAssociationRequest.guami = ogs_sbi_build_guami(amf_ue->guami);
ogs_expect_or_return_val(PolicyAssociationRequest.guami, NULL);
if (!PolicyAssociationRequest.guami) {
ogs_error("No guami");
goto end;
}
PolicyAssociationRequest.service_name =
(char *)OGS_SBI_SERVICE_NAME_NAMF_CALLBACK;
PolicyAssociationRequest.supp_feat =
ogs_uint64_to_string(amf_ue->am_policy_control_features);
ogs_expect_or_return_val(PolicyAssociationRequest.supp_feat, NULL);
if (!PolicyAssociationRequest.supp_feat) {
ogs_error("No supp_feat");
goto end;
}
message.PolicyAssociationRequest = &PolicyAssociationRequest;
request = ogs_sbi_build_request(&message);
ogs_expect(request);
ogs_free(PolicyAssociationRequest.notification_uri);
ogs_free(PolicyAssociationRequest.supp_feat);
end:
if (PolicyAssociationRequest.notification_uri)
ogs_free(PolicyAssociationRequest.notification_uri);
if (PolicyAssociationRequest.supp_feat)
ogs_free(PolicyAssociationRequest.supp_feat);
if (PolicyAssociationRequest.gpsi)
ogs_free(PolicyAssociationRequest.gpsi);

View File

@ -22,6 +22,7 @@
ogs_sbi_request_t *amf_nsmf_pdusession_build_create_sm_context(
amf_sess_t *sess, void *data)
{
amf_nsmf_pdusession_sm_context_param_t *param = data;
ogs_sbi_message_t message;
ogs_sbi_request_t *request = NULL;
@ -53,11 +54,17 @@ ogs_sbi_request_t *amf_nsmf_pdusession_build_create_sm_context(
SmContextCreateData.serving_nf_id =
NF_INSTANCE_ID(ogs_sbi_self()->nf_instance);
ogs_expect_or_return_val(SmContextCreateData.serving_nf_id, NULL);
if (!SmContextCreateData.serving_nf_id) {
ogs_error("No serving_nf_id");
goto end;
}
SmContextCreateData.serving_network =
ogs_sbi_build_plmn_id_nid(&amf_ue->nr_tai.plmn_id);
ogs_expect_or_return_val(SmContextCreateData.serving_network, NULL);
if (!SmContextCreateData.serving_nf_id) {
ogs_error("No serving_network");
goto end;
}
SmContextCreateData.supi = amf_ue->supi;
SmContextCreateData.pei = amf_ue->pei;
@ -65,12 +72,18 @@ ogs_sbi_request_t *amf_nsmf_pdusession_build_create_sm_context(
if (amf_ue->msisdn[0]) {
SmContextCreateData.gpsi = ogs_msprintf("%s-%s",
OGS_ID_GPSI_TYPE_MSISDN, amf_ue->msisdn[0]);
ogs_expect_or_return_val(SmContextCreateData.gpsi, NULL);
if (!SmContextCreateData.gpsi) {
ogs_error("No gpsi");
goto end;
}
}
}
SmContextCreateData.is_pdu_session_id = true;
SmContextCreateData.pdu_session_id = sess->psi;
ogs_expect_or_return_val(sess->dnn, NULL);
if (!SmContextCreateData.pdu_session_id) {
ogs_error("No pdu_session_id");
goto end;
}
SmContextCreateData.dnn = sess->dnn;
memset(&sNssai, 0, sizeof(sNssai));
@ -86,7 +99,10 @@ ogs_sbi_request_t *amf_nsmf_pdusession_build_create_sm_context(
}
SmContextCreateData.guami = ogs_sbi_build_guami(amf_ue->guami);
ogs_expect_or_return_val(SmContextCreateData.guami, NULL);
if (!SmContextCreateData.guami) {
ogs_error("No guami");
goto end;
}
SmContextCreateData.an_type = amf_ue->nas.access_type;
memset(&header, 0, sizeof(header));
@ -96,10 +112,16 @@ ogs_sbi_request_t *amf_nsmf_pdusession_build_create_sm_context(
header.resource.component[1] =
(char *)OGS_SBI_RESOURCE_NAME_SM_CONTEXT_STATUS;
header.resource.component[2] = ogs_msprintf("%d", sess->psi);
ogs_expect_or_return_val(header.resource.component[2], NULL);
if (!header.resource.component[2]) {
ogs_error("No header.resource.component[2]");
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;
}
SmContextCreateData.sm_context_status_uri =
ogs_sbi_server_uri(server, &header);
@ -111,19 +133,30 @@ ogs_sbi_request_t *amf_nsmf_pdusession_build_create_sm_context(
memset(&ueLocation, 0, sizeof(ueLocation));
ueLocation.nr_location = ogs_sbi_build_nr_location(
&amf_ue->nr_tai, &amf_ue->nr_cgi);
ogs_expect_or_return_val(ueLocation.nr_location, NULL);
if (!ueLocation.nr_location) {
ogs_error("No ueLocation.nr_location");
goto end;
}
ueLocation.nr_location->ue_location_timestamp =
ogs_sbi_gmtime_string(amf_ue->ue_location_timestamp);
ogs_expect_or_return_val(
ueLocation.nr_location->ue_location_timestamp, NULL);
if (!ueLocation.nr_location->ue_location_timestamp) {
ogs_error("No ue_location_timestamp");
goto end;
}
SmContextCreateData.ue_location = &ueLocation;
SmContextCreateData.ue_time_zone = ogs_sbi_timezone_string(ogs_timezone());
ogs_expect_or_return_val(SmContextCreateData.ue_time_zone, NULL);
if (!SmContextCreateData.ue_time_zone) {
ogs_error("No ue_time_zone");
goto end;
}
pcf_nf_instance = amf_ue->sbi.service_type_array[
OGS_SBI_SERVICE_TYPE_NPCF_AM_POLICY_CONTROL].nf_instance;
ogs_expect_or_return_val(pcf_nf_instance, NULL);
if (!pcf_nf_instance) {
ogs_error("No pcf_nf_instance");
goto end;
}
SmContextCreateData.pcf_id = pcf_nf_instance->id;
message.SmContextCreateData = &SmContextCreateData;
@ -140,13 +173,26 @@ ogs_sbi_request_t *amf_nsmf_pdusession_build_create_sm_context(
message.http.accept = (char *)(OGS_SBI_CONTENT_JSON_TYPE ","
OGS_SBI_CONTENT_NGAP_TYPE "," OGS_SBI_CONTENT_PROBLEM_TYPE);
message.http.custom.callback =
(char *)OGS_SBI_CALLBACK_NSMF_PDUSESSION_STATUS_NOTIFY;
if (param && param->nrf_uri.nrf.id) {
message.http.custom.nrf_uri =
ogs_msprintf("%s: \"%s\"",
OGS_SBI_SERVICE_NAME_NNRF_DISC, param->nrf_uri.nrf.id);
}
request = ogs_sbi_build_request(&message);
ogs_expect(request);
end:
if (SmContextCreateData.serving_network)
ogs_sbi_free_plmn_id_nid(SmContextCreateData.serving_network);
ogs_free(SmContextCreateData.sm_context_status_uri);
ogs_free(header.resource.component[2]);
if (SmContextCreateData.sm_context_status_uri)
ogs_free(SmContextCreateData.sm_context_status_uri);
if (header.resource.component[2])
ogs_free(header.resource.component[2]);
if (sNssai.sd)
ogs_free(sNssai.sd);
if (hplmnSnssai.sd)
@ -163,6 +209,9 @@ ogs_sbi_request_t *amf_nsmf_pdusession_build_create_sm_context(
if (SmContextCreateData.ue_time_zone)
ogs_free(SmContextCreateData.ue_time_zone);
if (message.http.custom.nrf_uri)
ogs_free(message.http.custom.nrf_uri);
return request;
}
@ -214,7 +263,10 @@ ogs_sbi_request_t *amf_nsmf_pdusession_build_update_sm_context(
}
if (param->n2smbuf) {
ogs_expect_or_return_val(param->n2SmInfoType, NULL);
if (!param->n2SmInfoType) {
ogs_error("No n2SmInfoType");
goto end;
}
SmContextUpdateData.n2_sm_info_type = param->n2SmInfoType;
SmContextUpdateData.n2_sm_info = &n2SmInfo;
@ -236,7 +288,10 @@ ogs_sbi_request_t *amf_nsmf_pdusession_build_update_sm_context(
if (param->TargetID) {
SmContextUpdateData.target_id =
amf_nsmf_pdusession_build_target_id(param->TargetID);
ogs_expect_or_return_val(SmContextUpdateData.target_id, NULL);
if (!SmContextUpdateData.target_id) {
ogs_error("No target_id");
goto end;
}
}
if (param->ngApCause.group) {
@ -250,18 +305,26 @@ ogs_sbi_request_t *amf_nsmf_pdusession_build_update_sm_context(
if (param->ue_location) {
ueLocation.nr_location = ogs_sbi_build_nr_location(
&amf_ue->nr_tai, &amf_ue->nr_cgi);
ogs_expect_or_return_val(ueLocation.nr_location, NULL);
if (!ueLocation.nr_location) {
ogs_error("No ueLocation.nr_location");
goto end;
}
ueLocation.nr_location->ue_location_timestamp =
ogs_sbi_gmtime_string(amf_ue->ue_location_timestamp);
ogs_expect_or_return_val(
ueLocation.nr_location->ue_location_timestamp, NULL);
if (!ueLocation.nr_location->ue_location_timestamp) {
ogs_error("No ueLocation.nr_location->ue_location_timestamp");
goto end;
}
SmContextUpdateData.ue_location = &ueLocation;
}
if (param->ue_timezone) {
SmContextUpdateData.ue_time_zone =
ogs_sbi_timezone_string(ogs_timezone());
ogs_expect_or_return_val(SmContextUpdateData.ue_time_zone, NULL);
if (!SmContextUpdateData.ue_time_zone) {
ogs_error("No SmContextUpdateData.ue_time_zone");
goto end;
}
}
if (param->release) {
@ -273,6 +336,7 @@ ogs_sbi_request_t *amf_nsmf_pdusession_build_update_sm_context(
request = ogs_sbi_build_request(&message);
ogs_expect(request);
end:
if (ueLocation.nr_location) {
if (ueLocation.nr_location->ue_location_timestamp)
ogs_free(ueLocation.nr_location->ue_location_timestamp);
@ -283,7 +347,6 @@ ogs_sbi_request_t *amf_nsmf_pdusession_build_update_sm_context(
if (SmContextUpdateData.target_id)
amf_nsmf_pdusession_free_target_id(SmContextUpdateData.target_id);
return request;
}
@ -333,21 +396,30 @@ ogs_sbi_request_t *amf_nsmf_pdusession_build_release_sm_context(
memset(&ueLocation, 0, sizeof(ueLocation));
ueLocation.nr_location = ogs_sbi_build_nr_location(
&amf_ue->nr_tai, &amf_ue->nr_cgi);
ogs_expect_or_return_val(ueLocation.nr_location, NULL);
if (!ueLocation.nr_location) {
ogs_error("No ueLocation.nr_location");
goto end;
}
ueLocation.nr_location->ue_location_timestamp =
ogs_sbi_gmtime_string(amf_ue->ue_location_timestamp);
ogs_expect_or_return_val(
ueLocation.nr_location->ue_location_timestamp, NULL);
if (!ueLocation.nr_location->ue_location_timestamp) {
ogs_error("No ueLocation.nr_location->ue_location_timestamp");
goto end;
}
SmContextReleaseData.ue_location = &ueLocation;
SmContextReleaseData.ue_time_zone = ogs_sbi_timezone_string(ogs_timezone());
ogs_expect_or_return_val(SmContextReleaseData.ue_time_zone, NULL);
if (!SmContextReleaseData.ue_time_zone) {
ogs_error("No SmContextReleaseData.ue_time_zone");
goto end;
}
message.SmContextReleaseData = &SmContextReleaseData;
request = ogs_sbi_build_request(&message);
ogs_expect(request);
end:
if (ueLocation.nr_location) {
if (ueLocation.nr_location->ue_location_timestamp)
ogs_free(ueLocation.nr_location->ue_location_timestamp);
@ -445,21 +517,40 @@ OpenAPI_ng_ran_target_id_t *amf_nsmf_pdusession_build_target_id(
}
targetId = ogs_calloc(1, sizeof(*targetId));
ogs_expect_or_return_val(targetId, NULL);
if (!targetId) {
ogs_error("No targetId");
return NULL;
}
targetId->ran_node_id = ranNodeId = ogs_calloc(1, sizeof(*ranNodeId));;
ogs_expect_or_return_val(ranNodeId, NULL);
if (!targetId->ran_node_id) {
ogs_error("No targetId->ran_node_id");
amf_nsmf_pdusession_free_target_id(targetId);
return NULL;
}
memcpy(&plmn_id, globalGNB_ID->pLMNIdentity.buf, OGS_PLMN_ID_LEN);
ranNodeId->plmn_id = ogs_sbi_build_plmn_id(&plmn_id);
ogs_expect_or_return_val(ranNodeId->plmn_id, NULL);
if (!ranNodeId->plmn_id) {
ogs_error("No ranNodeId->plmn_id");
amf_nsmf_pdusession_free_target_id(targetId);
return NULL;
}
ranNodeId->g_nb_id = gNbId = ogs_calloc(1, sizeof(*gNbId));
ogs_expect_or_return_val(gNbId, NULL);
if (!ranNodeId->g_nb_id) {
ogs_error("No ranNodeId->g_nb_id");
amf_nsmf_pdusession_free_target_id(targetId);
return NULL;
}
gNbId->g_nb_value = ogs_calloc(
1, OGS_KEYSTRLEN(globalGNB_ID->gNB_ID.choice.gNB_ID.size));
ogs_expect_or_return_val(gNbId->g_nb_value, NULL);
if (!gNbId->g_nb_value) {
ogs_error("No gNbId->g_nb_value");
amf_nsmf_pdusession_free_target_id(targetId);
return NULL;
}
ogs_hex_to_ascii(
globalGNB_ID->gNB_ID.choice.gNB_ID.buf,
globalGNB_ID->gNB_ID.choice.gNB_ID.size,
@ -468,13 +559,25 @@ OpenAPI_ng_ran_target_id_t *amf_nsmf_pdusession_build_target_id(
gNbId->bit_length = 32 - globalGNB_ID->gNB_ID.choice.gNB_ID.bits_unused;
targetId->tai = tai = ogs_calloc(1, sizeof(*tai));;
ogs_expect_or_return_val(tai, NULL);
if (!targetId->tai) {
ogs_error("No targetId->tai");
amf_nsmf_pdusession_free_target_id(targetId);
return NULL;
}
ogs_ngap_ASN_to_5gs_tai(&targetRANNodeID->selectedTAI, &nr_tai);
tai->plmn_id = ogs_sbi_build_plmn_id(&nr_tai.plmn_id);
ogs_expect_or_return_val(tai->plmn_id, NULL);
if (!tai->plmn_id) {
ogs_error("No tai->plmn_id");
amf_nsmf_pdusession_free_target_id(targetId);
return NULL;
}
tai->tac = ogs_uint24_to_0string(nr_tai.tac);
ogs_expect_or_return_val(tai->tac, NULL);
if (!tai->tac) {
ogs_error("No tai->tac");
amf_nsmf_pdusession_free_target_id(targetId);
return NULL;
}
return targetId;
}

View File

@ -51,6 +51,12 @@ typedef struct amf_nsmf_pdusession_sm_context_param_s {
OpenAPI_ho_state_e hoState;
OpenAPI_ng_ran_target_id_t *targetId;
NGAP_TargetID_t *TargetID;
struct {
struct {
char *id;
} nrf;
} nrf_uri;
} amf_nsmf_pdusession_sm_context_param_t;
ogs_sbi_request_t *amf_nsmf_pdusession_build_create_sm_context(

View File

@ -46,9 +46,16 @@ ogs_sbi_request_t *amf_nudm_uecm_build_registration(
Amf3GppAccessRegistration.amf_instance_id =
NF_INSTANCE_ID(ogs_sbi_self()->nf_instance);
if (!Amf3GppAccessRegistration.amf_instance_id) {
ogs_error("No amf_instance_id");
goto end;
}
server = ogs_list_first(&ogs_sbi_self()->server_list);
ogs_assert(server);
if (!server) {
ogs_error("No server");
goto end;
}
memset(&header, 0, sizeof(header));
header.service.name = (char *)OGS_SBI_SERVICE_NAME_NAMF_CALLBACK;
@ -57,20 +64,32 @@ ogs_sbi_request_t *amf_nudm_uecm_build_registration(
header.resource.component[1] = (char *)OGS_SBI_RESOURCE_NAME_DEREG_NOTIFY;
Amf3GppAccessRegistration.dereg_callback_uri =
ogs_sbi_server_uri(server, &header);
ogs_assert(Amf3GppAccessRegistration.dereg_callback_uri);
if (!Amf3GppAccessRegistration.dereg_callback_uri) {
ogs_error("No dereg_callback_uri");
goto end;
}
Amf3GppAccessRegistration.guami = ogs_sbi_build_guami(amf_ue->guami);
Amf3GppAccessRegistration.rat_type = amf_ue_rat_type(amf_ue);
ogs_assert(Amf3GppAccessRegistration.rat_type != OpenAPI_rat_type_NULL);
if (Amf3GppAccessRegistration.rat_type == OpenAPI_rat_type_NULL) {
ogs_error("No rat_type");
goto end;
}
message.Amf3GppAccessRegistration = &Amf3GppAccessRegistration;
message.http.custom.callback =
(char *)OGS_SBI_CALLBACK_NUDM_UECM_DEREGISTRATION_NOTIFICATION;
request = ogs_sbi_build_request(&message);
ogs_assert(request);
ogs_expect(request);
end:
if (Amf3GppAccessRegistration.guami)
ogs_sbi_free_guami(Amf3GppAccessRegistration.guami);
ogs_free(Amf3GppAccessRegistration.dereg_callback_uri);
if (Amf3GppAccessRegistration.dereg_callback_uri)
ogs_free(Amf3GppAccessRegistration.dereg_callback_uri);
return request;
}
@ -102,6 +121,10 @@ ogs_sbi_request_t *amf_nudm_uecm_build_registration_delete(
Amf3GppAccessRegistrationModification.guami =
ogs_sbi_build_guami(amf_ue->guami);
if (!Amf3GppAccessRegistrationModification.guami) {
ogs_error("No guami");
goto end;
}
Amf3GppAccessRegistrationModification.is_purge_flag = true;
Amf3GppAccessRegistrationModification.purge_flag = 1;
@ -109,7 +132,9 @@ ogs_sbi_request_t *amf_nudm_uecm_build_registration_delete(
&Amf3GppAccessRegistrationModification;
request = ogs_sbi_build_request(&message);
ogs_assert(request);
ogs_expect(request);
end:
if (Amf3GppAccessRegistrationModification.guami)
ogs_sbi_free_guami(Amf3GppAccessRegistrationModification.guami);
@ -133,7 +158,7 @@ ogs_sbi_request_t *amf_nudm_sdm_build_get(amf_ue_t *amf_ue, void *data)
message.h.resource.component[1] = data;
request = ogs_sbi_build_request(&message);
ogs_assert(request);
ogs_expect(request);
return request;
}
@ -167,7 +192,10 @@ ogs_sbi_request_t *amf_nudm_sdm_build_subscription(amf_ue_t *amf_ue, void *data)
NF_INSTANCE_ID(ogs_sbi_self()->nf_instance);
server = ogs_list_first(&ogs_sbi_self()->server_list);
ogs_assert(server);
if (!server) {
ogs_error("No server");
goto end;
}
memset(&header, 0, sizeof(header));
header.service.name = (char *)OGS_SBI_SERVICE_NAME_NAMF_CALLBACK;
@ -175,26 +203,38 @@ ogs_sbi_request_t *amf_nudm_sdm_build_subscription(amf_ue_t *amf_ue, void *data)
header.resource.component[0] = amf_ue->supi;
header.resource.component[1] =
(char *)OGS_SBI_RESOURCE_NAME_SDMSUBSCRIPTION_NOTIFY;
SDMSubscription.callback_reference =
ogs_sbi_server_uri(server, &header);
ogs_assert(SDMSubscription.callback_reference);
SDMSubscription.callback_reference = ogs_sbi_server_uri(server, &header);
if (!SDMSubscription.callback_reference) {
ogs_error("No callback_reference");
goto end;
}
SDMSubscription.monitored_resource_uris = OpenAPI_list_create();
monres = ogs_msprintf("%s/%s", amf_ue->supi, (char *)data);
ogs_assert(monres);
if (!monres) {
ogs_error("No monres");
goto end;
}
OpenAPI_list_add(SDMSubscription.monitored_resource_uris, monres);
SDMSubscription.implicit_unsubscribe = 1;
message.SDMSubscription = &SDMSubscription;
request = ogs_sbi_build_request(&message);
ogs_assert(request);
message.http.custom.callback =
(char *)OGS_SBI_CALLBACK_NUDM_SDM_NOTIFICATION;
ogs_free(monres);
request = ogs_sbi_build_request(&message);
ogs_expect(request);
end:
if (monres)
ogs_free(monres);
OpenAPI_list_free(SDMSubscription.monitored_resource_uris);
ogs_free(SDMSubscription.callback_reference);
if (SDMSubscription.callback_reference)
ogs_free(SDMSubscription.callback_reference);
return request;
}

View File

@ -22,67 +22,12 @@
#include "ngap-path.h"
#include "nnrf-handler.h"
static int server_cb(ogs_sbi_request_t *request, void *data)
{
amf_event_t *e = NULL;
int rv;
ogs_assert(request);
ogs_assert(data);
e = amf_event_new(OGS_EVENT_SBI_SERVER);
ogs_assert(e);
e->h.sbi.request = request;
e->h.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;
}
static int client_cb(int status, ogs_sbi_response_t *response, void *data)
{
amf_event_t *e = NULL;
int rv;
if (status != OGS_OK) {
ogs_log_message(
status == OGS_DONE ? OGS_LOG_DEBUG : OGS_LOG_WARN, 0,
"client_cb() failed [%d]", status);
return OGS_ERROR;
}
ogs_assert(response);
e = amf_event_new(OGS_EVENT_SBI_CLIENT);
ogs_assert(e);
e->h.sbi.response = response;
e->h.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;
}
int amf_sbi_open(void)
{
ogs_sbi_nf_instance_t *nf_instance = NULL;
ogs_sbi_nf_service_t *service = NULL;
/* Add SELF NF instance */
/* Initialize SELF NF instance */
nf_instance = ogs_sbi_self()->nf_instance;
ogs_assert(nf_instance);
ogs_sbi_nf_fsm_init(nf_instance);
@ -104,18 +49,8 @@ int amf_sbi_open(void)
/* Initialize NRF NF Instance */
nf_instance = ogs_sbi_self()->nrf_instance;
if (nf_instance) {
ogs_sbi_client_t *client = NULL;
/* Client callback is only used when NF sends to NRF */
client = nf_instance->client;
ogs_assert(client);
client->cb = client_cb;
/* NFRegister is sent and the response is received
* by the above client callback. */
if (nf_instance)
ogs_sbi_nf_fsm_init(nf_instance);
}
/* Build Subscription-Data */
ogs_sbi_subscription_data_build_default(
@ -131,7 +66,7 @@ int amf_sbi_open(void)
ogs_sbi_subscription_data_build_default(
OpenAPI_nf_type_NSSF, OGS_SBI_SERVICE_NAME_NNSSF_NSSELECTION);
if (ogs_sbi_server_start_all(server_cb) != OGS_OK)
if (ogs_sbi_server_start_all(ogs_sbi_server_handler) != OGS_OK)
return OGS_ERROR;
return OGS_OK;
@ -143,12 +78,12 @@ void amf_sbi_close(void)
ogs_sbi_server_stop_all();
}
bool amf_sbi_send_request(ogs_sbi_nf_instance_t *nf_instance, void *data)
bool amf_sbi_send_request(
ogs_sbi_nf_instance_t *nf_instance, ogs_sbi_xact_t *xact)
{
ogs_assert(nf_instance);
ogs_assert(data);
return ogs_sbi_send_request(nf_instance, client_cb, data);
ogs_assert(xact);
return ogs_sbi_send_request_to_nf_instance(nf_instance, xact);
}
bool amf_ue_sbi_discover_and_send(
@ -174,7 +109,7 @@ bool amf_ue_sbi_discover_and_send(
return false;
}
if (ogs_sbi_discover_and_send(xact, client_cb) != true) {
if (ogs_sbi_discover_and_send(xact) != true) {
ogs_error("amf_ue_sbi_discover_and_send() failed");
ogs_sbi_xact_remove(xact);
ogs_assert(OGS_OK ==
@ -210,7 +145,7 @@ bool amf_sess_sbi_discover_and_send(
xact->state = state;
if (ogs_sbi_discover_and_send(xact, client_cb) != true) {
if (ogs_sbi_discover_and_send(xact) != true) {
ogs_error("amf_sess_sbi_discover_and_send() failed");
ogs_sbi_xact_remove(xact);
ogs_assert(OGS_OK == nas_5gs_send_back_gsm_message(sess,
@ -228,18 +163,19 @@ static int client_discover_cb(
ogs_sbi_xact_t *xact = NULL;
ogs_sbi_service_type_e service_type = OGS_SBI_SERVICE_TYPE_NULL;
OpenAPI_nf_type_e requester_nf_type = OpenAPI_nf_type_NULL;
ogs_sbi_discovery_option_t *discovery_option = NULL;
amf_ue_t *amf_ue = NULL;
amf_sess_t *sess = NULL;
ogs_assert(response);
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;
}
@ -247,12 +183,17 @@ static int client_discover_cb(
ogs_assert(sess);
service_type = xact->service_type;
ogs_assert(service_type);
requester_nf_type = xact->requester_nf_type;
ogs_assert(requester_nf_type);
discovery_option = xact->discovery_option;
sess = amf_sess_cycle(sess);
if (!sess) {
ogs_error("Session has already been removed");
ogs_sbi_xact_remove(xact);
if (response)
ogs_sbi_response_free(response);
return OGS_ERROR;
}
@ -268,6 +209,8 @@ static int client_discover_cb(
return OGS_ERROR;
}
ogs_assert(response);
rv = ogs_sbi_parse_response(&message, response);
if (rv != OGS_OK) {
ogs_error("cannot parse HTTP response");
@ -293,9 +236,10 @@ static int client_discover_cb(
goto cleanup;
}
ogs_nnrf_handle_nf_discover_search_result(message.SearchResult);
ogs_nnrf_disc_handle_nf_discover_search_result(message.SearchResult);
amf_sbi_select_nf(&sess->sbi, service_type, discovery_option);
amf_sbi_select_nf(&sess->sbi,
service_type, requester_nf_type, discovery_option);
if (!sess->sbi.service_type_array[service_type].nf_instance) {
ogs_error("[%s:%d] (NF discover) No [%s]",
@ -314,6 +258,13 @@ static int client_discover_cb(
amf_nsmf_pdusession_build_create_sm_context,
sess, AMF_CREATE_SM_CONTEXT_NO_STATE, NULL);
ogs_sbi_xact_remove(xact);
ogs_sbi_message_free(&message);
ogs_sbi_response_free(response);
return OGS_OK;
cleanup:
ogs_sbi_xact_remove(xact);
@ -347,7 +298,7 @@ bool amf_sess_sbi_discover_by_nsi(
sess->nssf.nrf.id, xact->service_type, xact->discovery_option);
ogs_expect_or_return_val(xact->request, false);
return ogs_sbi_client_send_reqmem_persistent(
return ogs_sbi_client_send_request(
client, client_discover_cb, xact->request, xact);
}
@ -497,6 +448,7 @@ static int client_notify_cb(
bool amf_sbi_send_n1_n2_failure_notify(
amf_sess_t *sess, OpenAPI_n1_n2_message_transfer_cause_e cause)
{
bool rc;
ogs_sbi_request_t *request = NULL;
ogs_sbi_client_t *client = NULL;
@ -508,5 +460,11 @@ bool amf_sbi_send_n1_n2_failure_notify(
request = amf_nsmf_callback_build_n1_n2_failure_notify(sess, cause);
ogs_expect_or_return_val(request, false);
return ogs_sbi_client_send_request(client, client_notify_cb, request, NULL);
rc = ogs_sbi_send_request_to_client(
client, client_notify_cb, request, NULL);
ogs_expect(rc == true);
ogs_sbi_request_free(request);
return rc;
}

View File

@ -34,7 +34,8 @@ extern "C" {
int amf_sbi_open(void);
void amf_sbi_close(void);
bool amf_sbi_send_request(ogs_sbi_nf_instance_t *nf_instance, void *data);
bool amf_sbi_send_request(
ogs_sbi_nf_instance_t *nf_instance, ogs_sbi_xact_t *xact);
bool amf_ue_sbi_discover_and_send(
ogs_sbi_service_type_e service_type,
ogs_sbi_discovery_option_t *discovery_option,

View File

@ -94,7 +94,7 @@ void ausf_state_operational(ogs_fsm_t *s, ausf_event_t *e)
CASE(OGS_SBI_RESOURCE_NAME_NF_STATUS_NOTIFY)
SWITCH(message.h.method)
CASE(OGS_SBI_HTTP_METHOD_POST)
ogs_nnrf_handle_nf_status_notify(stream, &message);
ogs_nnrf_nfm_handle_nf_status_notify(stream, &message);
break;
DEFAULT
@ -215,7 +215,7 @@ void ausf_state_operational(ogs_fsm_t *s, ausf_event_t *e)
CASE(OGS_SBI_HTTP_METHOD_POST)
if (message.res_status == OGS_SBI_HTTP_STATUS_CREATED ||
message.res_status == OGS_SBI_HTTP_STATUS_OK) {
ogs_nnrf_handle_nf_status_subscribe(
ogs_nnrf_nfm_handle_nf_status_subscribe(
subscription_data, &message);
} else {
ogs_error("[%s] HTTP response error [%d]",

View File

@ -34,6 +34,8 @@ typedef struct ausf_event_s {
ausf_ue_t *ausf_ue;
} ausf_event_t;
OGS_STATIC_ASSERT(OGS_EVENT_SIZE >= sizeof(ausf_event_t));
ausf_event_t *ausf_event_new(int id);
const char *ausf_event_get_name(ausf_event_t *e);

View File

@ -29,6 +29,7 @@ void ausf_nnrf_handle_nf_discover(
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;
OpenAPI_search_result_t *SearchResult = NULL;
ogs_assert(recvmsg);
@ -39,6 +40,8 @@ void ausf_nnrf_handle_nf_discover(
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;
@ -48,13 +51,14 @@ void ausf_nnrf_handle_nf_discover(
return;
}
ogs_nnrf_handle_nf_discover_search_result(SearchResult);
ogs_nnrf_disc_handle_nf_discover_search_result(SearchResult);
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_error("(NF discover) No [%s]",
ogs_sbi_service_type_to_name(service_type));
ogs_error("(NF discover) No [%s:%s]",
ogs_sbi_service_type_to_name(service_type),
OpenAPI_nf_type_ToString(requester_nf_type));
return;
}

View File

@ -60,7 +60,7 @@ ogs_sbi_request_t *ausf_nudm_ueau_build_get(ausf_ue_t *ausf_ue, void *data)
message.AuthenticationInfoRequest = &AuthenticationInfoRequest;
request = ogs_sbi_build_request(&message);
ogs_expect_or_return_val(request, NULL);
ogs_expect(request);
return request;
}
@ -83,10 +83,16 @@ ogs_sbi_request_t *ausf_nudm_ueau_build_result_confirmation_inform(
message.h.resource.component[1] = (char *)OGS_SBI_RESOURCE_NAME_AUTH_EVENTS;
AuthEvent = ogs_calloc(1, sizeof(*AuthEvent));
ogs_expect_or_return_val(AuthEvent, NULL);
if (!AuthEvent) {
ogs_error("No AuthEvent");
goto end;
}
AuthEvent->time_stamp = ogs_sbi_localtime_string(ogs_time_now());
ogs_expect_or_return_val(AuthEvent->time_stamp, NULL);
if (!AuthEvent->time_stamp) {
ogs_error("No time_stamp");
goto end;
}
AuthEvent->nf_instance_id = NF_INSTANCE_ID(ogs_sbi_self()->nf_instance);
if (ausf_ue->auth_result == OpenAPI_auth_result_AUTHENTICATION_SUCCESS)
@ -99,11 +105,15 @@ ogs_sbi_request_t *ausf_nudm_ueau_build_result_confirmation_inform(
message.AuthEvent = AuthEvent;
request = ogs_sbi_build_request(&message);
ogs_expect_or_return_val(request, NULL);
ogs_expect(request);
if (AuthEvent->time_stamp)
ogs_free(AuthEvent->time_stamp);
ogs_free(AuthEvent);
end:
if (AuthEvent) {
if (AuthEvent->time_stamp)
ogs_free(AuthEvent->time_stamp);
ogs_free(AuthEvent);
}
return request;
}

View File

@ -19,67 +19,12 @@
#include "sbi-path.h"
static int server_cb(ogs_sbi_request_t *request, void *data)
{
ausf_event_t *e = NULL;
int rv;
ogs_assert(request);
ogs_assert(data);
e = ausf_event_new(OGS_EVENT_SBI_SERVER);
ogs_assert(e);
e->h.sbi.request = request;
e->h.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;
}
static int client_cb(int status, ogs_sbi_response_t *response, void *data)
{
ausf_event_t *e = NULL;
int rv;
if (status != OGS_OK) {
ogs_log_message(
status == OGS_DONE ? OGS_LOG_DEBUG : OGS_LOG_WARN, 0,
"client_cb() failed [%d]", status);
return OGS_ERROR;
}
ogs_assert(response);
e = ausf_event_new(OGS_EVENT_SBI_CLIENT);
ogs_assert(e);
e->h.sbi.response = response;
e->h.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;
}
int ausf_sbi_open(void)
{
ogs_sbi_nf_instance_t *nf_instance = NULL;
ogs_sbi_nf_service_t *service = NULL;
/* Add SELF NF instance */
/* Initialize SELF NF instance */
nf_instance = ogs_sbi_self()->nf_instance;
ogs_assert(nf_instance);
ogs_sbi_nf_fsm_init(nf_instance);
@ -101,24 +46,14 @@ int ausf_sbi_open(void)
/* Initialize NRF NF Instance */
nf_instance = ogs_sbi_self()->nrf_instance;
if (nf_instance) {
ogs_sbi_client_t *client = NULL;
/* Client callback is only used when NF sends to NRF */
client = nf_instance->client;
ogs_assert(client);
client->cb = client_cb;
/* NFRegister is sent and the response is received
* by the above client callback. */
if (nf_instance)
ogs_sbi_nf_fsm_init(nf_instance);
}
/* Build Subscription-Data */
ogs_sbi_subscription_data_build_default(
OpenAPI_nf_type_UDM, OGS_SBI_SERVICE_NAME_NUDM_UEAU);
if (ogs_sbi_server_start_all(server_cb) != OGS_OK)
if (ogs_sbi_server_start_all(ogs_sbi_server_handler) != OGS_OK)
return OGS_ERROR;
return OGS_OK;
@ -130,11 +65,12 @@ void ausf_sbi_close(void)
ogs_sbi_server_stop_all();
}
bool ausf_sbi_send_request(ogs_sbi_nf_instance_t *nf_instance, void *data)
bool ausf_sbi_send_request(
ogs_sbi_nf_instance_t *nf_instance, ogs_sbi_xact_t *xact)
{
ogs_assert(nf_instance);
return ogs_sbi_send_request(nf_instance, client_cb, data);
ogs_assert(xact);
return ogs_sbi_send_request_to_nf_instance(nf_instance, xact);
}
bool ausf_sbi_discover_and_send(
@ -164,7 +100,7 @@ bool ausf_sbi_discover_and_send(
xact->assoc_stream = stream;
if (ogs_sbi_discover_and_send(xact, client_cb) != true) {
if (ogs_sbi_discover_and_send(xact) != true) {
ogs_error("ausf_sbi_discover_and_send() failed");
ogs_sbi_xact_remove(xact);
ogs_assert(true ==

View File

@ -29,7 +29,8 @@ extern "C" {
int ausf_sbi_open(void);
void ausf_sbi_close(void);
bool ausf_sbi_send_request(ogs_sbi_nf_instance_t *nf_instance, void *data);
bool ausf_sbi_send_request(
ogs_sbi_nf_instance_t *nf_instance, ogs_sbi_xact_t *xact);
bool ausf_sbi_discover_and_send(
ogs_sbi_service_type_e service_type,
ogs_sbi_discovery_option_t *discovery_option,

View File

@ -97,7 +97,7 @@ void bsf_state_operational(ogs_fsm_t *s, bsf_event_t *e)
CASE(OGS_SBI_RESOURCE_NAME_NF_STATUS_NOTIFY)
SWITCH(message.h.method)
CASE(OGS_SBI_HTTP_METHOD_POST)
ogs_nnrf_handle_nf_status_notify(stream, &message);
ogs_nnrf_nfm_handle_nf_status_notify(stream, &message);
break;
DEFAULT
@ -237,7 +237,7 @@ void bsf_state_operational(ogs_fsm_t *s, bsf_event_t *e)
CASE(OGS_SBI_HTTP_METHOD_POST)
if (message.res_status == OGS_SBI_HTTP_STATUS_CREATED ||
message.res_status == OGS_SBI_HTTP_STATUS_OK) {
ogs_nnrf_handle_nf_status_subscribe(
ogs_nnrf_nfm_handle_nf_status_subscribe(
subscription_data, &message);
} else {
ogs_error("HTTP response error : %d",

View File

@ -33,6 +33,8 @@ typedef struct bsf_event_s {
bsf_sess_t *sess;
} bsf_event_t;
OGS_STATIC_ASSERT(OGS_EVENT_SIZE >= sizeof(bsf_event_t));
bsf_event_t *bsf_event_new(int id);
const char *bsf_event_get_name(bsf_event_t *e);

View File

@ -29,6 +29,7 @@ void bsf_nnrf_handle_nf_discover(
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;
OpenAPI_search_result_t *SearchResult = NULL;
ogs_assert(recvmsg);
@ -39,6 +40,8 @@ void bsf_nnrf_handle_nf_discover(
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;
@ -48,13 +51,14 @@ void bsf_nnrf_handle_nf_discover(
return;
}
ogs_nnrf_handle_nf_discover_search_result(SearchResult);
ogs_nnrf_disc_handle_nf_discover_search_result(SearchResult);
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_error("(NF discover) No [%s]",
ogs_sbi_service_type_to_name(service_type));
ogs_error("(NF discover) No [%s:%s]",
ogs_sbi_service_type_to_name(service_type),
OpenAPI_nf_type_ToString(requester_nf_type));
return;
}

View File

@ -19,67 +19,12 @@
#include "sbi-path.h"
static int server_cb(ogs_sbi_request_t *request, void *data)
{
bsf_event_t *e = NULL;
int rv;
ogs_assert(request);
ogs_assert(data);
e = bsf_event_new(OGS_EVENT_SBI_SERVER);
ogs_assert(e);
e->h.sbi.request = request;
e->h.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;
}
static int client_cb(int status, ogs_sbi_response_t *response, void *data)
{
bsf_event_t *e = NULL;
int rv;
if (status != OGS_OK) {
ogs_log_message(
status == OGS_DONE ? OGS_LOG_DEBUG : OGS_LOG_WARN, 0,
"client_cb() failed [%d]", status);
return OGS_ERROR;
}
ogs_assert(response);
e = bsf_event_new(OGS_EVENT_SBI_CLIENT);
ogs_assert(e);
e->h.sbi.response = response;
e->h.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;
}
int bsf_sbi_open(void)
{
ogs_sbi_nf_instance_t *nf_instance = NULL;
ogs_sbi_nf_service_t *service = NULL;
/* Add SELF NF instance */
/* Initialize SELF NF instance */
nf_instance = ogs_sbi_self()->nf_instance;
ogs_assert(nf_instance);
ogs_sbi_nf_fsm_init(nf_instance);
@ -103,20 +48,10 @@ int bsf_sbi_open(void)
/* Initialize NRF NF Instance */
nf_instance = ogs_sbi_self()->nrf_instance;
if (nf_instance) {
ogs_sbi_client_t *client = NULL;
/* Client callback is only used when NF sends to NRF */
client = nf_instance->client;
ogs_assert(client);
client->cb = client_cb;
/* NFRegister is sent and the response is received
* by the above client callback. */
if (nf_instance)
ogs_sbi_nf_fsm_init(nf_instance);
}
if (ogs_sbi_server_start_all(server_cb) != OGS_OK)
if (ogs_sbi_server_start_all(ogs_sbi_server_handler) != OGS_OK)
return OGS_ERROR;
return OGS_OK;
@ -128,11 +63,12 @@ void bsf_sbi_close(void)
ogs_sbi_server_stop_all();
}
bool bsf_sbi_send_request(ogs_sbi_nf_instance_t *nf_instance, void *data)
bool bsf_sbi_send_request(
ogs_sbi_nf_instance_t *nf_instance, ogs_sbi_xact_t *xact)
{
ogs_assert(nf_instance);
return ogs_sbi_send_request(nf_instance, client_cb, data);
ogs_assert(xact);
return ogs_sbi_send_request_to_nf_instance(nf_instance, xact);
}
bool bsf_sbi_discover_and_send(
@ -162,7 +98,7 @@ bool bsf_sbi_discover_and_send(
xact->assoc_stream = stream;
if (ogs_sbi_discover_and_send(xact, client_cb) != true) {
if (ogs_sbi_discover_and_send(xact) != true) {
ogs_error("bsf_sbi_discover_and_send() failed");
ogs_sbi_xact_remove(xact);
ogs_assert(true ==

View File

@ -29,7 +29,8 @@ extern "C" {
int bsf_sbi_open(void);
void bsf_sbi_close(void);
bool bsf_sbi_send_request(ogs_sbi_nf_instance_t *nf_instance, void *data);
bool bsf_sbi_send_request(
ogs_sbi_nf_instance_t *nf_instance, ogs_sbi_xact_t *xact);
bool bsf_sbi_discover_and_send(
ogs_sbi_service_type_e service_type,
ogs_sbi_discovery_option_t *discovery_option,

View File

@ -101,6 +101,8 @@ typedef struct mme_event_s {
ogs_timer_t *timer;
} mme_event_t;
OGS_STATIC_ASSERT(OGS_EVENT_SIZE >= sizeof(mme_event_t));
void mme_event_term(void);
mme_event_t *mme_event_new(mme_event_e id);

View File

@ -44,8 +44,12 @@ void nrf_context_final(void)
ogs_assert(context_initialized == 1);
ogs_list_for_each_safe(
&ogs_sbi_self()->nf_instance_list, next_nf_instance, nf_instance)
if (OGS_FSM_STATE(&nf_instance->sm)) nrf_nf_fsm_fini(nf_instance);
&ogs_sbi_self()->nf_instance_list, next_nf_instance, nf_instance) {
if (NF_INSTANCE_TYPE_IS_NRF(nf_instance))
continue;
if (OGS_FSM_STATE(&nf_instance->sm))
nrf_nf_fsm_fini(nf_instance);
}
context_initialized = 0;
}

View File

@ -20,54 +20,35 @@
#include "event.h"
#include "context.h"
static OGS_POOL(pool, nrf_event_t);
void nrf_event_init(void)
{
ogs_pool_init(&pool, ogs_app()->pool.event);
}
void nrf_event_final(void)
{
ogs_pool_final(&pool);
}
nrf_event_t *nrf_event_new(nrf_event_e id)
nrf_event_t *nrf_event_new(int id)
{
nrf_event_t *e = NULL;
ogs_pool_alloc(&pool, &e);
e = ogs_event_size(id, sizeof(nrf_event_t));
ogs_assert(e);
memset(e, 0, sizeof(*e));
e->id = id;
e->h.id = id;
return e;
}
void nrf_event_free(nrf_event_t *e)
{
ogs_assert(e);
ogs_pool_free(&pool, e);
}
const char *nrf_event_get_name(nrf_event_t *e)
{
if (e == NULL)
return OGS_FSM_NAME_INIT_SIG;
switch (e->id) {
switch (e->h.id) {
case OGS_FSM_ENTRY_SIG:
return OGS_FSM_NAME_ENTRY_SIG;
case OGS_FSM_EXIT_SIG:
return OGS_FSM_NAME_EXIT_SIG;
case NRF_EVT_SBI_SERVER:
return "NRF_EVT_SBI_SERVER";
case NRF_EVT_SBI_CLIENT:
return "NRF_EVT_SBI_CLIENT";
case NRF_EVT_SBI_TIMER:
return "NRF_EVT_SBI_TIMER";
case OGS_EVENT_SBI_SERVER:
return OGS_EVENT_NAME_SBI_SERVER;
case OGS_EVENT_SBI_CLIENT:
return OGS_EVENT_NAME_SBI_CLIENT;
case OGS_EVENT_SBI_TIMER:
return OGS_EVENT_NAME_SBI_TIMER;
default:
break;

View File

@ -26,44 +26,17 @@
extern "C" {
#endif
typedef struct ogs_sbi_request_s ogs_sbi_request_t;
typedef struct ogs_sbi_response_s ogs_sbi_response_t;
typedef struct ogs_sbi_message_s ogs_sbi_message_t;
typedef struct ogs_sbi_nf_instance_s ogs_sbi_nf_instance_t;
typedef struct ogs_sbi_subscription_data_s ogs_sbi_subscription_data_t;
typedef enum {
NRF_EVT_BASE = OGS_MAX_NUM_OF_PROTO_EVENT,
NRF_EVT_SBI_SERVER,
NRF_EVT_SBI_CLIENT,
NRF_EVT_SBI_TIMER,
NRF_EVT_TOP,
} nrf_event_e;
typedef struct nrf_event_s {
int id;
int timer_id;
struct {
ogs_sbi_request_t *request;
ogs_sbi_response_t *response;
void *data;
ogs_sbi_message_t *message;
} sbi;
ogs_event_t h;
ogs_sbi_nf_instance_t *nf_instance;
ogs_sbi_subscription_data_t *subscription_data;
} nrf_event_t;
void nrf_event_init(void);
void nrf_event_final(void);
nrf_event_t *nrf_event_new(nrf_event_e id);
void nrf_event_free(nrf_event_t *e);
nrf_event_t *nrf_event_new(int id);
const char *nrf_event_get_name(nrf_event_t *e);

View File

@ -30,7 +30,6 @@ int nrf_initialize()
ogs_sbi_context_init();
nrf_context_init();
nrf_event_init();
rv = ogs_sbi_context_parse_config("nrf", NULL, "scp");
if (rv != OGS_OK) return rv;
@ -85,8 +84,6 @@ void nrf_terminate(void)
nrf_context_final();
ogs_sbi_context_final();
nrf_event_final(); /* Destroy event */
}
static void nrf_main(void *data)
@ -127,7 +124,7 @@ static void nrf_main(void *data)
ogs_assert(e);
ogs_fsm_dispatch(&nrf_sm, e);
nrf_event_free(e);
ogs_event_free(e);
}
}
done:

View File

@ -95,17 +95,17 @@ void nrf_nf_state_will_register(ogs_fsm_t *s, nrf_event_t *e)
nf_instance = e->nf_instance;
ogs_assert(nf_instance);
switch (e->id) {
switch (e->h.id) {
case OGS_FSM_ENTRY_SIG:
break;
case OGS_FSM_EXIT_SIG:
break;
case NRF_EVT_SBI_SERVER:
message = e->sbi.message;
case OGS_EVENT_SBI_SERVER:
message = e->h.sbi.message;
ogs_assert(message);
stream = e->sbi.data;
stream = e->h.sbi.data;
ogs_assert(stream);
SWITCH(message->h.service.name)
@ -185,7 +185,7 @@ void nrf_nf_state_registered(ogs_fsm_t *s, nrf_event_t *e)
nf_instance = e->nf_instance;
ogs_assert(nf_instance);
switch (e->id) {
switch (e->h.id) {
case OGS_FSM_ENTRY_SIG:
ogs_info("[%s] NF registered [Heartbeat:%ds]",
nf_instance->id, nf_instance->time.heartbeat_interval);
@ -212,10 +212,10 @@ void nrf_nf_state_registered(ogs_fsm_t *s, nrf_event_t *e)
OpenAPI_notification_event_type_NF_DEREGISTERED, nf_instance));
break;
case NRF_EVT_SBI_SERVER:
message = e->sbi.message;
case OGS_EVENT_SBI_SERVER:
message = e->h.sbi.message;
ogs_assert(message);
stream = e->sbi.data;
stream = e->h.sbi.data;
ogs_assert(stream);
SWITCH(message->h.service.name)
@ -300,7 +300,7 @@ void nrf_nf_state_de_registered(ogs_fsm_t *s, nrf_event_t *e)
nrf_sm_debug(e);
switch (e->id) {
switch (e->h.id) {
case OGS_FSM_ENTRY_SIG:
break;
case OGS_FSM_EXIT_SIG:
@ -318,7 +318,7 @@ void nrf_nf_state_exception(ogs_fsm_t *s, nrf_event_t *e)
nrf_sm_debug(e);
switch (e->id) {
switch (e->h.id) {
case OGS_FSM_ENTRY_SIG:
break;
case OGS_FSM_EXIT_SIG:

View File

@ -44,12 +44,18 @@ ogs_sbi_request_t *nrf_nnrf_nfm_build_nf_status_notify(
message.http.accept = (char *)OGS_SBI_CONTENT_PROBLEM_TYPE;
NotificationData = ogs_calloc(1, sizeof(*NotificationData));
ogs_expect_or_return_val(NotificationData, NULL);
if (!NotificationData) {
ogs_error("No NotificationData");
goto end;
}
NotificationData->event = event;
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;
@ -58,7 +64,10 @@ ogs_sbi_request_t *nrf_nnrf_nfm_build_nf_status_notify(
header.resource.component[1] = nf_instance->id;
NotificationData->nf_instance_uri = ogs_sbi_server_uri(server, &header);
ogs_expect_or_return_val(NotificationData->nf_instance_uri, NULL);
if (!server) {
ogs_error("No nf_instance_uri");
goto end;
}
if (event != OpenAPI_notification_event_type_NF_DEREGISTERED) {
NotificationData->nf_profile =
@ -67,19 +76,26 @@ ogs_sbi_request_t *nrf_nnrf_nfm_build_nf_status_notify(
subscription_data->subscr_cond.service_name,
NULL,
subscription_data->requester_features);
ogs_expect_or_return_val(NotificationData->nf_profile, NULL);
if (!NotificationData->nf_profile) {
ogs_error("No nf_profile");
goto end;
}
}
message.NotificationData = NotificationData;
request = ogs_sbi_build_request(&message);
ogs_expect_or_return_val(request, NULL);
ogs_expect(request);
if (NotificationData->nf_profile)
ogs_nnrf_nfm_free_nf_profile(NotificationData->nf_profile);
end:
ogs_free(NotificationData->nf_instance_uri);
ogs_free(NotificationData);
if (NotificationData) {
if (NotificationData->nf_profile)
ogs_nnrf_nfm_free_nf_profile(NotificationData->nf_profile);
if (NotificationData->nf_instance_uri)
ogs_free(NotificationData->nf_instance_uri);
ogs_free(NotificationData);
}
return request;
}

View File

@ -40,7 +40,7 @@ bool nrf_nnrf_handle_nf_register(ogs_sbi_nf_instance_t *nf_instance,
return false;
}
ogs_sbi_nnrf_handle_nf_profile(nf_instance, NFProfile);
ogs_nnrf_nfm_handle_nf_profile(nf_instance, NFProfile);
if (OGS_FSM_CHECK(&nf_instance->sm, nrf_nf_state_will_register)) {
recvmsg->http.location = recvmsg->h.uri;

View File

@ -51,17 +51,17 @@ void nrf_state_operational(ogs_fsm_t *s, nrf_event_t *e)
ogs_assert(s);
switch (e->id) {
switch (e->h.id) {
case OGS_FSM_ENTRY_SIG:
break;
case OGS_FSM_EXIT_SIG:
break;
case NRF_EVT_SBI_SERVER:
request = e->sbi.request;
case OGS_EVENT_SBI_SERVER:
request = e->h.sbi.request;
ogs_assert(request);
stream = e->sbi.data;
stream = e->h.sbi.data;
ogs_assert(stream);
rv = ogs_sbi_parse_request(&message, request);
@ -141,7 +141,7 @@ void nrf_state_operational(ogs_fsm_t *s, nrf_event_t *e)
e->nf_instance = nf_instance;
ogs_assert(OGS_FSM_STATE(&nf_instance->sm));
e->sbi.message = &message;
e->h.sbi.message = &message;
ogs_fsm_dispatch(&nf_instance->sm, e);
if (OGS_FSM_CHECK(&nf_instance->sm,
nrf_nf_state_de_registered)) {
@ -235,8 +235,8 @@ void nrf_state_operational(ogs_fsm_t *s, nrf_event_t *e)
ogs_sbi_message_free(&message);
break;
case NRF_EVT_SBI_TIMER:
switch(e->timer_id) {
case OGS_EVENT_SBI_TIMER:
switch(e->h.timer_id) {
case NRF_TIMER_NF_INSTANCE_NO_HEARTBEAT:
nf_instance = e->nf_instance;
ogs_assert(nf_instance);
@ -261,7 +261,7 @@ void nrf_state_operational(ogs_fsm_t *s, nrf_event_t *e)
default:
ogs_error("Unknown timer[%s:%d]",
nrf_timer_get_name(e->timer_id), e->timer_id);
nrf_timer_get_name(e->h.timer_id), e->h.timer_id);
}
break;

View File

@ -19,34 +19,6 @@
#include "sbi-path.h"
static int server_cb(ogs_sbi_request_t *request, void *data)
{
nrf_event_t *e = NULL;
int rv;
ogs_assert(request);
ogs_assert(data);
e = nrf_event_new(NRF_EVT_SBI_SERVER);
ogs_assert(e);
e->sbi.request = request;
e->sbi.data = data;
rv = ogs_queue_push(ogs_app()->queue, e);
if (rv != OGS_OK) {
if (rv != OGS_DONE)
ogs_error("ogs_queue_push() failed:%d", (int)rv);
else
ogs_warn("ogs_queue_push() failed:%d", (int)rv);
ogs_sbi_request_free(request);
nrf_event_free(e);
return OGS_ERROR;
}
return OGS_OK;
}
static int client_notify_cb(
int status, ogs_sbi_response_t *response, void *data)
{
@ -80,7 +52,16 @@ static int client_notify_cb(
int nrf_sbi_open(void)
{
if (ogs_sbi_server_start_all(server_cb) != OGS_OK)
ogs_sbi_nf_instance_t *nf_instance = NULL;
/* Initialize SELF NF instance */
nf_instance = ogs_sbi_self()->nf_instance;
ogs_assert(nf_instance);
/* Build NF instance information. */
ogs_sbi_nf_instance_build_default(nf_instance, OpenAPI_nf_type_NRF);
if (ogs_sbi_server_start_all(ogs_sbi_server_handler) != OGS_OK)
return OGS_ERROR;
return OGS_OK;
@ -97,18 +78,25 @@ bool nrf_nnrf_nfm_send_nf_status_notify(
OpenAPI_notification_event_type_e event,
ogs_sbi_nf_instance_t *nf_instance)
{
bool rc;
ogs_sbi_request_t *request = NULL;
ogs_sbi_client_t *client = NULL;
ogs_assert(subscription_data);
client = subscription_data->client;
ogs_assert(client);
ogs_expect_or_return_val(client, false);
request = nrf_nnrf_nfm_build_nf_status_notify(
subscription_data, event, nf_instance);
ogs_expect_or_return_val(request, false);
return ogs_sbi_scp_send_request(client, client_notify_cb, request, NULL);
rc = ogs_sbi_send_request_to_client(
client, client_notify_cb, request, NULL);
ogs_expect(rc == true);
ogs_sbi_request_free(request);
return rc;
}
bool nrf_nnrf_nfm_send_nf_status_notify_all(

View File

@ -19,9 +19,21 @@
#include "context.h"
const char *nrf_timer_get_name(nrf_timer_e id)
const char *nrf_timer_get_name(int timer_id)
{
switch (id) {
switch (timer_id) {
case OGS_TIMER_NF_INSTANCE_REGISTRATION_INTERVAL:
return OGS_TIMER_NAME_NF_INSTANCE_REGISTRATION_INTERVAL;
case OGS_TIMER_NF_INSTANCE_HEARTBEAT_INTERVAL:
return OGS_TIMER_NAME_NF_INSTANCE_HEARTBEAT_INTERVAL;
case OGS_TIMER_NF_INSTANCE_NO_HEARTBEAT:
return OGS_TIMER_NAME_NF_INSTANCE_NO_HEARTBEAT;
case OGS_TIMER_NF_INSTANCE_VALIDITY:
return OGS_TIMER_NAME_NF_INSTANCE_VALIDITY;
case OGS_TIMER_SUBSCRIPTION_VALIDITY:
return OGS_TIMER_NAME_SUBSCRIPTION_VALIDITY;
case OGS_TIMER_SBI_CLIENT_WAIT:
return OGS_TIMER_NAME_SBI_CLIENT_WAIT;
case NRF_TIMER_NF_INSTANCE_NO_HEARTBEAT:
return "NRF_TIMER_NF_INSTANCE_NO_HEARTBEAT";
case NRF_TIMER_SUBSCRIPTION_VALIDITY:
@ -30,6 +42,7 @@ const char *nrf_timer_get_name(nrf_timer_e id)
break;
}
ogs_error("Unknown Timer[%d]", timer_id);
return "UNKNOWN_TIMER";
}
@ -41,13 +54,13 @@ static void timer_send_event(int timer_id, void *data)
switch (timer_id) {
case NRF_TIMER_NF_INSTANCE_NO_HEARTBEAT:
e = nrf_event_new(NRF_EVT_SBI_TIMER);
e->timer_id = timer_id;
e = nrf_event_new(OGS_EVENT_SBI_TIMER);
e->h.timer_id = timer_id;
e->nf_instance = data;
break;
case NRF_TIMER_SUBSCRIPTION_VALIDITY:
e = nrf_event_new(NRF_EVT_SBI_TIMER);
e->timer_id = timer_id;
e = nrf_event_new(OGS_EVENT_SBI_TIMER);
e->h.timer_id = timer_id;
e->subscription_data = data;
break;
default:
@ -59,7 +72,7 @@ static void timer_send_event(int timer_id, void *data)
rv = ogs_queue_push(ogs_app()->queue, e);
if (rv != OGS_OK) {
ogs_error("ogs_queue_push() failed:%d", (int)rv);
nrf_event_free(e);
ogs_event_free(e);
}
}

View File

@ -28,7 +28,7 @@ extern "C" {
/* forward declaration */
typedef enum {
NRF_TIMER_BASE = 0,
NRF_TIMER_BASE = OGS_MAX_NUM_OF_PROTO_TIMER,
NRF_TIMER_NF_INSTANCE_NO_HEARTBEAT,
NRF_TIMER_SUBSCRIPTION_VALIDITY,
@ -38,7 +38,7 @@ typedef enum {
} nrf_timer_e;
const char *nrf_timer_get_name(nrf_timer_e id);
const char *nrf_timer_get_name(int timer_id);
void nrf_timer_nf_instance_no_heartbeat(void *data);
void nrf_timer_subscription_validity(void *data);

View File

@ -32,6 +32,8 @@ typedef struct nssf_event_s {
ogs_event_t h;
} nssf_event_t;
OGS_STATIC_ASSERT(OGS_EVENT_SIZE >= sizeof(nssf_event_t));
nssf_event_t *nssf_event_new(int id);
const char *nssf_event_get_name(nssf_event_t *e);

View File

@ -179,7 +179,7 @@ void nssf_state_operational(ogs_fsm_t *s, nssf_event_t *e)
CASE(OGS_SBI_HTTP_METHOD_POST)
if (message.res_status == OGS_SBI_HTTP_STATUS_CREATED ||
message.res_status == OGS_SBI_HTTP_STATUS_OK) {
ogs_nnrf_handle_nf_status_subscribe(
ogs_nnrf_nfm_handle_nf_status_subscribe(
subscription_data, &message);
} else {
ogs_error("[%s] HTTP response error [%d]",

View File

@ -19,67 +19,12 @@
#include "sbi-path.h"
static int server_cb(ogs_sbi_request_t *request, void *data)
{
nssf_event_t *e = NULL;
int rv;
ogs_assert(request);
ogs_assert(data);
e = nssf_event_new(OGS_EVENT_SBI_SERVER);
ogs_assert(e);
e->h.sbi.request = request;
e->h.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;
}
static int client_cb(int status, ogs_sbi_response_t *response, void *data)
{
nssf_event_t *e = NULL;
int rv;
if (status != OGS_OK) {
ogs_log_message(
status == OGS_DONE ? OGS_LOG_DEBUG : OGS_LOG_WARN, 0,
"client_cb() failed [%d]", status);
return OGS_ERROR;
}
ogs_assert(response);
e = nssf_event_new(OGS_EVENT_SBI_CLIENT);
ogs_assert(e);
e->h.sbi.response = response;
e->h.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;
}
int nssf_sbi_open(void)
{
ogs_sbi_nf_instance_t *nf_instance = NULL;
ogs_sbi_nf_service_t *service = NULL;
/* Add SELF NF instance */
/* Initialize SELF NF instance */
nf_instance = ogs_sbi_self()->nf_instance;
ogs_assert(nf_instance);
ogs_sbi_nf_fsm_init(nf_instance);
@ -102,20 +47,10 @@ int nssf_sbi_open(void)
/* Initialize NRF NF Instance */
nf_instance = ogs_sbi_self()->nrf_instance;
if (nf_instance) {
ogs_sbi_client_t *client = NULL;
/* Client callback is only used when NF sends to NRF */
client = nf_instance->client;
ogs_assert(client);
client->cb = client_cb;
/* NFRegister is sent and the response is received
* by the above client callback. */
if (nf_instance)
ogs_sbi_nf_fsm_init(nf_instance);
}
if (ogs_sbi_server_start_all(server_cb) != OGS_OK)
if (ogs_sbi_server_start_all(ogs_sbi_server_handler) != OGS_OK)
return OGS_ERROR;
return OGS_OK;

View File

@ -38,6 +38,8 @@ typedef struct pcf_event_s {
pcf_app_t *app;
} pcf_event_t;
OGS_STATIC_ASSERT(OGS_EVENT_SIZE >= sizeof(pcf_event_t));
pcf_event_t *pcf_event_new(int id);
const char *pcf_event_get_name(pcf_event_t *e);

View File

@ -31,12 +31,18 @@ ogs_sbi_request_t *pcf_naf_callback_build_policyauthorization_terminate(
message.h.method = (char *)OGS_SBI_HTTP_METHOD_POST;
message.h.uri = ogs_msprintf("%s/%s",
app_session->notif_uri, OGS_SBI_RESOURCE_NAME_TERMINATE);
ogs_assert(message.h.uri);
if (!message.h.uri) {
ogs_error("No message.h.uri");
goto end;
}
request = ogs_sbi_build_request(&message);
ogs_assert(request);
ogs_free(message.h.uri);
end:
if (message.h.uri)
ogs_free(message.h.uri);
return request;
}

View File

@ -59,18 +59,27 @@ ogs_sbi_request_t *pcf_nbsf_management_build_register(
PcfBinding.ipv4_addr = sess->ipv4addr_string;
PcfBinding.ipv6_prefix = sess->ipv6prefix_string;
ogs_expect_or_return_val(sess->dnn, NULL);
if (!sess->dnn) {
ogs_error("No DNN");
goto end;
}
PcfBinding.dnn = sess->dnn;
nf_service = ogs_sbi_nf_service_find_by_name(
nf_instance, (char *)OGS_SBI_SERVICE_NAME_NPCF_POLICYAUTHORIZATION);
ogs_expect_or_return_val(nf_service, NULL);
if (!nf_service) {
ogs_error("No NF-Service");
goto end;
}
if (nf_service->fqdn)
PcfBinding.pcf_fqdn = ogs_strdup(nf_service->fqdn);
PcfIpEndPointList = OpenAPI_list_create();
ogs_assert(PcfIpEndPointList);
PcfBinding.pcf_ip_end_points = PcfIpEndPointList = OpenAPI_list_create();
if (!PcfIpEndPointList) {
ogs_error("No PcfIpEndPointList");
goto end;
}
for (i = 0; i < nf_service->num_of_addr; i++) {
ogs_sockaddr_t *ipv4 = NULL;
@ -83,15 +92,30 @@ ogs_sbi_request_t *pcf_nbsf_management_build_register(
if (ipv4 || ipv6) {
IpEndPoint = ogs_calloc(1, sizeof(*IpEndPoint));
ogs_expect_or_return_val(IpEndPoint, NULL);
if (!IpEndPoint) {
ogs_error("No IpEndPoint");
goto end;
}
if (ipv4) {
IpEndPoint->ipv4_address = ogs_ipstrdup(ipv4);
ogs_expect_or_return_val(IpEndPoint->ipv4_address, NULL);
if (!IpEndPoint->ipv4_address) {
ogs_error("No IpEndPoint->ipv4_address");
if (IpEndPoint)
ogs_free(IpEndPoint);
goto end;
}
}
if (ipv6) {
IpEndPoint->ipv6_address = ogs_ipstrdup(ipv6);
ogs_expect_or_return_val(IpEndPoint->ipv6_address, NULL);
if (!IpEndPoint->ipv6_address) {
ogs_error("No IpEndPoint->ipv6_address");
if (IpEndPoint) {
if (IpEndPoint->ipv6_address)
ogs_free(IpEndPoint->ipv6_address);
ogs_free(IpEndPoint);
}
goto end;
}
}
IpEndPoint->is_port = true;
IpEndPoint->port = nf_service->addr[i].port;
@ -99,12 +123,10 @@ ogs_sbi_request_t *pcf_nbsf_management_build_register(
}
}
if (PcfIpEndPointList->count)
PcfBinding.pcf_ip_end_points = PcfIpEndPointList;
else
OpenAPI_list_free(PcfIpEndPointList);
ogs_expect_or_return_val(sess->s_nssai.sst, NULL);
if (!sess->s_nssai.sst) {
ogs_error("No SST");
goto end;
}
memset(&sNssai, 0, sizeof(sNssai));
sNssai.sst = sess->s_nssai.sst;
sNssai.sd = ogs_s_nssai_sd_to_string(sess->s_nssai.sd);
@ -112,13 +134,18 @@ ogs_sbi_request_t *pcf_nbsf_management_build_register(
if (sess->management_features) {
PcfBinding.supp_feat = ogs_uint64_to_string(sess->management_features);
ogs_expect_or_return_val(PcfBinding.supp_feat, NULL);
if (!PcfBinding.supp_feat) {
ogs_error("No supp_feat");
goto end;
}
}
message.PcfBinding = &PcfBinding;
request = ogs_sbi_build_request(&message);
ogs_expect(request);
end:
if (sNssai.sd)
ogs_free(sNssai.sd);

View File

@ -33,6 +33,7 @@ void pcf_nnrf_handle_nf_discover(
pcf_sess_t *sess = NULL;
OpenAPI_nf_type_e target_nf_type = OpenAPI_nf_type_NULL;
OpenAPI_nf_type_e requester_nf_type = OpenAPI_nf_type_NULL;
OpenAPI_search_result_t *SearchResult = NULL;
ogs_assert(recvmsg);
@ -43,6 +44,8 @@ void pcf_nnrf_handle_nf_discover(
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;
stream = xact->assoc_stream;
@ -67,15 +70,16 @@ void pcf_nnrf_handle_nf_discover(
ogs_assert_if_reached();
}
ogs_nnrf_handle_nf_discover_search_result(SearchResult);
ogs_nnrf_disc_handle_nf_discover_search_result(SearchResult);
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_error("[%s:%d] (NF discover) No [%s]",
ogs_error("[%s:%d] (NF discover) No [%s:%s]",
pcf_ue ? pcf_ue->supi : "Unknown",
sess ? sess->psi : 0,
ogs_sbi_service_type_to_name(service_type));
ogs_sbi_service_type_to_name(service_type),
OpenAPI_nf_type_ToString(requester_nf_type));
return;
}

View File

@ -35,7 +35,10 @@ ogs_sbi_request_t *pcf_nsmf_callback_build_smpolicycontrol_update(
ogs_assert(sess->notification_uri);
server = ogs_list_first(&ogs_sbi_self()->server_list);
ogs_assert(server);
if (!server) {
ogs_error("No server");
goto end;
}
memset(&header, 0, sizeof(header));
header.service.name = (char *)OGS_SBI_SERVICE_NAME_NPCF_SMPOLICYCONTROL;
@ -47,7 +50,10 @@ ogs_sbi_request_t *pcf_nsmf_callback_build_smpolicycontrol_update(
memset(&SmPolicyNotification, 0, sizeof(SmPolicyNotification));
SmPolicyNotification.resource_uri = ogs_sbi_server_uri(server, &header);
ogs_assert(SmPolicyNotification.resource_uri);
if (!SmPolicyNotification.resource_uri) {
ogs_error("No resource_uri");
goto end;
}
SmPolicyDecision = data;
ogs_assert(SmPolicyDecision);
@ -58,15 +64,22 @@ ogs_sbi_request_t *pcf_nsmf_callback_build_smpolicycontrol_update(
message.h.method = (char *)OGS_SBI_HTTP_METHOD_POST;
message.h.uri = ogs_msprintf("%s/%s",
sess->notification_uri, OGS_SBI_RESOURCE_NAME_UPDATE);
ogs_assert(message.h.uri);
if (!message.h.uri) {
ogs_error("No message.h.uri");
goto end;
}
message.SmPolicyNotification = &SmPolicyNotification;
request = ogs_sbi_build_request(&message);
ogs_assert(request);
ogs_free(SmPolicyNotification.resource_uri);
ogs_free(message.h.uri);
end:
if (SmPolicyNotification.resource_uri)
ogs_free(SmPolicyNotification.resource_uri);
if (message.h.uri)
ogs_free(message.h.uri);
return request;
}
@ -93,12 +106,18 @@ ogs_sbi_request_t *pcf_nsmf_callback_build_smpolicycontrol_terminate(
message.h.method = (char *)OGS_SBI_HTTP_METHOD_POST;
message.h.uri = ogs_msprintf("%s/%s",
sess->notification_uri, OGS_SBI_RESOURCE_NAME_TERMINATE);
ogs_assert(message.h.uri);
if (!message.h.uri) {
ogs_error("No message.h.uri");
goto end;
}
request = ogs_sbi_build_request(&message);
ogs_assert(request);
ogs_free(message.h.uri);
end:
if (message.h.uri)
ogs_free(message.h.uri);
return request;
}

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