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
5fd4ea92
Commit
5fd4ea92
authored
Feb 03, 2023
by
Tien Thinh NGUYEN
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Code cleanup for Registration Accept
parent
e4ae7895
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
54 additions
and
58 deletions
+54
-58
src/amf-app/amf_app.cpp
src/amf-app/amf_app.cpp
+44
-49
src/amf-app/amf_n2.cpp
src/amf-app/amf_n2.cpp
+10
-9
No files found.
src/amf-app/amf_app.cpp
View file @
5fd4ea92
...
...
@@ -367,17 +367,18 @@ void amf_app::handle_itti_message(
//------------------------------------------------------------------------------
void
amf_app
::
handle_itti_message
(
itti_nas_signalling_establishment_request
&
itti_msg
)
{
long
amf_ue_ngap_id
=
0
;
long
amf_ue_ngap_id
=
INVALID_AMF_UE_NGAP_ID
;
std
::
shared_ptr
<
ue_context
>
uc
=
{};
// Generate amf_ue_ngap_id
// Generate amf_ue_ngap_id
if necessary
if
((
amf_ue_ngap_id
=
itti_msg
.
amf_ue_ngap_id
)
==
INVALID_AMF_UE_NGAP_ID
)
{
amf_ue_ngap_id
=
generate_amf_ue_ngap_id
();
}
string
ue_context_key
=
// Get UE context, if the context doesn't exist, create a new one
std
::
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
))
{
if
(
!
ran_amf_id_2_ue_context
(
ue_context_key
,
uc
))
{
Logger
::
amf_app
().
debug
(
"No existing UE Context, Create a new one with ran_amf_id %s"
,
ue_context_key
.
c_str
());
...
...
@@ -397,53 +398,47 @@ void amf_app::handle_itti_message(
amf_n2_inst
->
set_amf_ue_ngap_id_2_ue_ngap_context
(
amf_ue_ngap_id
,
unc
);
}
// Create UE Context and store related information information
if
(
uc
==
nullptr
)
{
Logger
::
amf_app
().
error
(
"Failed to create ue_context with ran_amf_id %s"
,
ue_context_key
.
c_str
());
}
else
{
uc
->
cgi
=
itti_msg
.
cgi
;
uc
->
tai
=
itti_msg
.
tai
;
if
(
itti_msg
.
rrc_cause
!=
-
1
)
uc
->
rrc_estb_cause
=
(
e_Ngap_RRCEstablishmentCause
)
itti_msg
.
rrc_cause
;
if
(
itti_msg
.
ueCtxReq
==
-
1
)
uc
->
isUeContextRequest
=
false
;
else
uc
->
isUeContextRequest
=
true
;
uc
->
ran_ue_ngap_id
=
itti_msg
.
ran_ue_ngap_id
;
uc
->
amf_ue_ngap_id
=
amf_ue_ngap_id
;
std
::
string
guti
;
bool
is_guti_valid
=
false
;
if
(
itti_msg
.
is_5g_s_tmsi_present
)
{
guti
=
itti_msg
.
tai
.
mcc
+
itti_msg
.
tai
.
mnc
+
amf_cfg
.
guami
.
regionID
+
itti_msg
.
_5g_s_tmsi
;
is_guti_valid
=
true
;
Logger
::
amf_app
().
debug
(
"Receiving GUTI %s"
,
guti
.
c_str
());
}
// Store related information
uc
->
cgi
=
itti_msg
.
cgi
;
uc
->
tai
=
itti_msg
.
tai
;
if
(
itti_msg
.
rrc_cause
!=
-
1
)
uc
->
rrc_estb_cause
=
(
e_Ngap_RRCEstablishmentCause
)
itti_msg
.
rrc_cause
;
if
(
itti_msg
.
ueCtxReq
==
-
1
)
uc
->
isUeContextRequest
=
false
;
else
uc
->
isUeContextRequest
=
true
;
uc
->
ran_ue_ngap_id
=
itti_msg
.
ran_ue_ngap_id
;
uc
->
amf_ue_ngap_id
=
amf_ue_ngap_id
;
// Send NAS PDU to task_amf_n1 for further processing
std
::
shared_ptr
<
itti_uplink_nas_data_ind
>
itti_n1_msg
=
std
::
make_shared
<
itti_uplink_nas_data_ind
>
(
TASK_AMF_APP
,
TASK_AMF_N1
);
itti_n1_msg
->
amf_ue_ngap_id
=
amf_ue_ngap_id
;
itti_n1_msg
->
ran_ue_ngap_id
=
itti_msg
.
ran_ue_ngap_id
;
itti_n1_msg
->
is_nas_signalling_estab_req
=
true
;
itti_n1_msg
->
nas_msg
=
itti_msg
.
nas_buf
;
itti_n1_msg
->
mcc
=
itti_msg
.
tai
.
mcc
;
itti_n1_msg
->
mnc
=
itti_msg
.
tai
.
mnc
;
itti_n1_msg
->
is_guti_valid
=
is_guti_valid
;
if
(
is_guti_valid
)
{
itti_n1_msg
->
guti
=
guti
;
}
std
::
string
guti
=
{};
bool
is_guti_valid
=
false
;
if
(
itti_msg
.
is_5g_s_tmsi_present
)
{
guti
=
itti_msg
.
tai
.
mcc
+
itti_msg
.
tai
.
mnc
+
amf_cfg
.
guami
.
regionID
+
itti_msg
.
_5g_s_tmsi
;
is_guti_valid
=
true
;
Logger
::
amf_app
().
debug
(
"Receiving GUTI %s"
,
guti
.
c_str
());
}
int
ret
=
itti_inst
->
send_msg
(
itti_n1_msg
);
if
(
0
!=
ret
)
{
Logger
::
amf_app
().
error
(
"Could not send ITTI message %s to task TASK_AMF_N1"
,
itti_n1_msg
->
get_msg_name
());
}
// Send NAS PDU to task_amf_n1 for further processing
std
::
shared_ptr
<
itti_uplink_nas_data_ind
>
itti_n1_msg
=
std
::
make_shared
<
itti_uplink_nas_data_ind
>
(
TASK_AMF_APP
,
TASK_AMF_N1
);
itti_n1_msg
->
amf_ue_ngap_id
=
amf_ue_ngap_id
;
itti_n1_msg
->
ran_ue_ngap_id
=
itti_msg
.
ran_ue_ngap_id
;
itti_n1_msg
->
is_nas_signalling_estab_req
=
true
;
itti_n1_msg
->
nas_msg
=
itti_msg
.
nas_buf
;
itti_n1_msg
->
mcc
=
itti_msg
.
tai
.
mcc
;
itti_n1_msg
->
mnc
=
itti_msg
.
tai
.
mnc
;
itti_n1_msg
->
is_guti_valid
=
is_guti_valid
;
if
(
is_guti_valid
)
{
itti_n1_msg
->
guti
=
guti
;
}
int
ret
=
itti_inst
->
send_msg
(
itti_n1_msg
);
if
(
0
!=
ret
)
{
Logger
::
amf_app
().
error
(
"Could not send ITTI message %s to task TASK_AMF_N1"
,
itti_n1_msg
->
get_msg_name
());
}
}
...
...
src/amf-app/amf_n2.cpp
View file @
5fd4ea92
...
...
@@ -617,9 +617,10 @@ void amf_n2::handle_itti_message(itti_initial_ue_message& init_ue_msg) {
gc
->
next_sctp_stream
+=
1
;
if
(
gc
->
next_sctp_stream
>=
gc
->
instreams
)
gc
->
next_sctp_stream
=
1
;
unc
->
gnb_assoc_id
=
init_ue_msg
.
assoc_id
;
NrCgi_t
cgi
=
{};
Tai_t
tai
=
{};
// User Location Info NR (Mandatory)
NrCgi_t
cgi
=
{};
Tai_t
tai
=
{};
if
(
init_ue_msg
.
initUeMsg
->
getUserLocationInfoNR
(
cgi
,
tai
))
{
itti_msg
->
cgi
=
cgi
;
itti_msg
->
tai
=
tai
;
...
...
@@ -629,13 +630,11 @@ void amf_n2::handle_itti_message(itti_initial_ue_message& init_ue_msg) {
return
;
}
if
(
init_ue_msg
.
initUeMsg
->
getRRCEstablishmentCause
()
==
-
1
)
{
Logger
::
amf_n2
().
warn
(
"IE RRCEstablishmentCause not present"
);
itti_msg
->
rrc_cause
=
-
1
;
// not present, TODO with optional
}
else
{
itti_msg
->
rrc_cause
=
init_ue_msg
.
initUeMsg
->
getRRCEstablishmentCause
();
}
// RCC Establishment Cause (Mandatory)
itti_msg
->
rrc_cause
=
init_ue_msg
.
initUeMsg
->
getRRCEstablishmentCause
();
// UE Context Request (Optional)
// TODO: use std::optional
if
(
init_ue_msg
.
initUeMsg
->
getUeContextRequest
()
==
-
1
)
{
Logger
::
amf_n2
().
warn
(
"IE UeContextRequest not present"
);
itti_msg
->
ueCtxReq
=
-
1
;
// not present, TODO with optional
...
...
@@ -643,6 +642,7 @@ void amf_n2::handle_itti_message(itti_initial_ue_message& init_ue_msg) {
itti_msg
->
ueCtxReq
=
init_ue_msg
.
initUeMsg
->
getUeContextRequest
();
}
// 5G-S-TMSI (Optional)
std
::
string
_5g_s_tmsi
=
{};
if
(
!
init_ue_msg
.
initUeMsg
->
get5GS_TMSI
(
_5g_s_tmsi
))
{
itti_msg
->
is_5g_s_tmsi_present
=
false
;
...
...
@@ -656,8 +656,9 @@ void amf_n2::handle_itti_message(itti_initial_ue_message& init_ue_msg) {
unc
->
s_setid
,
unc
->
s_pointer
,
unc
->
s_tmsi
);
}
// NAS PDU (Mandatory)
if
(
!
init_ue_msg
.
initUeMsg
->
getNasPdu
(
itti_msg
->
nas_buf
))
{
Logger
::
amf_n2
().
error
(
"Missing IE NAS-PDU"
);
Logger
::
amf_n2
().
error
(
"Missing
mandatory
IE NAS-PDU"
);
return
;
}
...
...
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