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
b1e2e4ea
Commit
b1e2e4ea
authored
Jan 27, 2022
by
Tien-Thinh Nguyen
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
First version for Get Network Slice Selection from NSSF
parent
182acb4d
Changes
10
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
10 changed files
with
567 additions
and
448 deletions
+567
-448
etc/amf.conf
etc/amf.conf
+1
-0
src/amf-app/amf_config.cpp
src/amf-app/amf_config.cpp
+12
-0
src/amf-app/amf_config.hpp
src/amf-app/amf_config.hpp
+2
-0
src/amf-app/amf_n1.cpp
src/amf-app/amf_n1.cpp
+75
-10
src/amf-app/amf_n1.hpp
src/amf-app/amf_n1.hpp
+5
-0
src/amf-app/amf_n11.cpp
src/amf-app/amf_n11.cpp
+448
-435
src/amf-app/amf_n11.hpp
src/amf-app/amf_n11.hpp
+4
-2
src/common/3gpp_29.500.h
src/common/3gpp_29.500.h
+1
-1
src/itti/itti_msg.hpp
src/itti/itti_msg.hpp
+1
-0
src/itti/msgs/itti_msg_n11.hpp
src/itti/msgs/itti_msg_n11.hpp
+18
-0
No files found.
etc/amf.conf
View file @
b1e2e4ea
...
...
@@ -114,6 +114,7 @@ AMF =
SMF_SELECTION
=
"@SMF_SELECTION@"
;
# Set to yes to enable SMF discovery and selection
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
EXTERNAL_NSSF
=
"no"
;
# Set to yes if AMF works with an external NSSF
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
}
...
...
src/amf-app/amf_config.cpp
View file @
b1e2e4ea
...
...
@@ -82,6 +82,7 @@ amf_config::amf_config() {
support_features
.
enable_smf_selection
=
false
;
support_features
.
enable_external_ausf
=
false
;
support_features
.
enable_external_udm
=
false
;
support_features
.
enable_external_nssf
=
false
;
support_features
.
use_fqdn_dns
=
false
;
support_features
.
use_http2
=
false
;
// TODO:
...
...
@@ -270,6 +271,14 @@ int amf_config::load(const std::string& config_file) {
support_features
.
enable_external_udm
=
false
;
}
support_features_cfg
.
lookupValue
(
AMF_CONFIG_STRING_SUPPORT_FEATURES_EXTERNAL_NSSF
,
opt
);
if
(
boost
::
iequals
(
opt
,
"yes"
))
{
support_features
.
enable_external_nssf
=
true
;
}
else
{
support_features
.
enable_external_nssf
=
false
;
}
support_features_cfg
.
lookupValue
(
AMF_CONFIG_STRING_SUPPORT_FEATURES_USE_FQDN_DNS
,
opt
);
if
(
boost
::
iequals
(
opt
,
"yes"
))
{
...
...
@@ -706,6 +715,9 @@ void amf_config::display() {
Logger
::
config
().
info
(
" External UDM ..........: %s"
,
support_features
.
enable_external_udm
?
"Yes"
:
"No"
);
Logger
::
config
().
info
(
" External NSSF .........: %s"
,
support_features
.
enable_external_nssf
?
"Yes"
:
"No"
);
Logger
::
config
().
info
(
" Use FQDN ..............: %s"
,
support_features
.
use_fqdn_dns
?
"Yes"
:
"No"
);
...
...
src/amf-app/amf_config.hpp
View file @
b1e2e4ea
...
...
@@ -108,6 +108,7 @@
#define AMF_CONFIG_STRING_SUPPORT_FEATURES_SMF_SELECTION "SMF_SELECTION"
#define AMF_CONFIG_STRING_SUPPORT_FEATURES_EXTERNAL_AUSF "EXTERNAL_AUSF"
#define AMF_CONFIG_STRING_SUPPORT_FEATURES_EXTERNAL_UDM "EXTERNAL_UDM"
#define AMF_CONFIG_STRING_SUPPORT_FEATURES_EXTERNAL_NSSF "EXTERNAL_NSSF"
#define AMF_CONFIG_STRING_SUPPORT_FEATURES_USE_FQDN_DNS "USE_FQDN_DNS"
#define AMF_CONFIG_STRING_SUPPORT_FEATURES_USE_HTTP2 "USE_HTTP2"
...
...
@@ -231,6 +232,7 @@ class amf_config {
bool
enable_smf_selection
;
bool
enable_external_ausf
;
bool
enable_external_udm
;
bool
enable_external_nssf
;
bool
use_fqdn_dns
;
bool
use_http2
;
}
support_features
;
...
...
src/amf-app/amf_n1.cpp
View file @
b1e2e4ea
...
...
@@ -1583,8 +1583,9 @@ bool amf_n1::_5g_aka_confirmation_from_ausf(
Logger
::
amf_n1
().
debug
(
"_5g_aka_confirmation_from_ausf"
);
std
::
string
remoteUri
=
nc
.
get
()
->
Href
;
std
::
string
msgBody
=
{};
std
::
string
response
=
{};
std
::
string
msgBody
=
{};
// std::string response = {};
nlohmann
::
json
response
=
{};
std
::
string
resStar_string
=
{};
std
::
map
<
std
::
string
,
std
::
string
>::
iterator
iter
;
...
...
@@ -1619,7 +1620,8 @@ bool amf_n1::_5g_aka_confirmation_from_ausf(
free_wrapper
((
void
**
)
&
resStar_s
);
try
{
ConfirmationDataResponse
confirmationdataresponse
;
nlohmann
::
json
::
parse
(
response
.
c_str
()).
get_to
(
confirmationdataresponse
);
// nlohmann::json::parse(response.c_str()).get_to(confirmationdataresponse);
response
.
get_to
(
confirmationdataresponse
);
unsigned
char
*
kseaf_hex
=
conv
::
format_string_as_hex
(
confirmationdataresponse
.
getKseaf
());
memcpy
(
nc
.
get
()
->
_5g_av
[
0
].
kseaf
,
kseaf_hex
,
32
);
...
...
@@ -3707,8 +3709,8 @@ bool amf_n1::reroute_registration_request(std::shared_ptr<nas_context>& nc) {
"Registration with AMF re-allocation, Reroute Registration Request to "
"the target AMF"
);
nssai_t
nssai
=
{};
if
(
!
get_slice_selection_subscription_data
(
nc
,
nssai
))
{
// Get NSSAI from
// UDM
// Get NSSAI from UDM
if
(
!
get_slice_selection_subscription_data
(
nc
,
nssai
))
{
return
false
;
}
// Check that AMF can process the Requested NSSAIs or not
...
...
@@ -3772,7 +3774,7 @@ bool amf_n1::get_slice_selection_subscription_data(
int
ret
=
itti_inst
->
send_msg
(
itti_msg
);
if
(
0
!=
ret
)
{
Logger
::
ngap
().
error
(
"Could not send ITTI message %s to task TASK_AMF_N
2
"
,
"Could not send ITTI message %s to task TASK_AMF_N
11
"
,
itti_msg
->
get_msg_name
());
}
...
...
@@ -3784,10 +3786,10 @@ bool amf_n1::get_slice_selection_subscription_data(
assert
(
f
.
is_ready
());
assert
(
f
.
has_value
());
assert
(
!
f
.
has_exception
());
// Wait for the result from
APP and send reply to AMF
// Wait for the result from
UDM
nlohmann
::
json
nssai
=
f
.
get
();
if
(
!
nssai
.
empty
())
{
Logger
::
ngap
().
debug
(
"Got NSSAI from UDM"
,
nssai
.
dump
().
c_str
());
Logger
::
ngap
().
debug
(
"Got NSSAI from UDM
: %s
"
,
nssai
.
dump
().
c_str
());
}
else
{
return
false
;
}
...
...
@@ -3809,17 +3811,80 @@ bool amf_n1::get_slice_selection_subscription_data_from_conf_file(
// TODO:
return
true
;
}
//------------------------------------------------------------------------------
bool
amf_n1
::
get_network_slice_selection
(
const
std
::
string
&
nf_instance_id
,
slice_info_for_registration_t
&
slice_info
,
authorized_network_slice_info_t
&
authorized_network_slice_info
)
const
{
// TODO: UDM selection (from NRF or configuration file)
if
(
amf_cfg
.
support_features
.
enable_external_udm
)
{
if
(
amf_cfg
.
support_features
.
enable_external_nssf
)
{
// Get Authorized Network Slice Info from an external NSSF
std
::
shared_ptr
<
itti_n11_network_slice_selection_information
>
itti_msg
=
std
::
make_shared
<
itti_n11_network_slice_selection_information
>
(
TASK_AMF_N1
,
TASK_AMF_N11
);
// Generate a promise and associate this promise to the ITTI message
uint32_t
promise_id
=
amf_app_inst
->
generate_promise_id
();
Logger
::
amf_n1
().
debug
(
"Promise ID generated %d"
,
promise_id
);
boost
::
shared_ptr
<
boost
::
promise
<
nlohmann
::
json
>>
p
=
boost
::
make_shared
<
boost
::
promise
<
nlohmann
::
json
>>
();
boost
::
shared_future
<
nlohmann
::
json
>
f
=
p
->
get_future
();
amf_app_inst
->
add_promise
(
promise_id
,
p
);
itti_msg
->
http_version
=
1
;
itti_msg
->
nf_instance_id
=
nf_instance_id
;
itti_msg
->
slice_info
=
slice_info
;
itti_msg
->
promise_id
=
promise_id
;
int
ret
=
itti_inst
->
send_msg
(
itti_msg
);
if
(
0
!=
ret
)
{
Logger
::
ngap
().
error
(
"Could not send ITTI message %s to task TASK_AMF_N11"
,
itti_msg
->
get_msg_name
());
}
bool
result
=
false
;
boost
::
future_status
status
;
// wait for timeout or ready
status
=
f
.
wait_for
(
boost
::
chrono
::
milliseconds
(
FUTURE_STATUS_TIMEOUT_MS
));
if
(
status
==
boost
::
future_status
::
ready
)
{
assert
(
f
.
is_ready
());
assert
(
f
.
has_value
());
assert
(
!
f
.
has_exception
());
// Wait for the result from NSSF
nlohmann
::
json
network_slice_info
=
f
.
get
();
if
(
!
network_slice_info
.
empty
())
{
Logger
::
ngap
().
debug
(
"Got Authorized Network Slice Info from NSSF: %s"
,
network_slice_info
.
dump
().
c_str
());
}
else
{
return
false
;
}
}
else
{
return
false
;
}
}
else
{
// TODO: Get Authorized Network Slice Info from local configuration file
return
get_network_slice_selection_from_conf_file
(
nf_instance_id
,
slice_info
,
authorized_network_slice_info
);
}
return
true
;
}
//------------------------------------------------------------------------------
bool
amf_n1
::
get_network_slice_selection_from_conf_file
(
const
std
::
string
&
nf_instance_id
,
slice_info_for_registration_t
&
slice_info
,
authorized_network_slice_info_t
&
authorized_network_slice_info
)
const
{
// TODO: Get Authorized Network Slice Info from local configuration file
return
true
;
}
//------------------------------------------------------------------------------
void
amf_n1
::
send_n1_message_notity
(
const
std
::
shared_ptr
<
nas_context
>&
nc
,
...
...
src/amf-app/amf_n1.hpp
View file @
b1e2e4ea
...
...
@@ -230,6 +230,11 @@ class amf_n1 {
const
std
::
string
&
nf_instance_id
,
slice_info_for_registration_t
&
slice_info
,
authorized_network_slice_info_t
&
authorized_network_slice_info
)
const
;
bool
get_network_slice_selection_from_conf_file
(
const
std
::
string
&
nf_instance_id
,
slice_info_for_registration_t
&
slice_info
,
authorized_network_slice_info_t
&
authorized_network_slice_info
)
const
;
void
send_n1_message_notity
(
const
std
::
shared_ptr
<
nas_context
>&
nc
,
const
std
::
string
&
target_amf
)
const
;
...
...
src/amf-app/amf_n11.cpp
View file @
b1e2e4ea
This diff is collapsed.
Click to expand it.
src/amf-app/amf_n11.hpp
View file @
b1e2e4ea
...
...
@@ -61,6 +61,8 @@ class amf_n11 {
void
handle_itti_message
(
itti_sbi_notify_subscribed_event
&
itti_msg
);
void
handle_itti_message
(
itti_n11_slice_selection_subscription_data
&
itti_msg
);
void
handle_itti_message
(
itti_n11_network_slice_selection_information
&
itti_msg
);
void
send_pdu_session_update_sm_context_request
(
std
::
string
supi
,
std
::
shared_ptr
<
pdu_session_context
>
psc
,
...
...
@@ -79,8 +81,8 @@ class amf_n11 {
uint8_t
http_version
=
1
,
uint32_t
promise_id
=
0
);
void
curl_http_client
(
std
::
string
remote
Uri
,
std
::
string
Method
,
std
::
string
msgB
ody
,
std
::
string
&
response
,
uint8_t
http_version
=
1
);
std
::
string
remote
_uri
,
std
::
string
method
,
std
::
string
msg_b
ody
,
nlohmann
::
json
&
response_json
,
uint8_t
http_version
=
1
);
bool
discover_smf_from_nsi_info
(
std
::
string
&
smf_addr
,
std
::
string
&
smf_api_version
,
...
...
src/common/3gpp_29.500.h
View file @
b1e2e4ea
...
...
@@ -28,7 +28,7 @@ enum class http_response_codes_e {
HTTP_RESPONSE_CODE_200_OK
=
200
,
HTTP_RESPONSE_CODE_201_CREATED
=
201
,
HTTP_RESPONSE_CODE_202_ACCEPTED
=
202
,
HTTP_RESPONSE_CODE_204_
UPDATED
=
204
,
HTTP_RESPONSE_CODE_204_
NO_CONTENT
=
204
,
HTTP_RESPONSE_CODE_BAD_REQUEST
=
400
,
HTTP_RESPONSE_CODE_UNAUTHORIZED
=
401
,
HTTP_RESPONSE_CODE_FORBIDDEN
=
403
,
...
...
src/itti/itti_msg.hpp
View file @
b1e2e4ea
...
...
@@ -87,6 +87,7 @@ typedef enum {
N11_UPDATE_NF_INSTANCE_RESPONSE
,
N11_DEREGISTER_NF_INSTANCE
,
N11_SLICE_SELECTION_SUBSCRIPTION_DATA
,
N11_NETWORK_SLICE_SELECTION_INFORMATION
,
SBI_EVENT_EXPOSURE_REQUEST
,
SBI_NOTIFICATION_DATA
,
SBI_NOTIFY_SUBSCRIBED_EVENT
,
...
...
src/itti/msgs/itti_msg_n11.hpp
View file @
b1e2e4ea
...
...
@@ -28,6 +28,7 @@
#include "amf_profile.hpp"
#include "bstrlib.h"
#include "itti_msg.hpp"
#include "3gpp_29.531.h"
class
itti_msg_n11
:
public
itti_msg
{
public:
...
...
@@ -208,4 +209,21 @@ class itti_n11_slice_selection_subscription_data : public itti_msg_n11 {
uint32_t
promise_id
;
};
//-----------------------------------------------------------------------------
class
itti_n11_network_slice_selection_information
:
public
itti_msg_n11
{
public:
itti_n11_network_slice_selection_information
(
const
task_id_t
orig
,
const
task_id_t
dest
)
:
itti_msg_n11
(
N11_NETWORK_SLICE_SELECTION_INFORMATION
,
orig
,
dest
),
http_version
(
1
)
{}
const
char
*
get_msg_name
()
{
return
"N11_NETWORK_SLICE_SELECTION_INFORMATION"
;
};
uint8_t
http_version
;
std
::
string
nf_instance_id
;
slice_info_for_registration_t
slice_info
;
uint32_t
promise_id
;
};
#endif
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