Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
O
OpenXG-AMF
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
1
Issues
1
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Metrics
Environments
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
OpenXG
OpenXG-AMF
Commits
7200c2e2
Commit
7200c2e2
authored
3 years ago
by
Raphael Defosseux
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'http2fix' into 'develop'
HTTP v2 Fix See merge request oai/cn5g/oai-cn5g-amf!85
parents
7a5ee444
5cfe2151
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
66 additions
and
33 deletions
+66
-33
etc/amf.conf
etc/amf.conf
+1
-1
scripts/entrypoint.sh
scripts/entrypoint.sh
+1
-0
src/amf-app/amf_config.cpp
src/amf-app/amf_config.cpp
+6
-1
src/amf-app/amf_n11.cpp
src/amf-app/amf_n11.cpp
+50
-26
src/amf-app/amf_n11.hpp
src/amf-app/amf_n11.hpp
+7
-5
src/contexts/pdu_session_context.hpp
src/contexts/pdu_session_context.hpp
+1
-0
No files found.
etc/amf.conf
View file @
7200c2e2
...
...
@@ -115,7 +115,7 @@ AMF =
EXTERNAL_AUSF
=
"@EXTERNAL_AUSF@"
;
# Set to yes if AMF works with an external AUSF
EXTERNAL_UDM
=
"@EXTERNAL_UDM@"
;
# Set to yes if AMF works with an external UDM
USE_FQDN_DNS
=
"@USE_FQDN_DNS@"
;
# Set to yes if AMF relies on a DNS to resolve NRF/SMF/UDM/AUSF's FQDN
USE_HTTP2
=
"
no
"
;
# Set to yes to enable HTTP2 for AMF server
USE_HTTP2
=
"
@USE_HTTP2@
"
;
# Set to yes to enable HTTP2 for AMF server
}
AUTHENTICATION
:
...
...
This diff is collapsed.
Click to expand it.
scripts/entrypoint.sh
View file @
7200c2e2
...
...
@@ -14,6 +14,7 @@ NSSF_API_VERSION=${NSSF_API_VERSION:-v2}
NSSF_FQDN
=
${
NSSF_FQDN
:-
oai
-nssf
}
INT_ALGO_LIST
=
${
INT_ALGO_LIST
:-
'[ "NIA0" , "NIA1" , "NIA2" ]'
}
CIPH_ALGO_LIST
=
${
CIPH_ALGO_LIST
:-
'[ "NEA0" , "NEA1" , "NEA2" ]'
}
USE_HTTP2
=
${
USE_HTTP2
:-
no
}
if
[[
${
USE_FQDN_DNS
}
==
"yes"
]]
;
then
NSSF_IPV4_ADDR
=
${
NSSF_IPV4_ADDR_0
:-
0
.0.0.0
}
...
...
This diff is collapsed.
Click to expand it.
src/amf-app/amf_config.cpp
View file @
7200c2e2
...
...
@@ -458,7 +458,12 @@ int amf_config::load(const std::string& config_file) {
IPV4_STR_ADDR_TO_INADDR
(
util
::
trim
(
address
).
c_str
(),
ausf_ipv4_addr
,
"BAD IPv4 ADDRESS FORMAT FOR AUSF !"
);
ausf_addr
.
ipv4_addr
=
ausf_ipv4_addr
;
ausf_addr
.
ipv4_addr
=
ausf_ipv4_addr
;
// We hardcode nrf port from config for the moment
if
(
!
(
ausf_cfg
.
lookupValue
(
AMF_CONFIG_STRING_PORT
,
ausf_port
)))
{
Logger
::
amf_app
().
error
(
AMF_CONFIG_STRING_PORT
"failed"
);
throw
(
AMF_CONFIG_STRING_PORT
"failed"
);
}
ausf_addr
.
port
=
ausf_port
;
ausf_addr
.
api_version
=
"v1"
;
// TODO: get API version
}
...
...
This diff is collapsed.
Click to expand it.
src/amf-app/amf_n11.cpp
View file @
7200c2e2
...
...
@@ -205,12 +205,14 @@ void amf_n11::handle_itti_message(
}
std
::
string
smf_addr
=
{};
std
::
string
smf_port
=
{};
std
::
string
smf_api_version
=
{};
if
(
!
psc
.
get
()
->
smf_available
)
{
Logger
::
amf_n11
().
error
(
"No SMF is available for this PDU session"
);
}
else
{
smf_addr
=
psc
->
smf_addr
;
smf_port
=
psc
->
smf_port
;
smf_api_version
=
psc
->
smf_api_version
;
}
...
...
@@ -228,7 +230,8 @@ void amf_n11::handle_itti_message(
if
(
found
!=
std
::
string
::
npos
)
remote_uri
=
psc
.
get
()
->
smf_context_location
+
"/modify"
;
else
remote_uri
=
smf_addr
+
psc
.
get
()
->
smf_context_location
+
"/modify"
;
remote_uri
=
smf_addr
+
":"
+
smf_port
+
psc
.
get
()
->
smf_context_location
+
"/modify"
;
Logger
::
amf_n11
().
debug
(
"SMF URI: %s"
,
remote_uri
.
c_str
());
...
...
@@ -253,7 +256,7 @@ void amf_n11::handle_itti_message(
std
::
string
json_part
=
pdu_session_update_request
.
dump
();
uint8_t
http_version
=
1
;
//
if (amf_cfg.support_features.use_http2) http_version = 2;
if
(
amf_cfg
.
support_features
.
use_http2
)
http_version
=
2
;
curl_http_client
(
remote_uri
,
json_part
,
""
,
n2SmMsg
,
supi
,
itti_msg
.
pdu_session_id
,
...
...
@@ -335,19 +338,20 @@ void amf_n11::handle_itti_message(itti_nsmf_pdusession_create_sm_context& smf) {
std
::
string
smf_addr
=
{};
std
::
string
smf_api_version
=
{};
std
::
string
smf_port
=
"80"
;
// Set to default port number
if
(
!
psc
.
get
()
->
smf_available
)
{
if
(
amf_cfg
.
support_features
.
enable_nrf_selection
)
{
if
(
!
discover_smf_from_nsi_info
(
smf_addr
,
smf_api_version
,
psc
.
get
()
->
snssai
,
psc
.
get
()
->
plmn
,
psc
.
get
()
->
dnn
))
{
smf_addr
,
smf_api_version
,
smf_port
,
psc
.
get
()
->
snssai
,
psc
.
get
()
->
plmn
,
psc
.
get
()
->
dnn
))
{
Logger
::
amf_n11
().
error
(
"NRF Selection, no NRF candidate is available"
);
return
;
}
}
else
if
(
amf_cfg
.
support_features
.
enable_smf_selection
)
{
// use NRF to find suitable SMF based on snssai, plmn and dnn
if
(
!
discover_smf
(
smf_addr
,
smf_api_version
,
psc
.
get
()
->
snssai
,
psc
.
get
()
->
plmn
,
psc
.
get
()
->
dnn
))
{
smf_addr
,
smf_api_version
,
smf_port
,
psc
.
get
()
->
snssai
,
psc
.
get
()
->
plmn
,
psc
.
get
()
->
dnn
))
{
Logger
::
amf_n11
().
error
(
"SMF Selection, no SMF candidate is available"
);
return
;
}
...
...
@@ -359,6 +363,7 @@ void amf_n11::handle_itti_message(itti_nsmf_pdusession_create_sm_context& smf) {
// store smf info to be used with this PDU session
psc
.
get
()
->
smf_available
=
true
;
psc
->
smf_addr
=
smf_addr
;
psc
->
smf_port
=
smf_port
;
psc
->
smf_api_version
=
smf_api_version
;
}
else
{
smf_addr
=
psc
->
smf_addr
;
...
...
@@ -374,7 +379,7 @@ void amf_n11::handle_itti_message(itti_nsmf_pdusession_create_sm_context& smf) {
"Decoded PTI for PDUSessionEstablishmentRequest(0x%x)"
,
pti
);
psc
.
get
()
->
isn2sm_avaliable
=
false
;
handle_pdu_session_initial_request
(
supi
,
psc
,
smf_addr
,
smf_api_version
,
smf
.
sm_msg
,
dnn
);
supi
,
psc
,
smf_addr
,
smf_api_version
,
smf
_port
,
smf
.
sm_msg
,
dnn
);
}
break
;
case
EXISTING_PDU_SESSION
:
{
// TODO:
...
...
@@ -397,8 +402,8 @@ void amf_n11::send_pdu_session_update_sm_context_request(
std
::
string
smf_addr
,
bstring
sm_msg
,
std
::
string
dnn
)
{
Logger
::
amf_n11
().
debug
(
"Send PDU Session Update SM Context Request to SMF (SUPI %s, PDU Session "
"ID %d)"
,
supi
.
c_str
(),
psc
.
get
()
->
pdu_session_id
);
"ID %d
, %s
)"
,
supi
.
c_str
(),
psc
.
get
()
->
pdu_session_id
,
smf_addr
.
c_str
()
);
std
::
string
smf_ip_addr
=
{};
std
::
string
remote_uri
=
{};
...
...
@@ -425,7 +430,7 @@ void amf_n11::send_pdu_session_update_sm_context_request(
octet_stream_2_hex_stream
((
uint8_t
*
)
bdata
(
sm_msg
),
blength
(
sm_msg
),
n1SmMsg
);
uint8_t
http_version
=
1
;
if
(
amf_cfg
.
support_features
.
use_http2
)
http_version
=
2
;
//
if (amf_cfg.support_features.use_http2) http_version = 2;
curl_http_client
(
remote_uri
,
json_part
,
n1SmMsg
,
""
,
supi
,
psc
.
get
()
->
pdu_session_id
,
...
...
@@ -435,15 +440,27 @@ void amf_n11::send_pdu_session_update_sm_context_request(
//------------------------------------------------------------------------------
void
amf_n11
::
handle_pdu_session_initial_request
(
std
::
string
supi
,
std
::
shared_ptr
<
pdu_session_context
>
psc
,
std
::
string
smf_addr
,
std
::
string
smf_api_version
,
bstring
sm_msg
,
std
::
string
dnn
)
{
std
::
string
smf_addr
,
std
::
string
smf_api_version
,
std
::
string
smf_port
,
bstring
sm_msg
,
std
::
string
dnn
)
{
Logger
::
amf_n11
().
debug
(
"Handle PDU Session Establishment Request (SUPI %s, PDU Session ID %d)"
,
supi
.
c_str
(),
psc
.
get
()
->
pdu_session_id
);
// remove http port from the URI if existed
std
::
string
smf_ip_addr
=
{};
std
::
size_t
found_port
=
smf_addr
.
find
(
":"
);
if
(
found_port
!=
std
::
string
::
npos
)
smf_ip_addr
=
smf_addr
.
substr
(
0
,
found_port
);
else
smf_ip_addr
=
smf_addr
;
// provide http2 port if enabled
std
::
string
amf_port
=
to_string
(
amf_cfg
.
n11
.
port
);
if
(
amf_cfg
.
support_features
.
use_http2
)
amf_port
=
to_string
(
amf_cfg
.
sbi_http2_port
);
// TODO: Remove hardcoded values
std
::
string
remote_uri
=
smf_addr
+
"/nsmf-pdusession/"
+
smf_api_version
+
"/sm-contexts"
;
std
::
string
remote_uri
=
smf_ip_addr
+
":"
+
smf_port
+
"/nsmf-pdusession/"
+
smf_api_version
+
"/sm-contexts"
;
nlohmann
::
json
pdu_session_establishment_request
;
pdu_session_establishment_request
[
"supi"
]
=
supi
.
c_str
();
pdu_session_establishment_request
[
"pei"
]
=
"imei-200000000000001"
;
...
...
@@ -463,8 +480,8 @@ void amf_n11::handle_pdu_session_initial_request(
pdu_session_establishment_request
[
"anType"
]
=
"3GPP_ACCESS"
;
// TODO
pdu_session_establishment_request
[
"smContextStatusUri"
]
=
"http://"
+
std
::
string
(
inet_ntoa
(
*
((
struct
in_addr
*
)
&
amf_cfg
.
n11
.
addr4
)))
+
"/nsmf-pdusession/callback/"
+
supi
+
"/"
+
std
::
string
(
inet_ntoa
(
*
((
struct
in_addr
*
)
&
amf_cfg
.
n11
.
addr4
)))
+
":"
+
amf_port
+
"/nsmf-pdusession/callback/"
+
supi
+
"/"
+
std
::
to_string
(
psc
.
get
()
->
pdu_session_id
);
pdu_session_establishment_request
[
"n1MessageContainer"
][
"n1MessageClass"
]
=
...
...
@@ -480,7 +497,7 @@ void amf_n11::handle_pdu_session_initial_request(
octet_stream_2_hex_stream
((
uint8_t
*
)
bdata
(
sm_msg
),
blength
(
sm_msg
),
n1SmMsg
);
uint8_t
http_version
=
1
;
//
if (amf_cfg.support_features.use_http2) http_version = 2;
if
(
amf_cfg
.
support_features
.
use_http2
)
http_version
=
2
;
curl_http_client
(
remote_uri
,
json_part
,
n1SmMsg
,
""
,
supi
,
psc
.
get
()
->
pdu_session_id
,
...
...
@@ -910,8 +927,8 @@ void amf_n11::curl_http_client(
}
//-----------------------------------------------------------------------------------------------------
bool
amf_n11
::
discover_smf_from_nsi_info
(
std
::
string
&
smf_addr
,
std
::
string
&
smf_api_version
,
const
snssai_t
snssai
,
const
plmn_t
plmn
,
const
std
::
string
dnn
)
{
std
::
string
&
smf_addr
,
std
::
string
&
smf_api_version
,
std
::
string
&
smf_port
,
const
snssai_t
snssai
,
const
plmn_t
plmn
,
const
std
::
string
dnn
)
{
Logger
::
amf_n11
().
debug
(
"Send NS Selection to NSSF to discover the appropriate NRF"
);
...
...
@@ -1025,17 +1042,18 @@ bool amf_n11::discover_smf_from_nsi_info(
Logger
::
amf_n11
().
debug
(
"NSI Inforation is successfully retrieved from NSSF"
);
if
(
!
discover_smf
(
smf_addr
,
smf_api_version
,
s
nssai
,
plmn
,
dnn
,
nrf_addr
,
nrf_port
,
nrf_api_version
))
smf_addr
,
smf_api_version
,
s
mf_port
,
snssai
,
plmn
,
dnn
,
nrf_addr
,
nrf_
port
,
nrf_
api_version
))
return
false
;
return
true
;
}
//-----------------------------------------------------------------------------------------------------
bool
amf_n11
::
discover_smf
(
std
::
string
&
smf_addr
,
std
::
string
&
smf_api_version
,
const
snssai_t
snssai
,
const
plmn_t
plmn
,
const
std
::
string
dnn
,
const
std
::
string
&
nrf_addr
,
const
std
::
string
&
nrf_port
,
const
std
::
string
&
nrf_api_version
)
{
std
::
string
&
smf_addr
,
std
::
string
&
smf_api_version
,
std
::
string
&
smf_port
,
const
snssai_t
snssai
,
const
plmn_t
plmn
,
const
std
::
string
dnn
,
const
std
::
string
&
nrf_addr
,
const
std
::
string
&
nrf_port
,
const
std
::
string
&
nrf_api_version
)
{
Logger
::
amf_n11
().
debug
(
"Send NFDiscovery to NRF to discover the available SMFs"
);
bool
result
=
false
;
...
...
@@ -1156,6 +1174,12 @@ bool amf_n11::discover_smf(
nf_version
[
"apiVersionInUri"
].
get
<
std
::
string
>
();
}
}
if
(
nf_service
.
find
(
"ipEndPoints"
)
!=
nf_service
.
end
())
{
nlohmann
::
json
nf_ip_end
=
nf_service
[
"ipEndPoints"
].
at
(
0
);
if
(
nf_ip_end
.
find
(
"port"
)
!=
nf_ip_end
.
end
())
{
smf_port
=
to_string
(
nf_ip_end
[
"port"
].
get
<
int
>
()).
c_str
();
}
}
}
}
...
...
@@ -1164,8 +1188,8 @@ bool amf_n11::discover_smf(
}
}
Logger
::
amf_n11
().
debug
(
"NFDiscovery, SMF Addr: %s, SMF Api Version: %s
"
,
smf_addr
.
c_str
()
,
smf_a
pi_version
.
c_str
());
"NFDiscovery, SMF Addr: %s, SMF Api Version: %s
, SMF Port: %s"
,
smf_a
ddr
.
c_str
(),
smf_api_version
.
c_str
(),
smf_port
.
c_str
());
}
else
{
Logger
::
amf_n11
().
warn
(
"NFDiscovery, could not get response from NRF"
);
result
=
false
;
...
...
This diff is collapsed.
Click to expand it.
src/amf-app/amf_n11.hpp
View file @
7200c2e2
...
...
@@ -53,8 +53,8 @@ class amf_n11 {
void
handle_itti_message
(
itti_nsmf_pdusession_create_sm_context
&
);
void
handle_pdu_session_initial_request
(
std
::
string
supi
,
std
::
shared_ptr
<
pdu_session_context
>
psc
,
std
::
string
smf_addr
,
std
::
string
smf_api_version
,
bstring
sm_msg
,
std
::
string
dnn
);
std
::
string
smf_addr
,
std
::
string
smf_api_version
,
std
::
string
smf_port
,
bstring
sm_msg
,
std
::
string
dnn
);
void
handle_itti_message
(
itti_nsmf_pdusession_update_sm_context
&
itti_msg
);
void
handle_itti_message
(
itti_nsmf_pdusession_release_sm_context
&
itti_msg
);
void
handle_itti_message
(
itti_pdu_session_resource_setup_response
&
itti_msg
);
...
...
@@ -82,12 +82,14 @@ class amf_n11 {
bool
discover_smf_from_nsi_info
(
std
::
string
&
smf_addr
,
std
::
string
&
smf_api_version
,
const
snssai_t
snssai
,
const
plmn_t
plmn
,
const
std
::
string
dnn
);
std
::
string
&
smf_port
,
const
snssai_t
snssai
,
const
plmn_t
plmn
,
const
std
::
string
dnn
);
bool
discover_smf
(
std
::
string
&
smf_addr
,
std
::
string
&
smf_api_version
,
const
snssai_t
snssai
,
const
plmn_t
plmn
,
const
std
::
string
dnn
,
const
std
::
string
&
nrf_addr
=
{},
const
std
::
string
&
nrf_port
=
{},
std
::
string
&
smf_port
,
const
snssai_t
snssai
,
const
plmn_t
plmn
,
const
std
::
string
dnn
,
const
std
::
string
&
nrf_addr
=
{},
const
std
::
string
&
nrf_port
=
{},
const
std
::
string
&
nrf_api_version
=
{});
void
register_nf_instance
(
...
...
This diff is collapsed.
Click to expand it.
src/contexts/pdu_session_context.hpp
View file @
7200c2e2
...
...
@@ -49,6 +49,7 @@ class pdu_session_context {
bool
isn1sm_avaliable
;
std
::
string
dnn
;
std
::
string
smf_addr
;
std
::
string
smf_port
;
std
::
string
smf_api_version
;
bool
smf_available
;
std
::
string
location
;
...
...
This diff is collapsed.
Click to expand it.
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment