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
765c0f42
Commit
765c0f42
authored
May 18, 2021
by
Tien-Thinh Nguyen
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Trigger UE Context Release from AMF
parent
a3579fcb
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
34 additions
and
39 deletions
+34
-39
src/amf-app/amf_n1.cpp
src/amf-app/amf_n1.cpp
+25
-33
src/amf-app/amf_n2.cpp
src/amf-app/amf_n2.cpp
+9
-6
No files found.
src/amf-app/amf_n1.cpp
View file @
765c0f42
...
...
@@ -2434,44 +2434,13 @@ void amf_n1::run_initial_registration_procedure() {}
void
amf_n1
::
ue_initiate_de_registration_handle
(
uint32_t
ran_ue_ngap_id
,
long
amf_ue_ngap_id
,
bstring
nas
)
{
Logger
::
amf_n1
().
debug
(
"Handling UE-initiated De-registration Request"
);
/*
string guti = "1234567890";//need modify
_5G_GUTI_t Guti;
_5GSMobilityIdentity *ulNas = new _5GSMobilityIdentity();
ulNas->decodefrombuffer((uint8_t*)bdata(nas)+4, blength(nas),false);
ulNas->get5GGUTI(Guti);
delete ulNas;
string amf_region_id = std::to_string(Guti.amf_region_id);
guti = Guti.mcc + Guti.mnc + std::to_string(Guti.amf_region_id) +
std::to_string(Guti.amf_set_id) + std::to_string(Guti.amf_pointer) +
std::to_string(Guti._5g_tmsi); std::shared_ptr<nas_context> nc;
if(!is_guti_2_nas_context(guti))
return;
nc = guti_2_nas_context(guti);
nc.get()-> is_auth_vectors_present = false;
nc.get()-> is_current_security_available = false;
nc.get()->security_ctx->sc_type = SECURITY_CTX_TYPE_NOT_AVAILABLE;
Logger::ngap().debug("sending itti ue context release command to
TASK_AMF_N2"); itti_ue_context_release_command * itti_msg = new
itti_ue_context_release_command(TASK_AMF_N1, TASK_AMF_N2);
itti_msg->amf_ue_ngap_id = amf_ue_ngap_id;
itti_msg->ran_ue_ngap_id = ran_ue_ngap_id;
itti_msg->cause.setChoiceOfCause(Ngap_Cause_PR_nas);
itti_msg->cause.setValue(2);//cause nas(2)--deregister
std::shared_ptr<itti_ue_context_release_command> i =
std::shared_ptr<itti_ue_context_release_command>(itti_msg); int ret =
itti_inst->send_msg(i); if (0 != ret) { Logger::ngap().error("Could not send
ITTI message %s to task TASK_AMF_N2", i->get_msg_name());
}
*/
std
::
shared_ptr
<
nas_context
>
nc
;
if
(
is_amf_ue_id_2_nas_context
(
amf_ue_ngap_id
))
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
;
}
...
...
@@ -2509,7 +2478,7 @@ void amf_n1::ue_initiate_de_registration_handle(
print_buffer
(
"amf_n1"
,
"De-registration Accept message buffer"
,
buffer
,
encoded_size
);
if
(
encoded_size
<
1
)
{
Logger
::
nas_mm
().
error
(
"Encode De-registration Accept message error"
);
Logger
::
nas_mm
().
error
(
"Encode De-registration Accept message error
!
"
);
return
;
}
...
...
@@ -2520,6 +2489,29 @@ void amf_n1::ue_initiate_de_registration_handle(
if
(
nc
.
get
()
->
is_stacs_available
)
{
stacs
.
update_5gmm_state
(
nc
.
get
()
->
imsi
,
"5GMM-DEREGISTERED"
);
}
// TODO: AMF to AN: N2 UE Context Release Request
// AMF sends N2 UE Release command to NG-RAN with Cause set to Deregistration
// to release N2 signalling connection
Logger
::
ngap
().
debug
(
"Sending ITTI UE Context Release Command to TASK_AMF_N2"
);
itti_ue_context_release_command
*
itti_msg
=
new
itti_ue_context_release_command
(
TASK_AMF_N1
,
TASK_AMF_N2
);
itti_msg
->
amf_ue_ngap_id
=
amf_ue_ngap_id
;
itti_msg
->
ran_ue_ngap_id
=
ran_ue_ngap_id
;
itti_msg
->
cause
.
setChoiceOfCause
(
Ngap_Cause_PR_nas
);
itti_msg
->
cause
.
setValue
(
2
);
// cause nas(2)--deregister
std
::
shared_ptr
<
itti_ue_context_release_command
>
i
=
std
::
shared_ptr
<
itti_ue_context_release_command
>
(
itti_msg
);
int
ret
=
itti_inst
->
send_msg
(
i
);
if
(
0
!=
ret
)
{
Logger
::
ngap
().
error
(
"Could not send ITTI message %s to task TASK_AMF_N2"
,
i
->
get_msg_name
());
}
}
//------------------------------------------------------------------------------
...
...
src/amf-app/amf_n2.cpp
View file @
765c0f42
...
...
@@ -957,42 +957,45 @@ void amf_n2::handle_itti_message(itti_ue_context_release_request& itti_msg) {
}
void
amf_n2
::
handle_itti_message
(
itti_ue_context_release_command
&
itti_msg
)
{
Logger
::
amf_n2
().
debug
(
"
handling ue context release c
ommand ..."
);
Logger
::
amf_n2
().
debug
(
"
Handling UE Context Release C
ommand ..."
);
std
::
shared_ptr
<
ue_ngap_context
>
unc
;
unc
=
ran_ue_id_2_ue_ngap_context
(
itti_msg
.
ran_ue_ngap_id
);
if
(
unc
.
get
()
==
nullptr
)
{
Logger
::
amf_n2
().
error
(
"Illegal
ue with ran_ue_ngap_id
(0x%x)"
,
itti_msg
.
ran_ue_ngap_id
);
"Illegal
UE with ran_ue_ngap_id
(0x%x)"
,
itti_msg
.
ran_ue_ngap_id
);
return
;
}
std
::
shared_ptr
<
gnb_context
>
gc
;
gc
=
assoc_id_2_gnb_context
(
unc
.
get
()
->
gnb_assoc_id
);
if
(
gc
.
get
()
==
nullptr
)
{
Logger
::
amf_n2
().
error
(
"Illegal g
nb with assoc id
(0x%x)"
,
unc
.
get
()
->
gnb_assoc_id
);
"Illegal g
NB with assoc id
(0x%x)"
,
unc
.
get
()
->
gnb_assoc_id
);
return
;
}
// UEContextReleaseCommandMsg* ueCtxRelCmd = new UEContextReleaseCommandMsg();
std
::
unique_ptr
<
UEContextReleaseCommandMsg
>
ueCtxRelCmd
=
std
::
make_unique
<
UEContextReleaseCommandMsg
>
();
ueCtxRelCmd
->
setMessageType
();
ueCtxRelCmd
->
setUeNgapIdPair
(
itti_msg
.
amf_ue_ngap_id
,
itti_msg
.
ran_ue_ngap_id
);
if
(
itti_msg
.
cause
.
getChoiceOfCause
()
==
Ngap_Cause_PR_nas
)
{
ueCtxRelCmd
->
setCauseNas
((
e_Ngap_CauseNas
)
itti_msg
.
cause
.
getValue
());
}
if
(
itti_msg
.
cause
.
getChoiceOfCause
()
==
Ngap_Cause_PR_radioNetwork
)
{
ueCtxRelCmd
->
setCauseRadioNetwork
(
(
e_Ngap_CauseRadioNetwork
)
itti_msg
.
cause
.
getValue
());
}
uint8_t
buffer
[
200
];
uint8_t
buffer
[
200
];
// TODO: remove hardcoded value
int
encoded_size
=
ueCtxRelCmd
->
encode2buffer
(
buffer
,
200
);
// delete ueCtxRelCmd;
bstring
b
=
blk2bstr
(
buffer
,
encoded_size
);
sctp_s_38412
.
sctp_send_msg
(
gc
.
get
()
->
sctp_assoc_id
,
unc
.
get
()
->
sctp_stream_send
,
&
b
);
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