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
3397a571
Commit
3397a571
authored
Jan 24, 2023
by
Tien Thinh NGUYEN
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Refactor UE Context Key
parent
85683d79
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
33 additions
and
26 deletions
+33
-26
src/amf-app/amf_app.cpp
src/amf-app/amf_app.cpp
+8
-9
src/amf-app/amf_app.hpp
src/amf-app/amf_app.hpp
+2
-3
src/amf-app/amf_n1.cpp
src/amf-app/amf_n1.cpp
+8
-9
src/amf-app/amf_sbi.cpp
src/amf-app/amf_sbi.cpp
+5
-5
src/common/conversions.cpp
src/common/conversions.cpp
+8
-0
src/common/conversions.hpp
src/common/conversions.hpp
+2
-0
No files found.
src/amf-app/amf_app.cpp
View file @
3397a571
...
...
@@ -106,7 +106,7 @@ void amf_app_task(void*) {
do
{
std
::
shared_ptr
<
itti_msg
>
shared_msg
=
itti_inst
->
receive_msg
(
task_id
);
auto
*
msg
=
shared_msg
.
get
();
timer_id_t
tid
;
timer_id_t
tid
=
{}
;
switch
(
msg
->
msg_type
)
{
case
NAS_SIG_ESTAB_REQ
:
{
Logger
::
amf_app
().
debug
(
"Received NAS_SIG_ESTAB_REQ"
);
...
...
@@ -287,7 +287,7 @@ bool amf_app::get_pdu_sessions_context(
//------------------------------------------------------------------------------
bool
amf_app
::
update_pdu_sessions_context
(
const
string
&
ue_id
,
const
uint8_t
&
pdu_session_id
,
const
string
&
supi
,
const
uint8_t
&
pdu_session_id
,
const
oai
::
amf
::
model
::
SmContextStatusNotification
&
statusNotification
)
{
std
::
shared_ptr
<
ue_context
>
uc
=
{};
if
(
!
supi_2_ue_context
(
supi
,
uc
))
return
false
;
...
...
@@ -359,7 +359,7 @@ void amf_app::handle_itti_message(
amf_n1_inst
->
supi_2_ran_id
(
itti_msg
.
supi
,
dl_msg
->
ran_ue_ngap_id
);
int
ret
=
itti_inst
->
send_msg
(
dl_msg
);
if
(
0
!=
ret
)
{
if
(
ret
!=
RETURNok
)
{
Logger
::
amf_app
().
error
(
"Could not send ITTI message %s to task TASK_AMF_N1"
,
dl_msg
->
get_msg_name
());
...
...
@@ -378,8 +378,8 @@ void amf_app::handle_itti_message(
amf_ue_ngap_id
=
generate_amf_ue_ngap_id
();
}
string
ue_context_key
=
"app_ue_ranid_"
+
to_string
(
itti_msg
.
ran_ue_ngap_id
)
+
":amfid_"
+
to_string
(
amf_ue_ngap_id
);
string
ue_context_key
=
conv
::
get_ue_context_key
(
itti_msg
.
ran_ue_ngap_id
,
amf_ue_ngap_id
);
if
(
!
is_ran_amf_id_2_ue_context
(
ue_context_key
))
{
Logger
::
amf_app
().
debug
(
"No existing UE Context, Create a new one with ran_amf_id %s"
,
...
...
@@ -552,8 +552,8 @@ void amf_app::handle_itti_message(itti_sbi_n1_message_notification& itti_msg) {
}
}
string
ue_context_key
=
"app_ue_ranid_"
+
to_string
(
ran_ue_ngap_id
)
+
":amfid_"
+
to_string
(
amf_ue_ngap_id
);
string
ue_context_key
=
conv
::
get_ue_context_key
(
ran_ue_ngap_id
,
amf_ue_ngap_id
);
if
(
!
is_ran_amf_id_2_ue_context
(
ue_context_key
))
{
Logger
::
amf_app
().
debug
(
"No existing UE Context associated with UE Context Key %s"
,
...
...
@@ -895,8 +895,7 @@ uint32_t amf_app::generate_tmsi() {
bool
amf_app
::
generate_5g_guti
(
const
uint32_t
ranid
,
const
long
amfid
,
string
&
mcc
,
string
&
mnc
,
uint32_t
&
tmsi
)
{
string
ue_context_key
=
"app_ue_ranid_"
+
to_string
(
ranid
)
+
":amfid_"
+
to_string
(
amfid
);
string
ue_context_key
=
conv
::
get_ue_context_key
(
ranid
,
amfid
);
if
(
!
is_ran_amf_id_2_ue_context
(
ue_context_key
))
{
Logger
::
amf_app
().
error
(
"No UE context for ran_amf_id %s, exit"
,
ue_context_key
.
c_str
());
...
...
src/amf-app/amf_app.hpp
View file @
3397a571
...
...
@@ -99,7 +99,6 @@ class amf_app {
explicit
amf_app
(
const
amf_config
&
amf_cfg
);
amf_app
(
amf_app
const
&
)
=
delete
;
void
operator
=
(
amf_app
const
&
)
=
delete
;
void
allRegistredModulesInit
(
const
amf_modules
&
modules
);
/*
* Generate AMF UE NGAP ID
...
...
@@ -283,14 +282,14 @@ class amf_app {
/*
* Update PDU Session Context status
* @param [const std::string&]
ue_id
: UE SUPI
* @param [const std::string&]
supi
: UE SUPI
* @param [const uint8_t&] pdu_session_id: PDU Session ID
* @param [const oai::amf::model::SmContextStatusNotification&]
* statusNotification: Notification information received from SMF
* @return true if success, otherwise false
*/
bool
update_pdu_sessions_context
(
const
string
&
ue_id
,
const
uint8_t
&
pdu_session_id
,
const
string
&
supi
,
const
uint8_t
&
pdu_session_id
,
const
oai
::
amf
::
model
::
SmContextStatusNotification
&
statusNotification
);
/*
...
...
src/amf-app/amf_n1.cpp
View file @
3397a571
...
...
@@ -363,9 +363,8 @@ void amf_n1::handle_itti_message(itti_uplink_nas_data_ind& nas_data_ind) {
long
amf_ue_ngap_id
=
nas_data_ind
.
amf_ue_ngap_id
;
uint32_t
ran_ue_ngap_id
=
nas_data_ind
.
ran_ue_ngap_id
;
std
::
string
nas_context_key
=
"app_ue_ranid_"
+
to_string
(
ran_ue_ngap_id
)
+
":amfid_"
+
to_string
(
amf_ue_ngap_id
);
// key for nas_context, option 1
std
::
string
nas_context_key
=
conv
::
get_ue_context_key
(
ran_ue_ngap_id
,
amf_ue_ngap_id
);
// key for nas_context, option 1
std
::
string
snn
=
{};
if
(
nas_data_ind
.
mnc
.
length
()
==
2
)
// TODO: remove hardcoded value
...
...
@@ -717,8 +716,8 @@ void amf_n1::identity_response_handle(
Logger
::
amf_n1
().
debug
(
"Identity Response: SUCI (%s)"
,
supi
.
c_str
());
}
string
ue_context_key
=
"app_ue_ranid_"
+
to_string
(
ran_ue_ngap_id
)
+
":amfid_"
+
to_string
(
amf_ue_ngap_id
);
string
ue_context_key
=
conv
::
get_ue_context_key
(
ran_ue_ngap_id
,
amf_ue_ngap_id
);
if
(
amf_app_inst
->
is_ran_amf_id_2_ue_context
(
ue_context_key
))
{
std
::
shared_ptr
<
ue_context
>
uc
=
{};
...
...
@@ -4200,8 +4199,8 @@ bool amf_n1::find_ue_context(
string
supi
=
"imsi-"
+
nc
->
imsi
;
Logger
::
amf_n1
().
debug
(
"Key for PDU Session Context SUPI (%s)"
,
supi
.
c_str
());
string
ue_context_key
=
"app_ue_ranid_"
+
to_string
(
nc
->
ran_ue_ngap_id
)
+
":amfid_"
+
to_string
(
nc
->
amf_ue_ngap_id
);
string
ue_context_key
=
conv
::
get_ue_context_key
(
nc
->
ran_ue_ngap_id
,
nc
->
amf_ue_ngap_id
);
if
(
!
amf_app_inst
->
is_ran_amf_id_2_ue_context
(
ue_context_key
))
{
Logger
::
amf_n1
().
error
(
"No UE context with key %s"
,
ue_context_key
.
c_str
());
...
...
@@ -4223,8 +4222,8 @@ bool amf_n1::find_ue_context(
bool
amf_n1
::
find_ue_context
(
uint32_t
ran_ue_ngap_id
,
long
amf_ue_ngap_id
,
std
::
shared_ptr
<
ue_context
>&
uc
)
{
string
ue_context_key
=
"app_ue_ranid_"
+
to_string
(
ran_ue_ngap_id
)
+
":amfid_"
+
to_string
(
amf_ue_ngap_id
);
string
ue_context_key
=
conv
::
get_ue_context_key
(
ran_ue_ngap_id
,
amf_ue_ngap_id
);
if
(
!
amf_app_inst
->
is_ran_amf_id_2_ue_context
(
ue_context_key
))
{
Logger
::
amf_n1
().
error
(
"No UE context with key %s"
,
ue_context_key
.
c_str
());
...
...
src/amf-app/amf_sbi.cpp
View file @
3397a571
...
...
@@ -199,8 +199,8 @@ void amf_sbi::handle_itti_message(
//------------------------------------------------------------------------------
void
amf_sbi
::
handle_itti_message
(
itti_nsmf_pdusession_update_sm_context
&
itti_msg
)
{
string
ue_context_key
=
"app_ue_ranid_"
+
to_string
(
itti_msg
.
ran_ue_ngap_id
)
+
":amfid_"
+
to_string
(
itti_msg
.
amf_ue_ngap_id
);
string
ue_context_key
=
conv
::
get_ue_context_key
(
itti_msg
.
ran_ue_ngap_id
,
itti_msg
.
amf_ue_ngap_id
);
std
::
shared_ptr
<
ue_context
>
uc
=
{};
if
(
!
amf_app_inst
->
is_ran_amf_id_2_ue_context
(
ue_context_key
))
{
Logger
::
amf_sbi
().
error
(
...
...
@@ -294,9 +294,9 @@ void amf_sbi::handle_itti_message(itti_nsmf_pdusession_create_sm_context& smf) {
return
;
}
std
::
string
supi
=
"imsi-"
+
nc
->
imsi
;
string
ue_context_key
=
"app_ue_ranid_"
+
to_string
(
nc
->
ran_ue_ngap_id
)
+
":amfid_"
+
to_string
(
nc
->
amf_ue_ngap_id
);
std
::
string
supi
=
"imsi-"
+
nc
->
imsi
;
string
ue_context_key
=
conv
::
get_ue_context_key
(
nc
->
ran_ue_ngap_id
,
nc
->
amf_ue_ngap_id
);
std
::
shared_ptr
<
ue_context
>
uc
=
{};
Logger
::
amf_sbi
().
info
(
"Find ue_context in amf_app using UE Context Key: %s"
,
...
...
src/common/conversions.cpp
View file @
3397a571
...
...
@@ -469,3 +469,11 @@ bool conv::check_octet_string(const OCTET_STRING_t& octet_str) {
if
(
!
octet_str
.
buf
or
(
octet_str
.
size
==
0
))
return
false
;
return
true
;
}
//------------------------------------------------------------------------------
std
::
string
conv
::
get_ue_context_key
(
const
uint32_t
ran_ue_ngap_id
,
long
amf_ue_ngap_id
)
{
return
(
"app_ue_ranid_"
+
std
::
to_string
(
ran_ue_ngap_id
)
+
":amfid_"
+
std
::
to_string
(
amf_ue_ngap_id
));
}
src/common/conversions.hpp
View file @
3397a571
...
...
@@ -91,5 +91,7 @@ class conv {
static
bool
check_bstring
(
const
bstring
&
b_str
);
static
bool
check_octet_string
(
const
OCTET_STRING_t
&
octet_str
);
static
std
::
string
get_ue_context_key
(
const
uint32_t
ran_ue_ngap_id
,
long
amf_ue_ngap_id
);
};
#endif
/* FILE_CONVERSIONS_HPP_SEEN */
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