Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
O
OpenXG-SMF
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
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-SMF
Commits
11614b91
Commit
11614b91
authored
Oct 19, 2021
by
Tien-Thinh Nguyen
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'timer_handling_t3591' into 'develop'
Timer handling t3591 See merge request oai/cn5g/oai-cn5g-smf!100
parents
e1b9699a
9238330e
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
272 additions
and
19 deletions
+272
-19
src/common/3gpp_24.501.h
src/common/3gpp_24.501.h
+4
-0
src/smf_app/smf_app.cpp
src/smf_app/smf_app.cpp
+148
-3
src/smf_app/smf_app.hpp
src/smf_app/smf_app.hpp
+19
-2
src/smf_app/smf_context.cpp
src/smf_app/smf_context.cpp
+57
-2
src/smf_app/smf_context.hpp
src/smf_app/smf_context.hpp
+26
-7
src/smf_app/smf_procedure.cpp
src/smf_app/smf_procedure.cpp
+18
-5
No files found.
src/common/3gpp_24.501.h
View file @
11614b91
...
...
@@ -382,6 +382,10 @@ struct paa_s {
};
typedef
struct
paa_s
paa_t
;
constexpr
uint8_t
NUMBER_RETRANSMISSION_TIMES_T3591
=
4
;
constexpr
uint8_t
NUMBER_RETRANSMISSION_TIMES_T3592
=
4
;
#endif
#endif
src/smf_app/smf_app.cpp
View file @
11614b91
...
...
@@ -273,7 +273,8 @@ void smf_app_task(void*) {
Logger
::
smf_app
().
info
(
"TIME-OUT event timer id %d"
,
to
->
timer_id
);
switch
(
to
->
arg1_user
)
{
case
TASK_SMF_APP_TRIGGER_T3591
:
smf_app_inst
->
timer_t3591_timeout
(
to
->
timer_id
,
to
->
arg2_user
);
smf_app_inst
->
timer_t3591_timeout
(
to
->
timer_id
,
(
scid_t
)
to
->
arg2_user
);
break
;
case
TASK_SMF_APP_TIMEOUT_NRF_HEARTBEAT
:
smf_app_inst
->
timer_nrf_heartbeat_timeout
(
...
...
@@ -1484,6 +1485,48 @@ bool smf_app::scid_2_smf_context(
return
false
;
}
//------------------------------------------------------------------------------
bool
smf_app
::
find_pdu_session
(
const
scid_t
&
scid
,
std
::
shared_ptr
<
smf_pdu_session
>&
sp
)
const
{
// get the SMF Context
std
::
shared_ptr
<
smf_context_ref
>
scf
=
{};
if
(
is_scid_2_smf_context
(
scid
))
{
scf
=
scid_2_smf_context
(
scid
);
}
else
{
Logger
::
smf_app
().
warn
(
"Context associated with this id "
SCID_FMT
" does not exit!"
,
scid
);
return
false
;
}
supi_t
supi
=
scf
.
get
()
->
supi
;
supi64_t
supi64
=
smf_supi_to_u64
(
supi
);
pdu_session_id_t
pdu_session_id
=
scf
.
get
()
->
pdu_session_id
;
std
::
shared_ptr
<
smf_context
>
sc
=
{};
if
(
is_supi_2_smf_context
(
supi64
))
{
sc
=
supi_2_smf_context
(
supi64
);
Logger
::
smf_app
().
debug
(
"Retrieve SMF context with SUPI "
SUPI_64_FMT
""
,
supi64
);
}
else
{
Logger
::
smf_app
().
warn
(
"Could not retrieve the corresponding SMF context with "
"Supi "
SUPI_64_FMT
"!"
,
supi64
);
return
false
;
}
// Get PDU Session
if
(
!
sc
.
get
()
->
find_pdu_session
(
pdu_session_id
,
sp
))
{
Logger
::
smf_app
().
warn
(
"Could not retrieve the corresponding SMF PDU Session context!"
);
return
false
;
}
if
(
!
sp
)
return
false
;
return
true
;
}
//------------------------------------------------------------------------------
bool
smf_app
::
use_local_configuration_subscription_data
(
const
std
::
string
&
dnn_selection_mode
)
{
...
...
@@ -1596,9 +1639,111 @@ void smf_app::update_pdu_session_upCnx_state(
"Set PDU Session UpCnxState to %s"
,
upCnx_state_e2str
.
at
(
static_cast
<
int
>
(
state
)).
c_str
());
}
//---------------------------------------------------------------------------------------------
void
smf_app
::
timer_t3591_timeout
(
timer_id_t
timer_id
,
uint64_t
arg2_user
)
{
// TODO: send session modification request again...
void
smf_app
::
timer_t3591_timeout
(
timer_id_t
timer_id
,
scid_t
scid
)
{
// Re-send Session Modification Command ...
// Get PDU Session
std
::
shared_ptr
<
smf_pdu_session
>
sp
=
{};
if
(
!
find_pdu_session
(
scid
,
sp
))
{
Logger
::
smf_app
().
warn
(
"Could not retrieve the corresponding SMF PDU Session context!"
);
return
;
}
std
::
shared_ptr
<
itti_n11_msg
>
pending_n11_msg
=
{};
sp
.
get
()
->
get_pending_n11_msg
(
pending_n11_msg
);
if
(
!
pending_n11_msg
)
{
Logger
::
smf_app
().
warn
(
"Could not retrieve the pending message!"
);
return
;
}
std
::
shared_ptr
<
itti_n11_update_sm_context_response
>
n11_msg
=
std
::
static_pointer_cast
<
itti_n11_update_sm_context_response
>
(
pending_n11_msg
);
if
(
n11_msg
)
{
uint8_t
number_retransmission
=
sp
.
get
()
->
get_number_retransmission_T3591
();
if
(
number_retransmission
<=
NUMBER_RETRANSMISSION_TIMES_T3591
)
{
sp
.
get
()
->
set_number_retransmission_T3591
(
number_retransmission
+
1
);
}
else
{
// Update PDU Session status -> ACTIVE
sp
.
get
()
->
set_pdu_session_status
(
pdu_session_status_e
::
PDU_SESSION_ACTIVE
);
// TODO: check 6.3.2.5 a,@3GPP TS 24.501 V16.1.0 (2019-06)
return
;
}
Logger
::
smf_app
().
info
(
"Sending ITTI message %s to task TASK_SMF_APP to trigger response"
,
n11_msg
->
get_msg_name
());
int
ret
=
itti_inst
->
send_msg
(
n11_msg
);
if
(
RETURNok
!=
ret
)
{
Logger
::
smf_app
().
error
(
"Could not send ITTI message %s to task TASK_SMF_APP"
,
n11_msg
->
get_msg_name
());
}
else
{
// Start timer T3591
sp
.
get
()
->
timer_T3591
=
itti_inst
->
timer_setup
(
T3591_TIMER_VALUE_SEC
,
0
,
TASK_SMF_APP
,
TASK_SMF_APP_TRIGGER_T3591
,
scid
);
}
return
;
}
return
;
}
//---------------------------------------------------------------------------------------------
void
smf_app
::
timer_t3592_timeout
(
timer_id_t
timer_id
,
scid_t
scid
)
{
// Re-send Session Release Command ...
// Get PDU Session
std
::
shared_ptr
<
smf_pdu_session
>
sp
=
{};
if
(
!
find_pdu_session
(
scid
,
sp
))
{
Logger
::
smf_app
().
warn
(
"Could not retrieve the corresponding SMF PDU Session context!"
);
return
;
}
std
::
shared_ptr
<
itti_n11_msg
>
pending_n11_msg
=
{};
sp
.
get
()
->
get_pending_n11_msg
(
pending_n11_msg
);
if
(
!
pending_n11_msg
)
{
Logger
::
smf_app
().
warn
(
"Could not retrieve the pending message!"
);
return
;
}
std
::
shared_ptr
<
itti_n11_update_sm_context_response
>
n11_msg
=
std
::
static_pointer_cast
<
itti_n11_update_sm_context_response
>
(
pending_n11_msg
);
if
(
n11_msg
)
{
uint8_t
number_retransmission
=
sp
.
get
()
->
get_number_retransmission_T3592
();
if
(
number_retransmission
<=
NUMBER_RETRANSMISSION_TIMES_T3592
)
{
sp
.
get
()
->
set_number_retransmission_T3592
(
number_retransmission
+
1
);
}
else
{
// Update PDU Session status -> INACTIVE - to be verified
sp
.
get
()
->
set_pdu_session_status
(
pdu_session_status_e
::
PDU_SESSION_INACTIVE
);
return
;
}
Logger
::
smf_app
().
info
(
"Sending ITTI message %s to task TASK_SMF_APP to trigger response"
,
n11_msg
->
get_msg_name
());
int
ret
=
itti_inst
->
send_msg
(
n11_msg
);
if
(
RETURNok
!=
ret
)
{
Logger
::
smf_app
().
error
(
"Could not send ITTI message %s to task TASK_SMF_APP"
,
n11_msg
->
get_msg_name
());
}
else
{
// Start timer T3591
sp
.
get
()
->
timer_T3592
=
itti_inst
->
timer_setup
(
T3592_TIMER_VALUE_SEC
,
0
,
TASK_SMF_APP
,
TASK_SMF_APP_TRIGGER_T3592
,
scid
);
}
return
;
}
return
;
}
//---------------------------------------------------------------------------------------------
...
...
src/smf_app/smf_app.hpp
View file @
11614b91
...
...
@@ -483,6 +483,15 @@ class smf_app {
*/
std
::
shared_ptr
<
smf_context
>
supi_2_smf_context
(
const
supi64_t
&
supi
)
const
;
/*
* Find the PDU Session with its SCID
* @param [const scid_t &] scid: SMF Context ID
* @param [std::shared_ptr<smf_pdu_session> &] sp: pointer to the PDU session
* @return bool: return true if found, otherwise return false
*/
bool
find_pdu_session
(
const
scid_t
&
scid
,
std
::
shared_ptr
<
smf_pdu_session
>&
sp
)
const
;
/*
* Handle PDUSession_CreateSMContextRequest from AMF
* @param [std::shared_ptr<itti_n11_create_sm_context_request>&] Request
...
...
@@ -615,10 +624,18 @@ class smf_app {
/*
* will be executed when timer T3591 expires
* @param [timer_id_t] timer_id
* @param [uint64_t] arg2_user
* @param [scid_t] scid
* @return void
*/
void
timer_t3591_timeout
(
timer_id_t
timer_id
,
scid_t
scid
);
/*
* will be executed when timer T3592 expires
* @param [timer_id_t] timer_id
* @param [scid_t] scid
* @return void
*/
void
timer_t359
1_timeout
(
timer_id_t
timer_id
,
uint64_t
arg2_user
);
void
timer_t359
2_timeout
(
timer_id_t
timer_id
,
scid_t
scid
);
/*
* will be executed when NRF Heartbeat timer expires
...
...
src/smf_app/smf_context.cpp
View file @
11614b91
...
...
@@ -657,6 +657,48 @@ void smf_pdu_session::set_snssai(const snssai_t s) {
snssai
=
s
;
}
//------------------------------------------------------------------------------
void
smf_pdu_session
::
set_pending_n11_msg
(
const
std
::
shared_ptr
<
itti_n11_msg
>&
msg
)
{
pending_n11_msg
=
msg
;
}
//------------------------------------------------------------------------------
void
smf_pdu_session
::
get_pending_n11_msg
(
std
::
shared_ptr
<
itti_n11_msg
>&
msg
)
const
{
msg
=
pending_n11_msg
;
}
//------------------------------------------------------------------------------
void
smf_pdu_session
::
set_number_retransmission_T3591
(
const
uint8_t
&
n
)
{
number_retransmission_T3591
=
n
;
}
//------------------------------------------------------------------------------
void
smf_pdu_session
::
get_number_retransmission_T3591
(
uint8_t
&
n
)
const
{
n
=
number_retransmission_T3591
;
}
//------------------------------------------------------------------------------
uint8_t
smf_pdu_session
::
get_number_retransmission_T3591
()
const
{
return
number_retransmission_T3591
;
}
//------------------------------------------------------------------------------
void
smf_pdu_session
::
set_number_retransmission_T3592
(
const
uint8_t
&
n
)
{
number_retransmission_T3592
=
n
;
}
//------------------------------------------------------------------------------
void
smf_pdu_session
::
get_number_retransmission_T3592
(
uint8_t
&
n
)
const
{
n
=
number_retransmission_T3592
;
}
//------------------------------------------------------------------------------
uint8_t
smf_pdu_session
::
get_number_retransmission_T3592
()
const
{
return
number_retransmission_T3592
;
}
//------------------------------------------------------------------------------
void
session_management_subscription
::
insert_dnn_configuration
(
const
std
::
string
&
dnn
,
...
...
@@ -1792,11 +1834,24 @@ bool smf_context::handle_pdu_session_modification_request(
// Update PDU Session status
sp
.
get
()
->
set_pdu_session_status
(
pdu_session_status_e
::
PDU_SESSION_MODIFICATION_PENDING
);
scid_t
scid
=
{};
try
{
scid
=
std
::
stoi
(
sm_context_request
.
get
()
->
scid
);
}
catch
(
const
std
::
exception
&
err
)
{
Logger
::
smf_app
().
warn
(
"Couldn't retrieve "
"the corresponding SMF context, ignore message!"
);
return
false
;
}
// Store the context for the timer handling
sp
.
get
()
->
set_pending_n11_msg
(
std
::
dynamic_pointer_cast
<
itti_n11_msg
>
(
sm_context_resp
));
// start timer T3591
// get smf_pdu_session and set the corresponding timer
sp
.
get
()
->
timer_T3591
=
itti_inst
->
timer_setup
(
T3591_TIMER_VALUE_SEC
,
0
,
TASK_SMF_APP
,
TASK_SMF_APP_TRIGGER_T3591
,
sm_context_request
.
get
()
->
req
.
get_pdu_session_id
());
T3591_TIMER_VALUE_SEC
,
0
,
TASK_SMF_APP
,
TASK_SMF_APP_TRIGGER_T3591
,
scid
);
free_wrapper
((
void
**
)
&
nas_msg
.
plain
.
sm
.
pdu_session_modification_request
.
qosflowdescriptions
.
qosflowdescriptionscontents
);
...
...
src/smf_app/smf_context.hpp
View file @
11614b91
...
...
@@ -135,6 +135,8 @@ class smf_pdu_session : public std::enable_shared_from_this<smf_pdu_session> {
timer_T3592
=
ITTI_INVALID_TIMER_ID
;
number_of_supported_packet_filters
=
0
;
maximum_number_of_supported_packet_filters
=
0
;
number_retransmission_T3591
=
0
;
number_retransmission_T3592
=
0
;
}
void
clear
()
{
...
...
@@ -150,13 +152,15 @@ class smf_pdu_session : public std::enable_shared_from_this<smf_pdu_session> {
seid
=
0
;
up_fseid
=
{};
qos_flows
.
clear
();
default_qfi
.
qfi
=
NO_QOS_FLOW_IDENTIFIER_ASSIGNED
;
pdu_session_status
=
pdu_session_status_e
::
PDU_SESSION_INACTIVE
;
upCnx_state
=
upCnx_state_e
::
UPCNX_STATE_DEACTIVATED
;
ho_state
=
ho_state_e
::
HO_STATE_NONE
;
timer_T3590
=
ITTI_INVALID_TIMER_ID
;
timer_T3591
=
ITTI_INVALID_TIMER_ID
;
timer_T3592
=
ITTI_INVALID_TIMER_ID
;
default_qfi
.
qfi
=
NO_QOS_FLOW_IDENTIFIER_ASSIGNED
;
pdu_session_status
=
pdu_session_status_e
::
PDU_SESSION_INACTIVE
;
upCnx_state
=
upCnx_state_e
::
UPCNX_STATE_DEACTIVATED
;
ho_state
=
ho_state_e
::
HO_STATE_NONE
;
timer_T3590
=
ITTI_INVALID_TIMER_ID
;
timer_T3591
=
ITTI_INVALID_TIMER_ID
;
timer_T3592
=
ITTI_INVALID_TIMER_ID
;
number_retransmission_T3591
=
0
;
number_retransmission_T3592
=
0
;
}
smf_pdu_session
(
smf_pdu_session
&
b
)
=
delete
;
...
...
@@ -493,6 +497,16 @@ class smf_pdu_session : public std::enable_shared_from_this<smf_pdu_session> {
*/
void
set_snssai
(
const
snssai_t
s
);
void
set_pending_n11_msg
(
const
std
::
shared_ptr
<
itti_n11_msg
>&
msg
);
void
get_pending_n11_msg
(
std
::
shared_ptr
<
itti_n11_msg
>&
msg
)
const
;
void
set_number_retransmission_T3591
(
const
uint8_t
&
n
);
void
get_number_retransmission_T3591
(
uint8_t
&
n
)
const
;
uint8_t
get_number_retransmission_T3591
()
const
;
void
set_number_retransmission_T3592
(
const
uint8_t
&
n
);
void
get_number_retransmission_T3592
(
uint8_t
&
n
)
const
;
uint8_t
get_number_retransmission_T3592
()
const
;
public:
bool
ipv4
;
// IPv4 Addr
struct
in_addr
ipv4_address
;
// IPv4 Addr
...
...
@@ -541,6 +555,11 @@ class smf_pdu_session : public std::enable_shared_from_this<smf_pdu_session> {
// Shared lock
mutable
std
::
shared_mutex
m_pdu_session_mutex
;
private:
std
::
shared_ptr
<
itti_n11_msg
>
pending_n11_msg
;
uint8_t
number_retransmission_T3591
;
uint8_t
number_retransmission_T3592
;
};
class
session_management_subscription
{
...
...
src/smf_app/smf_procedure.cpp
View file @
11614b91
...
...
@@ -1334,12 +1334,25 @@ void session_update_sm_context_procedure::handle_itti_msg(
// TODO: To be completed
// TODO: start timer T3592 (see Section 6.3.3@3GPP TS 24.501)
// get smf_pdu_session and set the corresponding timer
sps
->
timer_T3592
=
itti_inst
->
timer_setup
(
T3591_TIMER_VALUE_SEC
,
0
,
TASK_SMF_APP
,
TASK_SMF_APP_TRIGGER_T3592
,
n11_trigger
->
req
.
get_pdu_session_id
());
// TODO: How SMF can retransmit the PDU SESSION RELEASE COMMAND message on
// the expiry of the timer T3592
scid_t
scid
=
{};
try
{
scid
=
(
scid_t
)
std
::
stoul
(
n11_trigger
.
get
()
->
scid
,
nullptr
,
10
);
}
catch
(
const
std
::
exception
&
e
)
{
Logger
::
smf_n1
().
warn
(
"Error when converting from string to int for SCID, "
"error: %s"
,
e
.
what
());
return
;
}
// Store the context for the timer handling
sps
.
get
()
->
set_pending_n11_msg
(
std
::
dynamic_pointer_cast
<
itti_n11_msg
>
(
n11_triggered_pending
));
sps
->
timer_T3592
=
itti_inst
->
timer_setup
(
T3592_TIMER_VALUE_SEC
,
0
,
TASK_SMF_APP
,
TASK_SMF_APP_TRIGGER_T3592
,
scid
);
}
break
;
...
...
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