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
6cc84963
Commit
6cc84963
authored
Nov 07, 2021
by
Tien-Thinh Nguyen
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
First version for mobile reachable timer handling
parent
52eafd19
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
120 additions
and
4 deletions
+120
-4
src/amf-app/amf_app.hpp
src/amf-app/amf_app.hpp
+1
-0
src/amf-app/amf_n1.cpp
src/amf-app/amf_n1.cpp
+68
-3
src/amf-app/amf_n1.hpp
src/amf-app/amf_n1.hpp
+15
-0
src/amf-app/amf_n2.cpp
src/amf-app/amf_n2.cpp
+33
-0
src/contexts/nas_context.cpp
src/contexts/nas_context.cpp
+2
-1
src/contexts/nas_context.hpp
src/contexts/nas_context.hpp
+1
-0
No files found.
src/amf-app/amf_app.hpp
View file @
6cc84963
...
...
@@ -55,6 +55,7 @@ static uint32_t amf_app_ue_ngap_id_generator = 1;
namespace
amf_application
{
#define TASK_AMF_APP_PERIODIC_STATISTICS (0)
#define TASK_AMF_MOBILE_REACHABLE_TIMER_EXPIRE (1)
class
amf_app
{
private:
...
...
src/amf-app/amf_n1.cpp
View file @
6cc84963
...
...
@@ -63,6 +63,7 @@
#include "nas_algorithms.hpp"
#include "sha256.hpp"
#include "comUt.hpp"
#include "3gpp_24.501.h"
extern
"C"
{
#include "bstrlib.h"
...
...
@@ -111,6 +112,21 @@ void amf_n1_task(void*) {
dynamic_cast
<
itti_downlink_nas_transfer
*>
(
msg
);
amf_n1_inst
->
handle_itti_message
(
ref
(
*
m
));
}
break
;
case
TIME_OUT
:
{
if
(
itti_msg_timeout
*
to
=
dynamic_cast
<
itti_msg_timeout
*>
(
msg
))
{
switch
(
to
->
arg1_user
)
{
case
TASK_AMF_MOBILE_REACHABLE_TIMER_EXPIRE
:
amf_n1_inst
->
mobile_reachable_timer_timeout
(
to
->
timer_id
,
to
->
arg2_user
);
break
;
default:
Logger
::
amf_n1
().
info
(
"No handler for timer(%d) with arg1_user(%d) "
,
to
->
timer_id
,
to
->
arg1_user
);
}
}
}
break
;
case
TERMINATE
:
{
if
(
itti_msg_terminate
*
terminate
=
dynamic_cast
<
itti_msg_terminate
*>
(
msg
))
{
...
...
@@ -2166,7 +2182,7 @@ void amf_n1::security_mode_complete_handle(
// TODO: remove hardcoded values
regAccept
->
set_5GS_Network_Feature_Support
(
0x01
,
0x00
);
regAccept
->
setT3512_Value
(
0x5
,
0x1e
);
regAccept
->
setT3512_Value
(
0x5
,
T3512_TIMER_VALUE_MIN
);
uint8_t
buffer
[
BUFFER_SIZE_1024
]
=
{
0
};
int
encoded_size
=
regAccept
->
encode2buffer
(
buffer
,
BUFFER_SIZE_1024
);
comUt
::
print_buffer
(
...
...
@@ -2997,6 +3013,20 @@ void amf_n1::get_5gmm_state(
state
=
nc
.
get
()
->
_5gmm_state
;
}
//------------------------------------------------------------------------------
void
amf_n1
::
set_5gcm_state
(
std
::
shared_ptr
<
nas_context
>&
nc
,
const
cm_state_t
&
state
)
{
std
::
shared_lock
lock
(
m_nas_context
);
nc
.
get
()
->
nas_status
=
state
;
}
//------------------------------------------------------------------------------
void
amf_n1
::
get_5gcm_state
(
const
std
::
shared_ptr
<
nas_context
>&
nc
,
cm_state_t
&
state
)
const
{
std
::
shared_lock
lock
(
m_nas_context
);
state
=
nc
.
get
()
->
nas_status
;
}
//------------------------------------------------------------------------------
void
amf_n1
::
handle_ue_reachability_status_change
(
std
::
string
supi
,
uint8_t
http_version
)
{
...
...
@@ -3072,8 +3102,8 @@ void amf_n1::initialize_registration_accept(
std
::
unique_ptr
<
nas
::
RegistrationAccept
>&
registration_accept
)
{
registration_accept
->
setHeader
(
PLAIN_5GS_MSG
);
registration_accept
->
set_5GS_Registration_Result
(
false
,
false
,
false
,
0x01
);
// 3GPP Access
registration_accept
->
setT3512_Value
(
0x5
,
0x1e
);
// TODO
false
,
false
,
false
,
0x01
);
// 3GPP Access
registration_accept
->
setT3512_Value
(
0x5
,
T3512_TIMER_VALUE_MIN
);
std
::
vector
<
p_tai_t
>
tai_list
;
for
(
auto
p
:
amf_cfg
.
plmn_list
)
{
...
...
@@ -3153,3 +3183,38 @@ bool amf_n1::find_ue_context(
return
true
;
}
//------------------------------------------------------------------------------
void
amf_n1
::
mobile_reachable_timer_timeout
(
timer_id_t
timer_id
,
uint64_t
amf_ue_ngap_id
)
{
std
::
shared_ptr
<
nas_context
>
nc
;
if
(
amf_n1_inst
->
is_amf_ue_id_2_nas_context
(
amf_ue_ngap_id
))
nc
=
amf_n1_inst
->
amf_ue_id_2_nas_context
(
amf_ue_ngap_id
);
else
{
Logger
::
amf_n2
().
warn
(
"No existed nas_context with amf_ue_ngap_id(0x%x)"
,
amf_ue_ngap_id
);
}
set_mobile_reachable_timer_timeout
(
nc
,
true
);
// TODO: Start the implicit de-registration timer
}
//------------------------------------------------------------------------------
void
amf_n1
::
set_mobile_reachable_timer_timeout
(
std
::
shared_ptr
<
nas_context
>&
nc
,
const
bool
&
b
)
{
std
::
unique_lock
lock
(
m_nas_context
);
nc
.
get
()
->
is_mobile_reachable_timer_timeout
=
b
;
}
//------------------------------------------------------------------------------
void
amf_n1
::
get_mobile_reachable_timer_timeout
(
const
std
::
shared_ptr
<
nas_context
>&
nc
,
bool
&
b
)
const
{
std
::
shared_lock
lock
(
m_nas_context
);
b
=
nc
.
get
()
->
is_mobile_reachable_timer_timeout
;
}
//------------------------------------------------------------------------------
bool
amf_n1
::
get_mobile_reachable_timer_timeout
(
const
std
::
shared_ptr
<
nas_context
>&
nc
)
const
{
std
::
shared_lock
lock
(
m_nas_context
);
return
nc
.
get
()
->
is_mobile_reachable_timer_timeout
;
}
src/amf-app/amf_n1.hpp
View file @
6cc84963
...
...
@@ -47,6 +47,7 @@
#include "amf_event.hpp"
#include "RegistrationAccept.hpp"
#include "ue_context.hpp"
#include "itti.hpp"
namespace
amf_application
{
...
...
@@ -162,6 +163,11 @@ class amf_n1 {
void
set_5gmm_state
(
std
::
shared_ptr
<
nas_context
>
nc
,
_5gmm_state_t
state
);
void
get_5gmm_state
(
std
::
shared_ptr
<
nas_context
>
nc
,
_5gmm_state_t
&
state
);
void
set_5gcm_state
(
std
::
shared_ptr
<
nas_context
>&
nc
,
const
cm_state_t
&
state
);
void
get_5gcm_state
(
const
std
::
shared_ptr
<
nas_context
>&
nc
,
cm_state_t
&
state
)
const
;
void
handle_ue_reachability_status_change
(
std
::
string
supi
,
uint8_t
http_version
);
...
...
@@ -178,6 +184,15 @@ class amf_n1 {
uint32_t
ran_ue_ngap_id
,
long
amf_ue_ngap_id
,
std
::
shared_ptr
<
ue_context
>&
uc
);
void
mobile_reachable_timer_timeout
(
timer_id_t
timer_id
,
uint64_t
amf_ue_ngap_id
);
void
set_mobile_reachable_timer_timeout
(
std
::
shared_ptr
<
nas_context
>&
nc
,
const
bool
&
b
);
void
get_mobile_reachable_timer_timeout
(
const
std
::
shared_ptr
<
nas_context
>&
nc
,
bool
&
b
)
const
;
bool
get_mobile_reachable_timer_timeout
(
const
std
::
shared_ptr
<
nas_context
>&
nc
)
const
;
private:
void
ue_initiate_de_registration_handle
(
uint32_t
ran_ue_ngap_id
,
long
amf_ue_ngap_id
,
bstring
nas
);
...
...
src/amf-app/amf_n2.cpp
View file @
6cc84963
...
...
@@ -53,6 +53,7 @@
#include "itti_msg_amf_app.hpp"
#include "logger.hpp"
#include "sctp_server.hpp"
#include "3gpp_24.501.h"
#include <boost/chrono.hpp>
#include <boost/chrono/chrono.hpp>
...
...
@@ -261,6 +262,21 @@ void amf_n2::handle_itti_message(itti_paging& itti_msg) {
// TODO: check UE reachability status
// get NAS context
std
::
shared_ptr
<
nas_context
>
nc
=
{};
if
(
amf_n1_inst
->
is_amf_ue_id_2_nas_context
(
itti_msg
.
amf_ue_ngap_id
))
nc
=
amf_n1_inst
->
amf_ue_id_2_nas_context
(
itti_msg
.
amf_ue_ngap_id
);
else
{
Logger
::
amf_n2
().
warn
(
"No existed nas_context with amf_ue_ngap_id(0x%x)"
,
itti_msg
.
amf_ue_ngap_id
);
}
// Network stops sending paging messages since the mobile reachable timer
// expires
if
(
amf_n1_inst
->
get_mobile_reachable_timer_timeout
(
nc
))
{
return
;
}
PagingMsg
paging_msg
=
{};
paging_msg
.
setMessageType
();
Logger
::
amf_n2
().
debug
(
...
...
@@ -1265,6 +1281,23 @@ void amf_n2::handle_itti_message(itti_ue_context_release_complete& itti_msg) {
Logger
::
amf_n2
().
debug
(
"Handle UE Context Release Complete ..."
);
unsigned
long
amf_ue_ngap_id
=
itti_msg
.
ueCtxRelCmpl
->
getAmfUeNgapId
();
uint32_t
ran_ue_ngap_id
=
itti_msg
.
ueCtxRelCmpl
->
getRanUeNgapId
();
// Change UE status from CM-CONNECTED to CM-IDLE
std
::
shared_ptr
<
nas_context
>
nc
;
if
(
amf_n1_inst
->
is_amf_ue_id_2_nas_context
(
amf_ue_ngap_id
))
nc
=
amf_n1_inst
->
amf_ue_id_2_nas_context
(
amf_ue_ngap_id
);
else
{
Logger
::
amf_n2
().
warn
(
"No existed nas_context with amf_ue_ngap_id(0x%x)"
,
amf_ue_ngap_id
);
}
amf_n1_inst
->
set_5gcm_state
(
nc
,
CM_IDLE
);
// Start/reset the Mobile Reachable Timer
timer_id_t
tid
=
itti_inst
->
timer_setup
(
MOBILE_REACHABLE_TIMER_NO_EMERGENCY_SERVICES_MIN
*
60
,
0
,
TASK_AMF_N1
,
TASK_AMF_MOBILE_REACHABLE_TIMER_EXPIRE
,
amf_ue_ngap_id
);
Logger
::
amf_app
().
startup
(
"Started mobile reachable timer ( tid %d)"
,
tid
);
amf_n1_inst
->
set_mobile_reachable_timer_timeout
(
nc
,
false
);
// TODO: User Location Information IE
// TODO: Information on Recommended Cells & RAN Nodes for Paging IE
...
...
src/contexts/nas_context.cpp
View file @
6cc84963
...
...
@@ -64,7 +64,8 @@ nas_context::nas_context() : _vector(), _5g_he_av(), _5g_av(), kamf() {
is_auth_vectors_present
=
false
;
to_be_register_by_new_suci
=
false
;
ueSecurityCaplen
=
0
;
nas_status
=
{};
nas_status
=
CM_IDLE
;
is_mobile_reachable_timer_timeout
=
false
;
}
//------------------------------------------------------------------------------
...
...
src/contexts/nas_context.hpp
View file @
6cc84963
...
...
@@ -71,6 +71,7 @@ class nas_context {
uint32_t
ran_ue_ngap_id
;
cm_state_t
nas_status
;
_5gmm_state_t
_5gmm_state
;
bool
is_mobile_reachable_timer_timeout
;
// parameters from Registration request
uint8_t
registration_type
:
3
;
...
...
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