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
63a4dc20
Commit
63a4dc20
authored
Feb 02, 2021
by
Tien-Thinh Nguyen
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Code cleanup
parent
033c09f6
Changes
4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
120 additions
and
94 deletions
+120
-94
src/amf-app/amf_app.cpp
src/amf-app/amf_app.cpp
+17
-14
src/amf-app/amf_n1.cpp
src/amf-app/amf_n1.cpp
+69
-55
src/amf-app/amf_n11.cpp
src/amf-app/amf_n11.cpp
+13
-13
src/amf-app/amf_n2.cpp
src/amf-app/amf_n2.cpp
+21
-12
No files found.
src/amf-app/amf_app.cpp
View file @
63a4dc20
...
...
@@ -21,7 +21,7 @@
/*! \file amf_app.cpp
\brief
\author Keliang DU, BUPT
\author Keliang DU, BUPT
, Tien-Thinh NGUYEN, EURECOM
\date 2020
\email: contact@openairinterface.org
*/
...
...
@@ -162,7 +162,7 @@ std::shared_ptr<ue_context> amf_app::amf_ue_id_2_ue_context(
//------------------------------------------------------------------------------
void
amf_app
::
set_amf_ue_ngap_id_2_ue_context
(
const
long
&
amf_ue_ngap_id
,
std
::
shared_ptr
<
ue_context
>
uc
)
{
std
::
shared
_lock
lock
(
m_amf_ue_ngap_id2ue_ctx
);
std
::
unique
_lock
lock
(
m_amf_ue_ngap_id2ue_ctx
);
amf_ue_ngap_id2ue_ctx
[
amf_ue_ngap_id
]
=
uc
;
}
...
...
@@ -182,7 +182,7 @@ std::shared_ptr<ue_context> amf_app::ran_amf_id_2_ue_context(
//------------------------------------------------------------------------------
void
amf_app
::
set_ran_amf_id_2_ue_context
(
const
string
&
ue_context_key
,
std
::
shared_ptr
<
ue_context
>
uc
)
{
std
::
shared
_lock
lock
(
m_ue_ctx_key
);
std
::
unique
_lock
lock
(
m_ue_ctx_key
);
ue_ctx_key
[
ue_context_key
]
=
uc
;
}
...
...
@@ -206,7 +206,9 @@ void amf_app::set_supi_2_ue_context(
supi2ue_ctx
[
supi
]
=
uc
;
}
bool
amf_app
::
find_pdu_session_context
(
const
string
&
supi
,
const
std
::
uint8_t
pdu_session_id
,
std
::
shared_ptr
<
pdu_session_context
>&
psc
){
bool
amf_app
::
find_pdu_session_context
(
const
string
&
supi
,
const
std
::
uint8_t
pdu_session_id
,
std
::
shared_ptr
<
pdu_session_context
>&
psc
)
{
if
(
!
is_supi_2_ue_context
(
supi
))
return
false
;
std
::
shared_ptr
<
ue_context
>
uc
=
{};
uc
=
supi_2_ue_context
(
supi
);
...
...
@@ -218,13 +220,14 @@ bool amf_app::find_pdu_session_context(const string& supi, const std::uint8_t pd
//------------------------------------------------------------------------------
void
amf_app
::
handle_itti_message
(
itti_n1n2_message_transfer_request
&
itti_msg
)
{
//
1. e
ncode DL NAS TRANSPORT message(NAS message)
//
E
ncode DL NAS TRANSPORT message(NAS message)
DLNASTransport
*
dl
=
new
DLNASTransport
();
dl
->
setHeader
(
PLAIN_5GS_MSG
);
dl
->
setPayload_Container_Type
(
N1_SM_INFORMATION
);
dl
->
setPayload_Container
(
(
uint8_t
*
)
bdata
(
itti_msg
.
n1sm
),
blength
(
itti_msg
.
n1sm
));
dl
->
setPDUSessionId
(
itti_msg
.
pdu_session_id
);
uint8_t
nas
[
1024
];
int
encoded_size
=
dl
->
encode2buffer
(
nas
,
1024
);
print_buffer
(
"amf_app"
,
"n1n2 transfer"
,
nas
,
encoded_size
);
...
...
@@ -256,28 +259,28 @@ void amf_app::handle_itti_message(
//------------------------------------------------------------------------------
void
amf_app
::
handle_itti_message
(
itti_nas_signalling_establishment_request
&
itti_msg
)
{
// 1.
g
enerate amf_ue_ngap_id
// 2.
establish ue_context associated with amf_ue_ngap_id
// 3.
store ue-reated core information
// 4. send nas-pdu to task_amf_n1
// 1.
G
enerate amf_ue_ngap_id
// 2.
Create UE Context and store related information information
// 3.
Send nas-pdu to task_amf_n1
long
amf_ue_ngap_id
=
0
;
std
::
shared_ptr
<
ue_context
>
uc
;
// check ue context with 5g-s-tmsi
// check UE Context with 5g-s-tmsi
if
((
amf_ue_ngap_id
=
itti_msg
.
amf_ue_ngap_id
)
==
-
1
)
{
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
);
// if(!is_amf_ue_id_2_ue_context(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"
,
ue_context_key
.
c_str
());
uc
=
std
::
shared_ptr
<
ue_context
>
(
new
ue_context
());
// set_amf_ue_ngap_id_2_ue_context(amf_ue_ngap_id, uc);
set_ran_amf_id_2_ue_context
(
ue_context_key
,
uc
);
}
if
(
uc
.
get
()
==
nullptr
)
{
Logger
::
amf_app
().
error
(
"Failed to create ue_context with ran_amf_id %s"
,
...
...
src/amf-app/amf_n1.cpp
View file @
63a4dc20
...
...
@@ -126,7 +126,7 @@ void amf_n1::handle_itti_message(itti_downlink_nas_transfer& itti_msg) {
nc
=
amf_ue_id_2_nas_context
(
amf_ue_ngap_id
);
else
{
Logger
::
amf_n1
().
warn
(
"No existed nas_context with amf_ue_ngap_id(0x%x)"
,
amf_ue_ngap_id
);
"No existed nas_context with amf_ue_ngap_id
(0x%x)"
,
amf_ue_ngap_id
);
return
;
}
nas_secu_ctx
*
secu
=
nc
.
get
()
->
security_ctx
;
...
...
@@ -135,9 +135,10 @@ void amf_n1::handle_itti_message(itti_downlink_nas_transfer& itti_msg) {
secu
,
false
,
INTEGRITY_PROTECTED_AND_CIPHERED
,
NAS_MESSAGE_DOWNLINK
,
(
uint8_t
*
)
bdata
(
itti_msg
.
dl_nas
),
blength
(
itti_msg
.
dl_nas
),
protected_nas
);
if
(
itti_msg
.
is_n2sm_set
)
{
if
(
itti_msg
.
n2sm_info_type
.
compare
(
"PDU_RES_REL_CMD"
)
==
0
)
{
// PDU SESSION RESOURCE RELEASE COMMAND
if
(
itti_msg
.
n2sm_info_type
.
compare
(
"PDU_RES_REL_CMD"
)
==
0
)
{
// PDU SESSION RESOURCE RELEASE COMMAND
itti_pdu_session_resource_release_command
*
release_command
=
new
itti_pdu_session_resource_release_command
(
TASK_AMF_N1
,
TASK_AMF_N2
);
...
...
@@ -155,7 +156,8 @@ void amf_n1::handle_itti_message(itti_downlink_nas_transfer& itti_msg) {
"Could not send ITTI message %s to task TASK_AMF_N2"
,
i
->
get_msg_name
());
}
}
else
{
// PDU SESSION RESOURCE SETUP_REQUEST
}
else
{
// PDU SESSION RESOURCE SETUP_REQUEST
itti_pdu_session_resource_setup_request
*
psrsr
=
new
itti_pdu_session_resource_setup_request
(
TASK_AMF_N1
,
TASK_AMF_N2
);
psrsr
->
nas
=
protected_nas
;
...
...
@@ -194,9 +196,11 @@ void amf_n1::handle_itti_message(itti_downlink_nas_transfer& itti_msg) {
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
snn
;
if
(
nas_data_ind
.
mnc
.
length
()
==
2
)
// TODO: remove hardcoded value
snn
=
"5G:mnc0"
+
nas_data_ind
.
mnc
+
".mcc"
+
nas_data_ind
.
mcc
+
...
...
@@ -205,6 +209,7 @@ void amf_n1::handle_itti_message(itti_uplink_nas_data_ind& nas_data_ind) {
snn
=
"5G:mnc"
+
nas_data_ind
.
mnc
+
".mcc"
+
nas_data_ind
.
mcc
+
".3gppnetwork.org"
;
Logger
::
amf_n1
().
debug
(
"Serving network name %s"
,
snn
.
c_str
());
plmn_t
plmn
=
{};
plmn
.
mnc
=
nas_data_ind
.
mnc
;
plmn
.
mcc
=
nas_data_ind
.
mcc
;
...
...
@@ -235,12 +240,15 @@ void amf_n1::handle_itti_message(itti_uplink_nas_data_ind& nas_data_ind) {
Logger
::
amf_n1
().
error
(
"Not 5GS MOBILITY MANAGEMENT message"
);
return
;
}
uint8_t
ulCount
=
0
;
switch
(
type
)
{
case
PlainNasMsg
:
{
Logger
::
amf_n1
().
debug
(
"Received plain NAS message"
);
decoded_plain_msg
=
recved_nas_msg
;
}
break
;
case
IntegrityProtected
:
{
Logger
::
amf_n1
().
debug
(
"Received integrity protected NAS message"
);
ulCount
=
*
((
uint8_t
*
)
bdata
(
recved_nas_msg
)
+
6
);
...
...
@@ -249,6 +257,7 @@ void amf_n1::handle_itti_message(itti_uplink_nas_data_ind& nas_data_ind) {
decoded_plain_msg
=
blk2bstr
(
(
uint8_t
*
)
bdata
(
recved_nas_msg
)
+
7
,
blength
(
recved_nas_msg
)
-
7
);
}
break
;
case
IntegrityProtectedAndCiphered
:
{
Logger
::
amf_n1
().
debug
(
"Received integrity protected and ciphered NAS message"
);
...
...
@@ -266,6 +275,7 @@ void amf_n1::handle_itti_message(itti_uplink_nas_data_ind& nas_data_ind) {
"Abnormal condition: no existed nas_context. exit..."
);
return
;
}
uint32_t
mac32
=
0
;
if
(
!
nas_message_integrity_protected
(
nc
.
get
()
->
security_ctx
,
NAS_MESSAGE_UPLINK
,
...
...
@@ -299,11 +309,14 @@ void amf_n1::handle_itti_message(itti_uplink_nas_data_ind& nas_data_ind) {
}
}
}
break
;
default:
{
Logger
::
amf_n1
().
error
(
"unknown NAS msg type"
);
return
;
}
}
if
(
nas_data_ind
.
is_nas_signalling_estab_req
)
{
Logger
::
amf_n1
().
debug
(
"Received NAS signalling establishment request..."
);
// dump_nas_message((uint8_t*)bdata(decoded_plain_msg),
// blength(decoded_plain_msg));
print_buffer
(
"amf_n1"
,
"Decoded plain NAS Message buffer"
,
(
uint8_t
*
)
bdata
(
decoded_plain_msg
),
blength
(
decoded_plain_msg
));
...
...
@@ -327,7 +340,7 @@ void amf_n1::nas_signalling_establishment_request_handle(
SecurityHeaderType
type
,
std
::
shared_ptr
<
nas_context
>
nc
,
uint32_t
ran_ue_ngap_id
,
long
amf_ue_ngap_id
,
bstring
plain_msg
,
std
::
string
snn
,
uint8_t
ulCount
)
{
//
1. Create nas context, or update nas context
//
Create NAS Context, or Update if existed
if
((
nc
.
get
()
==
nullptr
)
&&
(
type
==
PlainNasMsg
))
{
Logger
::
amf_n1
().
debug
(
"No existing nas_context with amf_ue_ngap_id 0x%x --> Create a new one"
,
...
...
@@ -355,6 +368,7 @@ void amf_n1::nas_signalling_establishment_request_handle(
uint8_t
*
buf
=
(
uint8_t
*
)
bdata
(
plain_msg
);
uint8_t
message_type
=
*
(
buf
+
2
);
Logger
::
amf_n1
().
debug
(
"NAS message type 0x%x"
,
message_type
);
switch
(
message_type
)
{
case
REGISTRATION_REQUEST
:
{
Logger
::
amf_n1
().
debug
(
...
...
@@ -362,19 +376,22 @@ void amf_n1::nas_signalling_establishment_request_handle(
registration_request_handle
(
true
,
nc
,
ran_ue_ngap_id
,
amf_ue_ngap_id
,
snn
,
plain_msg
);
}
break
;
case
SERVICE_REQUEST
:
{
Logger
::
amf_n1
().
debug
(
"Received service request message, handling..."
);
nc
.
get
()
->
security_ctx
->
ul_count
.
seq_num
=
ulCount
;
service_request_handle
(
true
,
nc
,
ran_ue_ngap_id
,
amf_ue_ngap_id
,
plain_msg
);
}
break
;
case
UE_INIT_DEREGISTER
:
{
Logger
::
amf_n1
().
debug
(
"
received initialUeMessage de-registration request messgae , handle
"
"..."
);
"
Received initialUeMessage de-registration request message,
"
"
handling
..."
);
// ue_initiate_de_registration_handle(ran_ue_ngap_id, amf_ue_ngap_id,
// plain_msg);
}
break
;
default:
Logger
::
amf_n1
().
error
(
"No handler for NAS message 0x%x"
,
message_type
);
}
...
...
@@ -598,9 +615,10 @@ void amf_n1::service_request_handle(
"amf_ue_ngap_id %d, ran_ue_ngap_id %d"
,
amf_ue_ngap_id
,
ran_ue_ngap_id
);
Logger
::
amf_n1
().
debug
(
"Key for pdu session context: SUPI %s"
,
supi
.
c_str
());
std
::
shared_ptr
<
pdu_session_context
>
psc
;
/*
//TODO: get the pdu_session_context from AMF_APP based on both SUPI and PDU Session ID
string ue_context_key = "app_ue_ranid_" + to_string(ran_ue_ngap_id) +
/*
//TODO: get the pdu_session_context from AMF_APP based on both SUPI and PDU
Session ID string ue_context_key = "app_ue_ranid_" +
to_string(ran_ue_ngap_id) +
":amfid_" + to_string(amf_ue_ngap_id);
std::shared_ptr<ue_context> uc;
...
...
@@ -610,7 +628,7 @@ void amf_n1::service_request_handle(
}
}
//TO check: in which condition we should have PDU Session ID
*/
*/
if
(
amf_n11_inst
->
is_supi_to_pdu_ctx
(
supi
))
{
psc
=
amf_n11_inst
->
supi_to_pdu_ctx
(
supi
);
...
...
@@ -717,7 +735,8 @@ void amf_n1::registration_request_handle(
RegistrationRequest
*
regReq
=
new
RegistrationRequest
();
regReq
->
decodefrombuffer
(
nullptr
,
(
uint8_t
*
)
bdata
(
reg
),
blength
(
reg
));
bdestroy
(
reg
);
// free buffer
//find UE context
// Find UE context
string
ue_context_key
=
"app_ue_ranid_"
+
to_string
(
ran_ue_ngap_id
)
+
":amfid_"
+
to_string
(
amf_ue_ngap_id
);
std
::
shared_ptr
<
ue_context
>
uc
;
...
...
@@ -779,31 +798,13 @@ void amf_n1::registration_request_handle(
stacs
.
update_ue_info
(
ueItem
);
set_5gmm_state
(
nc
,
_5GMM_COMMON_PROCEDURE_INITIATED
);
nc
.
get
()
->
is_stacs_available
=
true
;
/*
bool add_new_ue = true;
for(int i=0; i< stacs.ues.size(); i++){
if(!stacs.ues[i].imsi.compare(nc.get()->imsi)){
stacs.ues[i].connStatus = ueItem.connStatus;
stacs.ues[i].registerStatus = ueItem.registerStatus;
stacs.ues[i].ranid = ueItem.ranid;
stacs.ues[i].amfid = ueItem.amfid;
stacs.ues[i].guti = ueItem.guti;
stacs.ues[i].mcc = ueItem.mcc;
stacs.ues[i].mnc = ueItem.mnc;
stacs.ues[i].cellId = ueItem.cellId;
add_new_ue = false;
break;
}
}
if(add_new_ue)
stacs.ues.push_back(ueItem);
*/
}
// nc.get()->imsi = //need interface to transfer SUCI_imsi_t to string
}
}
break
;
case
_5G_GUTI
:
{
guti
=
regReq
->
get_5g_guti
();
Logger
::
amf_n1
().
debug
(
"Decoded GUTI from regist
e
ration request message"
);
Logger
::
amf_n1
().
debug
(
"Decoded GUTI from registration request message"
);
if
(
!
guti
.
compare
(
"error"
))
{
Logger
::
amf_n1
().
warn
(
"No GUTI IE"
);
}
...
...
@@ -847,6 +848,10 @@ void amf_n1::registration_request_handle(
// supi2ranId[("imsi-"+nc.get()->imsi)] = ran_ue_ngap_id;
}
}
break
;
default:
{
Logger
::
amf_n1
().
warn
(
"Unknown UE Mobility Identity"
);
}
}
// Create NAS context
...
...
@@ -883,11 +888,11 @@ void amf_n1::registration_request_handle(
nc
.
get
()
->
amf_ue_ngap_id
=
amf_ue_ngap_id
;
nc
.
get
()
->
serving_network
=
snn
;
//
u
pdate UE conext
//
U
pdate UE conext
if
(
uc
.
get
()
!=
nullptr
)
{
std
::
string
supi
=
"imsi-"
+
nc
.
get
()
->
imsi
;
uc
.
get
()
->
supi
=
supi
;
//
associate SUPI with UC
//
associate SUPI with UC
amf_app_inst
->
set_supi_2_ue_context
(
supi
,
uc
);
}
...
...
@@ -916,7 +921,7 @@ void amf_n1::registration_request_handle(
}
nc
.
get
()
->
ngKsi
=
ngKSI
;
// Get non-current native
nas
key set identity (Optional IE), used for
// Get non-current native
NAS
key set identity (Optional IE), used for
// inter-system change from S1 to N1 Get 5GMM Capability IE (optional), not
// included for periodic registration updating procedure
uint8_t
_5g_mm_cap
=
regReq
->
get5GMMCapability
();
...
...
@@ -957,24 +962,32 @@ void amf_n1::registration_request_handle(
run_initial_registration_procedure
();
// IEs?
run_registration_procedure
(
nc
);
}
break
;
case
MOBILITY_REGISTRATION_UPDATING
:
{
Logger
::
amf_n1
().
error
(
"Network handling mobility registration ..."
);
run_mobility_registration_update_procedure
(
nc
);
}
break
;
case
PERIODIC_REGISTRATION_UPDATING
:
{
Logger
::
amf_n1
().
error
(
"Network does
n'
t support periodic registration, reject ..."
);
"Network does
no
t support periodic registration, reject ..."
);
}
break
;
case
EMERGENCY_REGISTRATION
:
{
if
(
!
amf_cfg
.
is_emergency_support
.
compare
(
"false"
))
{
Logger
::
amf_n1
().
error
(
"Network does
n'
t support emergency registration, reject ..."
);
"Network does
no
t support emergency registration, reject ..."
);
response_registration_reject_msg
(
_5GMM_CAUSE_ILLEGAL_UE
,
ran_ue_ngap_id
,
amf_ue_ngap_id
);
// cause?
return
;
}
}
break
;
default
:
{
Logger
::
amf_n1
().
error
(
"Unknown registration type ..."
);
//TODO:
return
;
}
}
}
...
...
@@ -2357,8 +2370,9 @@ void amf_n1::run_mobility_registration_update_procedure(
Logger
::
amf_n1
().
debug
(
"Key for pdu session context SUPI (%s)"
,
supi
.
c_str
());
std
::
shared_ptr
<
pdu_session_context
>
psc
;
/*
//TODO: get the pdu_session_context from AMF_APP based on both SUPI and PDU Session ID
string ue_context_key = "app_ue_ranid_" + to_string(ran_ue_ngap_id) +
//TODO: get the pdu_session_context from AMF_APP based on both SUPI and PDU
Session ID string ue_context_key = "app_ue_ranid_" +
to_string(ran_ue_ngap_id) +
":amfid_" + to_string(amf_ue_ngap_id);
std::shared_ptr<ue_context> uc;
...
...
src/amf-app/amf_n11.cpp
View file @
63a4dc20
...
...
@@ -427,8 +427,8 @@ void amf_n11::handle_pdu_session_initial_request(
//------------------------------------------------------------------------------
void
amf_n11
::
handle_itti_message
(
itti_nsmf_pdusession_release_sm_context
&
itti_msg
)
{
//
TTN: Should be replace by new mechanism to support multiple PDU sessions
//
Need PDU session ID
//
TTN: Should be replace by new mechanism to support multiple PDU sessions
//
Need PDU session ID
std
::
shared_ptr
<
pdu_session_context
>
psc
=
supi_to_pdu_ctx
(
itti_msg
.
supi
);
string
smf_addr
;
std
::
string
smf_api_version
;
...
...
@@ -530,13 +530,13 @@ void amf_n11::curl_http_client(
std
::
string
body
;
std
::
shared_ptr
<
pdu_session_context
>
psc
;
//TTN: Should be replace by new mechanism to support multiple PDU sessions
if
(
!
amf_app_inst
->
find_pdu_session_context
(
supi
,
pdu_session_id
,
psc
))
{
//
TTN: Should be replace by new mechanism to support multiple PDU sessions
if
(
!
amf_app_inst
->
find_pdu_session_context
(
supi
,
pdu_session_id
,
psc
))
{
Logger
::
amf_n11
().
warn
(
"PDU Session context for SUPI %s doesn't exit!"
,
supi
.
c_str
());
//
TODO:
//
TODO:
}
/*
/*
if (is_supi_to_pdu_ctx(supi)) {
psc = supi_to_pdu_ctx(supi);
} else {
...
...
@@ -544,7 +544,7 @@ void amf_n11::curl_http_client(
"PDU Session context for SUPI %s doesn't exit!", supi.c_str());
// TODO:
}
*/
*/
if
((
n1SmMsg
.
size
()
>
0
)
and
(
n2SmMsg
.
size
()
>
0
))
{
// prepare the body content for Curl
...
...
src/amf-app/amf_n2.cpp
View file @
63a4dc20
...
...
@@ -349,7 +349,7 @@ void amf_n2::handle_itti_message(itti_initial_ue_message& init_ue_msg) {
// gNB, for example, here RAN UE NGAP ID and location information and RRC
// Establishment Cause send NAS-PDU to NAS layer Get INITIAL_UE_MESSAGE IEs
//
c
heck the gNB context on which this UE is attached with assoc_id
//
C
heck the gNB context on which this UE is attached with assoc_id
itti_nas_signalling_establishment_request
*
itti_msg
=
new
itti_nas_signalling_establishment_request
(
TASK_AMF_N2
,
TASK_AMF_APP
);
...
...
@@ -358,6 +358,7 @@ void amf_n2::handle_itti_message(itti_initial_ue_message& init_ue_msg) {
"No existing gNG context with assoc_id (%d)"
,
init_ue_msg
.
assoc_id
);
return
;
}
std
::
shared_ptr
<
gnb_context
>
gc
;
gc
=
assoc_id_2_gnb_context
(
init_ue_msg
.
assoc_id
);
if
(
gc
.
get
()
->
ng_state
==
NGAP_RESETING
||
...
...
@@ -378,6 +379,7 @@ void amf_n2::handle_itti_message(itti_initial_ue_message& init_ue_msg) {
Logger
::
amf_n2
().
error
(
"Missing Mandatory IE (RanUeNgapId)"
);
return
;
}
std
::
shared_ptr
<
ue_ngap_context
>
unc
;
if
(
!
is_ran_ue_id_2_ue_ngap_context
(
ran_ue_ngap_id
))
{
Logger
::
amf_n2
().
debug
(
...
...
@@ -388,11 +390,12 @@ void amf_n2::handle_itti_message(itti_initial_ue_message& init_ue_msg) {
}
else
{
unc
=
ran_ue_id_2_ue_ngap_context
(
ran_ue_ngap_id
);
}
if
(
unc
.
get
()
==
nullptr
)
{
Logger
::
amf_n2
().
error
(
"Failed to get UE NGAP context for ran_ue_ngap_id 0x%x"
,
21
);
}
else
{
//
store
information into UE NGAP context
//
Store related
information into UE NGAP context
unc
.
get
()
->
ran_ue_ngap_id
=
ran_ue_ngap_id
;
unc
.
get
()
->
sctp_stream_recv
=
init_ue_msg
.
stream
;
unc
.
get
()
->
sctp_stream_send
==
gc
.
get
()
->
next_sctp_stream
;
...
...
@@ -402,6 +405,7 @@ void amf_n2::handle_itti_message(itti_initial_ue_message& init_ue_msg) {
unc
.
get
()
->
gnb_assoc_id
=
init_ue_msg
.
assoc_id
;
NrCgi_t
cgi
;
Tai_t
tai
;
if
(
init_ue_msg
.
initUeMsg
->
getUserLocationInfoNR
(
cgi
,
tai
))
{
itti_msg
->
cgi
=
cgi
;
itti_msg
->
tai
=
tai
;
...
...
@@ -409,12 +413,14 @@ void amf_n2::handle_itti_message(itti_initial_ue_message& init_ue_msg) {
Logger
::
amf_n2
().
error
(
"Missing Mandatory IE UserLocationInfoNR"
);
return
;
}
if
(
init_ue_msg
.
initUeMsg
->
getRRCEstablishmentCause
()
==
-
1
)
{
Logger
::
amf_n2
().
warn
(
"IE RRCEstablishmentCause not present"
);
itti_msg
->
rrc_cause
=
-
1
;
// not present
}
else
{
itti_msg
->
rrc_cause
=
init_ue_msg
.
initUeMsg
->
getRRCEstablishmentCause
();
}
#if 0
if(init_ue_msg.initUeMsg->getUeContextRequest() == -1){
Logger::amf_n2().warn("IE UeContextRequest not present");
...
...
@@ -423,6 +429,7 @@ void amf_n2::handle_itti_message(itti_initial_ue_message& init_ue_msg) {
itti_msg->ueCtxReq = init_ue_msg.initUeMsg->getUeContextRequest();
}
#endif
std
::
string
_5g_s_tmsi
;
if
(
!
init_ue_msg
.
initUeMsg
->
get5GS_TMSI
(
_5g_s_tmsi
))
{
itti_msg
->
is_5g_s_tmsi_present
=
false
;
...
...
@@ -688,11 +695,13 @@ void amf_n2::handle_itti_message(
Logger
::
amf_n2
().
debug
(
"SUPI (%s)"
,
supi
.
c_str
());
std
::
shared_ptr
<
pdu_session_context
>
psc
;
//TODO: REMOVE supi_to_pdu_ctx
if
(
!
amf_app_inst
->
find_pdu_session_context
(
supi
,
itti_msg
.
pdu_session_id
,
psc
)){
Logger
::
amf_n2
().
warn
(
"Cannot get pdu_session_context with SUPI (%s)"
,
supi
.
c_str
());
// TODO: REMOVE supi_to_pdu_ctx
if
(
!
amf_app_inst
->
find_pdu_session_context
(
supi
,
itti_msg
.
pdu_session_id
,
psc
))
{
Logger
::
amf_n2
().
warn
(
"Cannot get pdu_session_context with SUPI (%s)"
,
supi
.
c_str
());
}
/*
/*
if (amf_n11_inst->is_supi_to_pdu_ctx(supi)) {
psc = amf_n11_inst->supi_to_pdu_ctx(supi);
} else {
...
...
@@ -1023,7 +1032,7 @@ void amf_n2::handle_itti_message(itti_handover_required& itti_msg) {
// handoverrequest->setSourceToTarget_TransparentContainer(sourceTotarget);
string
supi
=
"imsi-"
+
nc
.
get
()
->
imsi
;
//TODO: REMOVE supi_to_pdu_ctx (need PDU Session ID)/ list of PDU Session ID
//
TODO: REMOVE supi_to_pdu_ctx (need PDU Session ID)/ list of PDU Session ID
std
::
shared_ptr
<
pdu_session_context
>
psc
=
amf_n11_inst
->
supi_to_pdu_ctx
(
supi
);
...
...
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