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
236c2eb1
Commit
236c2eb1
authored
Jul 28, 2022
by
Tien Thinh NGUYEN
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Trigger PDU session release procedure
parent
330fc086
Changes
5
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
134 additions
and
26 deletions
+134
-26
src/amf-app/amf_n1.cpp
src/amf-app/amf_n1.cpp
+3
-2
src/amf-app/amf_n2.cpp
src/amf-app/amf_n2.cpp
+92
-1
src/amf-app/amf_sbi.cpp
src/amf-app/amf_sbi.cpp
+22
-3
src/itti/msgs/itti_msg_sbi.hpp
src/itti/msgs/itti_msg_sbi.hpp
+17
-19
src/ngap/ngapMsgs/UEContextReleaseComplete.hpp
src/ngap/ngapMsgs/UEContextReleaseComplete.hpp
+0
-1
No files found.
src/amf-app/amf_n1.cpp
View file @
236c2eb1
...
...
@@ -2982,7 +2982,8 @@ void amf_n1::ue_initiate_de_registration_handle(
if
(
uc
.
get
()
!=
nullptr
)
{
if
(
uc
->
get_pdu_sessions_context
(
sessions_ctx
))
{
// Send Nsmf_PDUSession_ReleaseSMContext to SMF to release the PDU session
// Send Nsmf_PDUSession_ReleaseSMContext to SMF to release all existing
// PDU sessions
std
::
map
<
uint32_t
,
boost
::
shared_future
<
uint32_t
>>
smf_responses
;
for
(
auto
session
:
sessions_ctx
)
{
...
...
@@ -3043,7 +3044,7 @@ void amf_n1::ue_initiate_de_registration_handle(
Logger
::
amf_n1
().
debug
(
"De-registration Type 0x%x"
,
deregType
);
// If UE switch-off, don't need to send Deregistration Accept
if
((
deregType
&
0b00001000
)
==
0
)
{
if
((
deregType
&
DEREGISTRATION_TYPE_MASK
)
==
0
)
{
// Prepare DeregistrationAccept
auto
dereg_accept
=
std
::
make_unique
<
DeregistrationAccept
>
();
dereg_accept
->
setHeader
(
PLAIN_5GS_MSG
);
...
...
src/amf-app/amf_n2.cpp
View file @
236c2eb1
...
...
@@ -1378,13 +1378,104 @@ void amf_n2::handle_itti_message(itti_ue_context_release_complete& itti_msg) {
amf_n1_inst
->
set_mobile_reachable_timer
(
nc
,
tid
);
amf_n1_inst
->
set_mobile_reachable_timer_timeout
(
nc
,
false
);
}
else
{
return
;
}
// TODO: User Location Information IE
// TODO: Information on Recommended Cells & RAN Nodes for Paging IE
// TODO: Process Secondary RAT Usage Information IE if available
// send Nsmf_PDUSession_UpdateSMContext to SMF
// Get PDU Sessions in UE Context Release Complete and send
// Nsmf_PDUSession_UpdateSMContext to SMF
std
::
vector
<
PDUSessionResourceCxtRelCplItem_t
>
pdu_sessions_to_be_released
;
itti_msg
.
ueCtxRelCmpl
->
getPduSessionResourceCxtRelCplList
(
pdu_sessions_to_be_released
);
// TODO: may consider releasing all exisiting PDU sessions
/*
if (pdu_sessions_to_be_released.size() == 0) {
string supi = "imsi-" + nc.get()->imsi;
std::vector<std::shared_ptr<pdu_session_context>> sessions_ctx;
if (!amf_app_inst->get_pdu_sessions_context(supi, sessions_ctx)) {
Logger::amf_n2().debug("No PDU Session Context found");
return;
} else {
for (auto pdu_session : sessions_ctx) {
PDUSessionResourceCxtRelCplItem_t item = {};
item.pduSessionId = pdu_session.get()->pdu_session_id;
pdu_sessions_to_be_released.push_back(item);
}
}
}
*/
// Send PDUSessionUpdateSMContextRequest to SMF for each PDU session
std
::
map
<
uint32_t
,
boost
::
shared_future
<
std
::
string
>>
curl_responses
;
for
(
auto
pdu_session
:
pdu_sessions_to_be_released
)
{
// Generate a promise and associate this promise to the curl handle
uint32_t
promise_id
=
amf_app_inst
->
generate_promise_id
();
Logger
::
amf_n2
().
debug
(
"Promise ID generated %d"
,
promise_id
);
boost
::
shared_ptr
<
boost
::
promise
<
std
::
string
>>
p
=
boost
::
make_shared
<
boost
::
promise
<
std
::
string
>>
();
boost
::
shared_future
<
std
::
string
>
f
=
p
->
get_future
();
amf_app_inst
->
add_promise
(
promise_id
,
p
);
curl_responses
.
emplace
(
pdu_session
.
pduSessionId
,
f
);
Logger
::
amf_n2
().
debug
(
"Sending ITTI to trigger PDUSessionUpdateSMContextRequest to SMF to "
"task TASK_AMF_SBI"
);
std
::
shared_ptr
<
itti_nsmf_pdusession_update_sm_context
>
itti_n11_msg
=
std
::
make_shared
<
itti_nsmf_pdusession_update_sm_context
>
(
TASK_NGAP
,
TASK_AMF_SBI
);
itti_n11_msg
->
pdu_session_id
=
pdu_session
.
pduSessionId
;
// TODO:
itti_n11_msg
->
is_n2sm_set
=
false
;
itti_n11_msg
->
amf_ue_ngap_id
=
amf_ue_ngap_id
;
itti_n11_msg
->
ran_ue_ngap_id
=
ran_ue_ngap_id
;
itti_n11_msg
->
promise_id
=
promise_id
;
itti_n11_msg
->
up_cnx_state
=
"DEACTIVATED"
;
int
ret
=
itti_inst
->
send_msg
(
itti_n11_msg
);
if
(
0
!=
ret
)
{
Logger
::
ngap
().
error
(
"Could not send ITTI message %s to task TASK_AMF_SBI"
,
itti_n11_msg
->
get_msg_name
());
}
}
bool
result
=
true
;
while
(
!
curl_responses
.
empty
())
{
boost
::
future_status
status
;
// wait for timeout or ready
status
=
curl_responses
.
begin
()
->
second
.
wait_for
(
boost
::
chrono
::
milliseconds
(
FUTURE_STATUS_TIMEOUT_MS
));
if
(
status
==
boost
::
future_status
::
ready
)
{
assert
(
curl_responses
.
begin
()
->
second
.
is_ready
());
assert
(
curl_responses
.
begin
()
->
second
.
has_value
());
assert
(
!
curl_responses
.
begin
()
->
second
.
has_exception
());
// Wait for the result from APP and send reply to AMF
std
::
string
pdu_session_id_str
=
curl_responses
.
begin
()
->
second
.
get
();
Logger
::
ngap
().
debug
(
"Got result for PDU Session ID %d"
,
curl_responses
.
begin
()
->
first
);
if
(
pdu_session_id_str
.
size
()
>
0
)
{
result
=
result
&&
true
;
}
else
{
result
=
false
;
}
}
else
{
result
=
true
;
}
curl_responses
.
erase
(
curl_responses
.
begin
());
}
}
//------------------------------------------------------------------------------
...
...
src/amf-app/amf_sbi.cpp
View file @
236c2eb1
...
...
@@ -287,6 +287,11 @@ void amf_sbi::handle_itti_message(
pdu_session_update_request
[
"hoState"
]
=
"COMPLETED"
;
}
// For Deactivation of User Plane connectivity
if
(
itti_msg
.
up_cnx_state
.
compare
(
"DEACTIVATED"
)
==
0
)
{
pdu_session_update_request
[
"upCnxState"
]
=
"DEACTIVATED"
;
}
std
::
string
json_part
=
pdu_session_update_request
.
dump
();
uint8_t
http_version
=
1
;
...
...
@@ -1244,9 +1249,11 @@ void amf_sbi::curl_http_client(
return
;
}
// For N2 HO
bool
is_ho_procedure
=
false
;
std
::
string
promise_result
=
{};
bool
is_ho_procedure
=
false
;
bool
is_up_deactivation_procedure
=
false
;
// For N2 HO
if
(
response_data
.
find
(
"hoState"
)
!=
response_data
.
end
())
{
is_ho_procedure
=
true
;
...
...
@@ -1259,8 +1266,20 @@ void amf_sbi::curl_http_client(
promise_result
=
n1sm
;
// actually, N2 SM Info
}
}
if
(
response_data
.
find
(
"upCnxState"
)
!=
response_data
.
end
())
{
std
::
string
up_cnx_state
=
{};
response_data
.
at
(
"upCnxState"
).
get_to
(
up_cnx_state
);
if
(
up_cnx_state
.
compare
(
"DEACTIVATED"
)
==
0
)
{
is_up_deactivation_procedure
=
true
;
if
(
response_data
.
find
(
"pduSessionId"
)
!=
response_data
.
end
())
response_data
.
at
(
"pduSessionId"
).
get_to
(
promise_result
);
}
}
// Notify to the result
if
((
promise_id
>
0
)
and
(
is_ho_procedure
))
{
if
((
promise_id
>
0
)
and
(
is_ho_procedure
or
is_up_deactivation_procedure
))
{
amf_app_inst
->
trigger_process_response
(
promise_id
,
promise_result
);
curl_slist_free_all
(
headers
);
curl_easy_cleanup
(
curl
);
...
...
src/itti/msgs/itti_msg_sbi.hpp
View file @
236c2eb1
...
...
@@ -44,7 +44,6 @@
// using namespace oai::amf::model;
using
namespace
amf_application
;
class
itti_msg_n11
:
public
itti_msg
{
public:
itti_msg_n11
(
...
...
@@ -99,17 +98,28 @@ class itti_nsmf_pdusession_update_sm_context : public itti_msg_n11 {
itti_nsmf_pdusession_update_sm_context
(
const
task_id_t
origin
,
const
task_id_t
destination
)
:
itti_msg_n11
(
NSMF_PDU_SESSION_UPDATE_SM_CTX
,
origin
,
destination
)
{
supi
=
{};
pdu_session_id
=
0
;
// n2sm = {};
is_n2sm_set
=
false
;
n2sm_info_type
=
{};
ran_ue_ngap_id
=
0
;
amf_ue_ngap_id
=
0
;
promise_id
=
0
;
ho_state
=
{};
up_cnx_state
=
{};
}
itti_nsmf_pdusession_update_sm_context
(
const
itti_nsmf_pdusession_update_sm_context
&
i
)
:
itti_msg_n11
(
i
)
{
supi
=
i
.
supi
;
pdu_session_id
=
i
.
pdu_session_id
;
n2sm
=
i
.
n2sm
;
is_n2sm_set
=
i
.
is_n2sm_set
;
n2sm_info_type
=
i
.
n2sm_info_type
;
promise_id
=
i
.
promise_id
;
ho_state
=
i
.
ho_state
;
up_cnx_state
=
i
.
up_cnx_state
;
}
public:
...
...
@@ -118,10 +128,11 @@ class itti_nsmf_pdusession_update_sm_context : public itti_msg_n11 {
bstring
n2sm
;
bool
is_n2sm_set
;
std
::
string
n2sm_info_type
;
uint32_t
ran_ue_ngap_id
;
long
amf_ue_ngap_id
;
//
uint32_t ran_ue_ngap_id;
//
long amf_ue_ngap_id;
uint32_t
promise_id
;
std
::
string
ho_state
;
std
::
string
up_cnx_state
;
};
class
itti_nsmf_pdusession_release_sm_context
:
public
itti_msg_n11
{
...
...
@@ -145,8 +156,6 @@ class itti_nsmf_pdusession_release_sm_context : public itti_msg_n11 {
std
::
string
context_location
;
};
class
itti_sbi_msg
:
public
itti_msg
{
public:
itti_sbi_msg
(
...
...
@@ -162,7 +171,6 @@ class itti_sbi_msg : public itti_msg {
}
};
//-----------------------------------------------------------------------------
class
itti_sbi_register_nf_instance_request
:
public
itti_sbi_msg
{
public:
...
...
@@ -282,7 +290,6 @@ class itti_sbi_nf_instance_discovery : public itti_sbi_msg {
uint32_t
promise_id
;
};
//-----------------------------------------------------------------------------
class
itti_sbi_n1_message_notify
:
public
itti_sbi_msg
{
public:
...
...
@@ -296,15 +303,6 @@ class itti_sbi_n1_message_notify : public itti_sbi_msg {
bstring
registration_request
;
};
//-----------------------------------------------------------------------------
class
itti_sbi_event_exposure_request
:
public
itti_sbi_msg
{
public:
...
...
src/ngap/ngapMsgs/UEContextReleaseComplete.hpp
View file @
236c2eb1
...
...
@@ -57,7 +57,6 @@ class UEContextReleaseCompleteMsg : public NgapUEMessage {
UserLocationInformation
*
userLocationInformation
;
// Optional
// TODO: Information on Recommended Cells and RAN Nodes for Paging (Optional)
PDUSessionResourceListCxtRelCpl
*
pduSessionResourceListCxtRelCpl
;
// Optional
// TODO: Criticality Diagnostics (Optional)
};
...
...
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