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
d432fdab
Commit
d432fdab
authored
Dec 15, 2020
by
Tien-Thinh Nguyen
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
code cleanup for smf context
parent
ccce0744
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
28 additions
and
92 deletions
+28
-92
src/smf_app/smf_app.cpp
src/smf_app/smf_app.cpp
+4
-38
src/smf_app/smf_context.cpp
src/smf_app/smf_context.cpp
+21
-52
src/smf_app/smf_procedure.cpp
src/smf_app/smf_procedure.cpp
+3
-2
No files found.
src/smf_app/smf_app.cpp
View file @
d432fdab
...
...
@@ -464,7 +464,6 @@ void smf_app::handle_itti_msg(
http_response_codes_e
::
HTTP_RESPONSE_CODE_OK
)
and
(
static_cast
<
http_response_codes_e
>
(
m
.
response_code
)
!=
http_response_codes_e
::
HTTP_RESPONSE_CODE_ACCEPTED
))
{
// send failure indication to UPF
Logger
::
smf_app
().
debug
(
"Send failure indication to UPF"
);
// TODO: to be completed
pfcp
::
node_id_t
up_node_id
=
{};
...
...
@@ -591,16 +590,13 @@ void smf_app::handle_pdu_session_create_sm_context_request(
return
;
}
//
Extended protocol discriminator (Mandatory)
//
Fill the mandatory IEs
smreq
->
req
.
set_epd
(
decoded_nas_msg
.
header
.
extended_protocol_discriminator
);
// PDUSessionIdentity
pdu_session_id_t
pdu_session_id
=
decoded_nas_msg
.
plain
.
sm
.
header
.
pdu_session_identity
;
// ProcedureTransactionIdentity
procedure_transaction_id_t
pti
=
{
.
procedure_transaction_id
=
decoded_nas_msg
.
plain
.
sm
.
header
.
procedure_transaction_identity
};
// Message type (Mandatory)
smreq
->
req
.
set_message_type
(
decoded_nas_msg
.
plain
.
sm
.
header
.
message_type
);
// TODO: Integrity protection maximum data rate (Mandatory)
...
...
@@ -739,8 +735,7 @@ void smf_app::handle_pdu_session_create_sm_context_request(
Logger
::
smf_app
().
warn
(
"Invalid request type (request type = %s)"
,
request_type
.
c_str
());
//"Existing PDU Session", AMF should use PDUSession_UpdateSMContext instead
//(see step 3, section 4.3.2.2.1 @ 3GPP TS 23.502 v16.0.0) ignore the
// message
//(see step 3, section 4.3.2.2.1 @ 3GPP TS 23.502 v16.0.0) ignore the message
return
;
}
...
...
@@ -754,8 +749,7 @@ void smf_app::handle_pdu_session_create_sm_context_request(
"Received a PDU Session Create SM Context Request: unknown requested "
"DNN %s, ignore message!"
,
dnn
.
c_str
());
// PDU Session Establishment Reject, 24.501 cause "#27 Missing or unknown
// DNN"
// PDU Session Establishment Reject
if
(
smf_n1
::
get_instance
().
create_n1_pdu_session_establishment_reject
(
smreq
->
req
,
n1_sm_message
,
cause_value_5gsm_e
::
CAUSE_27_MISSING_OR_UNKNOWN_DNN
))
{
...
...
@@ -846,8 +840,7 @@ void smf_app::handle_pdu_session_create_sm_context_request(
"Received a PDU Session Create SM Context Request, couldn't "
"retrieve the Session Management Subscription from UDM, ignore "
"message!"
);
// PDU Session Establishment Reject, with cause "29 User authentication
// or authorization failed"
// PDU Session Establishment Reject
if
(
smf_n1
::
get_instance
().
create_n1_pdu_session_establishment_reject
(
smreq
->
req
,
n1_sm_message
,
cause_value_5gsm_e
::
...
...
@@ -973,8 +966,6 @@ void smf_app::handle_pdu_session_update_sm_context_request(
if
(
!
sc
.
get
()
->
find_dnn_context
(
scf
.
get
()
->
nssai
,
scf
.
get
()
->
dnn
,
sd
))
{
if
(
nullptr
==
sd
.
get
())
{
// Error, DNN context doesn't exist, send PDUSession_SMUpdateContext
// Response to AMF
Logger
::
smf_app
().
warn
(
"Received PDU Session Update SM Context Request, couldn't retrieve "
"the corresponding SMF context, ignore message!"
);
...
...
@@ -982,7 +973,6 @@ void smf_app::handle_pdu_session_update_sm_context_request(
trigger_update_context_error_response
(
http_status_code_e
::
HTTP_STATUS_CODE_404_NOT_FOUND
,
PDU_SESSION_APPLICATION_ERROR_CONTEXT_NOT_FOUND
,
smreq
->
pid
);
return
;
}
}
...
...
@@ -1094,20 +1084,6 @@ void smf_app::trigger_pdu_session_modification(
itti_msg
->
http_version
=
http_version
;
// step 1. collect the necessary information
/*
//For testing purpose
supi_t supi = { };
std::string dnn("default");
pdu_session_id_t pdu_session_id = { 1 };
snssai_t snssai = { };
pfcp::qfi_t qfi = { };
qfi.qfi = 7;
std::string supi_str("200000000000001");
smf_string_to_supi(&supi, supi_str.c_str());
snssai.sST = 222;
snssai.sD = "0000D4";
*/
itti_msg
->
msg
.
set_supi
(
supi
);
itti_msg
->
msg
.
set_dnn
(
dnn
);
itti_msg
->
msg
.
set_pdu_session_id
(
pdu_session_id
);
...
...
@@ -1143,7 +1119,6 @@ evsub_id_t smf_app::handle_event_exposure_subscription(
// Generate a subscription ID Id and store the corresponding information in a
// map (subscription id, info)
evsub_id_t
evsub_id
=
generate_ev_subscription_id
();
// std::string evsubid_str = "SubId" + std::to_string(evsub_id);
std
::
shared_ptr
<
smf_subscription
>
ss
=
std
::
shared_ptr
<
smf_subscription
>
(
new
smf_subscription
());
...
...
@@ -1230,13 +1205,6 @@ bool smf_app::scid_2_smf_context(const scid_t &scid,
return
false
;
}
//------------------------------------------------------------------------------
// void smf_app::set_evsubid_2_smf_subscription(const evsub_id_t &id,
// std::shared_ptr<smf_subscription> ss) {
// std::unique_lock lock(m_evsubid2smf_context);
// evsub_id2smf_subscription[id] = ss;
//}
//------------------------------------------------------------------------------
bool
smf_app
::
use_local_configuration_subscription_data
(
const
std
::
string
&
dnn_selection_mode
)
{
...
...
@@ -1324,7 +1292,6 @@ void smf_app::update_pdu_session_status(const scid_t &scid,
if
(
!
sc
.
get
()
->
find_dnn_context
(
scf
.
get
()
->
nssai
,
scf
.
get
()
->
dnn
,
sd
))
{
if
(
nullptr
==
sd
.
get
())
{
// Error, DNN context doesn't exist
Logger
::
smf_app
().
warn
(
"Could not retrieve the corresponding DNN context!"
);
}
...
...
@@ -1381,7 +1348,6 @@ void smf_app::update_pdu_session_upCnx_state(const scid_t &scid,
if
(
!
sc
.
get
()
->
find_dnn_context
(
scf
.
get
()
->
nssai
,
scf
.
get
()
->
dnn
,
sd
))
{
if
(
nullptr
==
sd
.
get
())
{
// Error, DNN context doesn't exist
Logger
::
smf_app
().
warn
(
"Could not retrieve the corresponding DNN context!"
);
}
...
...
src/smf_app/smf_context.cpp
View file @
d432fdab
...
...
@@ -707,20 +707,7 @@ void smf_context::handle_itti_msg(
std
::
shared_ptr
<
dnn_context
>
sd
=
{};
std
::
shared_ptr
<
smf_pdu_session
>
sp
=
{};
pfcp
::
qfi_t
qfi
=
{};
if
(
find_pdu_session
(
pdr_id
,
qfi
,
sd
,
sp
))
{
/*
downlink_data_report_procedure *proc =
new downlink_data_report_procedure(shared_from_this(), sp);
std::shared_ptr<smf_procedure> sproc =
std::shared_ptr<smf_procedure>(proc);
insert_procedure(sproc);
if (proc->run(pdr_id, qfi)) {
// error !
Logger::smf_app().info(
"Downlink Data Report Request procedure failed");
remove_procedure(proc);
}
*/
if
(
find_pdu_session
(
pdr_id
,
qfi
,
sd
,
sp
))
{
// Step 1. send N4 Data Report Ack to UPF
pfcp
::
node_id_t
up_node_id
=
{};
if
(
not
pfcp_associations
::
get_instance
().
select_up_node
(
...
...
@@ -752,13 +739,11 @@ void smf_context::handle_itti_msg(
// Step 2. Send N1N2MessageTranfer to AMF
pdu_session_report_response
session_report_msg
=
{};
// set the required IEs
session_report_msg
.
set_supi
(
supi
);
// supi
session_report_msg
.
set_snssai
(
sd
.
get
()
->
nssai
);
// s-nssai
session_report_msg
.
set_dnn
(
sd
.
get
()
->
dnn_in_use
);
// dnn
session_report_msg
.
set_supi
(
supi
);
session_report_msg
.
set_snssai
(
sd
.
get
()
->
nssai
);
session_report_msg
.
set_dnn
(
sd
.
get
()
->
dnn_in_use
);
session_report_msg
.
set_pdu_session_type
(
sp
.
get
()
->
get_pdu_session_type
()
.
pdu_session_type
);
// pdu session type
sp
.
get
()
->
get_pdu_session_type
().
pdu_session_type
);
// get supi and put into URL
std
::
string
supi_prefix
=
{};
get_supi_prefix
(
supi_prefix
);
...
...
@@ -817,8 +802,7 @@ void smf_context::handle_itti_msg(
itti_n11_session_report_request
*
itti_n11
=
new
itti_n11_session_report_request
(
TASK_SMF_APP
,
TASK_SMF_N11
);
// use HTTPv1 for the moment
itti_n11
->
http_version
=
1
;
itti_n11
->
http_version
=
1
;
// use HTTPv1 for the moment
std
::
shared_ptr
<
itti_n11_session_report_request
>
itti_n11_report
=
std
::
shared_ptr
<
itti_n11_session_report_request
>
(
itti_n11
);
itti_n11_report
->
res
=
session_report_msg
;
...
...
@@ -1213,7 +1197,6 @@ void smf_context::handle_pdu_session_create_sm_context_request(
// Step 2. check the validity of the UE request, if valid send PDU Session
// Accept, otherwise send PDU Session Reject to AMF
if
(
!
verify_sm_context_request
(
smreq
))
{
// Not a valid request...
Logger
::
smf_app
().
warn
(
"Received a PDU Session Create SM Context Request, the request is not "
"valid!"
);
...
...
@@ -1249,7 +1232,7 @@ void smf_context::handle_pdu_session_create_sm_context_request(
sm_context_resp
->
http_version
=
smreq
->
http_version
;
sm_context_resp
->
res
.
set_http_code
(
http_status_code_e
::
HTTP_STATUS_CODE_200_OK
);
// default status code
http_status_code_e
::
HTTP_STATUS_CODE_200_OK
);
sm_context_resp
->
res
.
set_supi
(
supi
);
sm_context_resp
->
res
.
set_supi_prefix
(
smreq
->
req
.
get_supi_prefix
());
sm_context_resp
->
res
.
set_cause
(
REQUEST_ACCEPTED
);
...
...
@@ -1335,8 +1318,8 @@ void smf_context::handle_pdu_session_create_sm_context_request(
Logger
::
smf_app
().
debug
(
"UE Address Allocation"
);
switch
(
sp
->
pdu_session_type
.
pdu_session_type
)
{
case
PDU_SESSION_TYPE_E_IPV4
:
{
if
(
!
pco_ids
.
ci_ipv4_address_allocation_via_dhcpv4
)
{
// use SM NAS
//
signalling
if
(
!
pco_ids
.
ci_ipv4_address_allocation_via_dhcpv4
)
{
// use SM NAS
signalling
// static or dynamic address allocation
bool
paa_res
=
false
;
// how to define static or dynamic
// depend of subscription information: staticIpAddress in DNN
...
...
@@ -1400,7 +1383,6 @@ void smf_context::handle_pdu_session_create_sm_context_request(
http_status_code_e
::
HTTP_STATUS_CODE_403_FORBIDDEN
,
PDU_SESSION_APPLICATION_ERROR_PDUTYPE_DENIED
,
n1_sm_msg_hex
,
smreq
->
pid
);
}
else
{
smf_app_inst
->
trigger_http_response
(
http_status_code_e
::
HTTP_STATUS_CODE_500_INTERNAL_SERVER_ERROR
,
...
...
@@ -1416,8 +1398,7 @@ void smf_context::handle_pdu_session_create_sm_context_request(
// if request is accepted
if
(
request_accepted
)
{
if
(
set_paa
)
{
sm_context_resp_pending
->
res
.
set_paa
(
paa
);
// will be used when procedure is running
sm_context_resp_pending
->
res
.
set_paa
(
paa
);
sp
->
set
(
paa
);
}
else
{
// TODO:
...
...
@@ -1445,8 +1426,6 @@ void smf_context::handle_pdu_session_create_sm_context_request(
TASK_SMF_N11
,
TASK_SMF_APP
,
smreq
->
pid
);
pdu_session_create_sm_context_response
sm_context_response
=
{};
// Cause, SM Context ID, location header contains the URI of the created
// resource
std
::
string
smContextRef
=
std
::
to_string
(
smreq
->
scid
);
// headers: Location: contains the URI of the newly created resource,
// according to the structure:
...
...
@@ -1558,11 +1537,9 @@ void smf_context::handle_pdu_session_create_sm_context_request(
N1_SM_CONTENT_ID
;
json_data
[
"pduSessionId"
]
=
sm_context_resp_pending
->
res
.
get_pdu_session_id
();
sm_context_resp_pending
->
res
.
set_json_data
(
json_data
);
// send ITTI message to N11 interface to trigger N1N2MessageTransfer towards
// AMFs
// send ITTI message to N11 to trigger N1N2MessageTransfer towards AMFs
Logger
::
smf_app
().
info
(
"Sending ITTI message %s to task TASK_SMF_N11"
,
sm_context_resp_pending
->
get_msg_name
());
int
ret
=
itti_inst
->
send_msg
(
sm_context_resp_pending
);
...
...
@@ -1705,20 +1682,13 @@ void smf_context::handle_pdu_session_update_sm_context_request(
n11_sm_context_resp
->
res
.
set_pti
(
pti
);
// Message Type
// TODO: _5GSMCapability _5gsmcapability =
// decoded_nas_msg.plain.sm.pdu_session_modification_request._5gsmcapability;
//
// TODO: _5GSMCapability
// TODO: Cause
// TODO: uint8_t maximum_number_of_supported_packet_filters =
// decoded_nas_msg.plain.sm.pdu_session_modification_request.maximumnumberofsupportedpacketfilters;
// sp.get()->set_number_of_supported_packet_filters(maximum_number_of_supported_packet_filters);
// TODO: maximum_number_of_supported_packet_filters
// TODO: AlwaysonPDUSessionRequested
// TODO: IntergrityProtectionMaximumDataRate
// Process QoS rules and Qos Flow descriptions
update_qos_info
(
sp
,
sm_context_resp_pending
->
res
,
decoded_nas_msg
);
/* TODO: REMOVED
uint16_t length_of_rule_ie =
...
...
@@ -1898,8 +1868,7 @@ void smf_context::handle_pdu_session_update_sm_context_request(
if
(
not
smf_n1
::
get_instance
()
.
create_n1_pdu_session_modification_command
(
n11_sm_context_resp
->
res
,
n1_sm_msg_to_be_created
,
cause_value_5gsm_e
::
CAUSE_0_UNKNOWN
)
or
// TODO: need
// cause?
cause_value_5gsm_e
::
CAUSE_0_UNKNOWN
)
or
// N2 SM (PDU Session Resource Modify Request Transfer IE)
not
smf_n2
::
get_instance
()
.
create_n2_pdu_session_resource_modify_request_transfer
(
...
...
@@ -1910,7 +1879,7 @@ void smf_context::handle_pdu_session_update_sm_context_request(
http_status_code_e
::
HTTP_STATUS_CODE_500_INTERNAL_SERVER_ERROR
,
smreq
->
pid
,
N11_SESSION_UPDATE_SM_CONTEXT_RESPONSE
);
free_wrapper
((
void
**
)
&
qos_flow_description
);
//
free_wrapper((void **)&qos_flow_description);
free_wrapper
((
void
**
)
&
decoded_nas_msg
.
plain
.
sm
.
pdu_session_modification_request
.
qosflowdescriptions
.
qosflowdescriptionscontents
);
...
...
@@ -1932,12 +1901,12 @@ void smf_context::handle_pdu_session_update_sm_context_request(
// N1SM
json_data
[
"n1MessageContainer"
][
"n1MessageClass"
]
=
N1N2_MESSAGE_CLASS
;
json_data
[
"n1MessageContainer"
][
"n1MessageContent"
][
"contentId"
]
=
N1_SM_CONTENT_ID
;
// part 2
N1_SM_CONTENT_ID
;
json_data
[
"n2InfoContainer"
][
"n2InformationClass"
]
=
N1N2_MESSAGE_CLASS
;
json_data
[
"n2InfoContainer"
][
"smInfo"
][
"n2InfoContent"
][
"ngapIeType"
]
=
"PDU_RES_MOD_REQ"
;
// NGAP message
json_data
[
"n2InfoContainer"
][
"smInfo"
][
"n2InfoContent"
][
"ngapData"
]
[
"contentId"
]
=
N2_SM_CONTENT_ID
;
// part 3
[
"contentId"
]
=
N2_SM_CONTENT_ID
;
json_data
[
"n2InfoContainer"
][
"smInfo"
][
"PduSessionId"
]
=
n11_sm_context_resp
->
res
.
get_pdu_session_id
();
...
...
@@ -1954,7 +1923,7 @@ void smf_context::handle_pdu_session_update_sm_context_request(
sm_context_resp_pending
->
session_procedure_type
=
procedure_type
;
// don't need to create a procedure to update UPF
free_wrapper
((
void
**
)
&
qos_flow_description
);
//
free_wrapper((void **)&qos_flow_description);
free_wrapper
(
(
void
**
)
&
decoded_nas_msg
.
plain
.
sm
.
pdu_session_modification_request
.
qosflowdescriptions
.
qosflowdescriptionscontents
);
...
...
src/smf_app/smf_procedure.cpp
View file @
d432fdab
...
...
@@ -33,6 +33,7 @@
#include "3gpp_29.244.h"
#include "3gpp_29.274.h"
#include "3gpp_29.500.h"
#include "3gpp_29.502.h"
#include "3gpp_conversions.hpp"
#include "SmContextCreatedData.h"
#include "common_defs.h"
...
...
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