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
61ae53a0
Commit
61ae53a0
authored
Aug 13, 2021
by
Tien-Thinh Nguyen
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Avoid raw pointer
parent
515cdc7e
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
232 additions
and
148 deletions
+232
-148
src/smf_app/smf_app.cpp
src/smf_app/smf_app.cpp
+22
-16
src/smf_app/smf_context.cpp
src/smf_app/smf_context.cpp
+73
-55
src/smf_app/smf_n4.cpp
src/smf_app/smf_n4.cpp
+57
-25
src/smf_app/smf_procedure.cpp
src/smf_app/smf_procedure.cpp
+62
-41
src/smf_app/smf_sbi.cpp
src/smf_app/smf_sbi.cpp
+18
-11
No files found.
src/smf_app/smf_app.cpp
View file @
61ae53a0
...
...
@@ -587,24 +587,30 @@ void smf_app::handle_itti_msg(
return
;
}
itti_n4_session_failure_indication
*
itti_n4
=
new
itti_n4_session_failure_indication
(
TASK_SMF_APP
,
TASK_SMF_N4
);
itti_n4
->
seid
=
m
.
seid
;
itti_n4
->
trxn_id
=
m
.
trxn_id
;
itti_n4
->
r_endpoint
=
endpoint
(
up_node_id
.
u1
.
ipv4_address
,
pfcp
::
default_port
);
/*
itti_n4_session_failure_indication* itti_n4 =
new itti_n4_session_failure_indication(TASK_SMF_APP,
TASK_SMF_N4); itti_n4->seid = m.seid; itti_n4->trxn_id =
m.trxn_id; itti_n4->r_endpoint = endpoint(up_node_id.u1.ipv4_address,
pfcp::default_port);
*/
std
::
shared_ptr
<
itti_n4_session_failure_indication
>
itti_n4_failure_indication
=
std
::
shared_ptr
<
itti_n4_session_failure_indication
>
(
itti_n4
);
std
::
make_shared
<
itti_n4_session_failure_indication
>
(
TASK_SMF_APP
,
TASK_SMF_N4
);
itti_n4_failure_indication
->
seid
=
m
.
seid
;
itti_n4_failure_indication
->
trxn_id
=
m
.
trxn_id
;
itti_n4_failure_indication
->
r_endpoint
=
endpoint
(
up_node_id
.
u1
.
ipv4_address
,
pfcp
::
default_port
);
Logger
::
smf_app
().
info
(
"Sending ITTI message %s to task TASK_SMF_N4"
,
itti_n4
->
get_msg_name
());
itti_n4
_failure_indication
->
get_msg_name
());
int
ret
=
itti_inst
->
send_msg
(
itti_n4_failure_indication
);
if
(
RETURNok
!=
ret
)
{
Logger
::
smf_app
().
error
(
"Could not send ITTI message %s to task TASK_SMF_N4"
,
itti_n4
->
get_msg_name
());
itti_n4
_failure_indication
->
get_msg_name
());
return
;
}
}
...
...
@@ -864,7 +870,7 @@ void smf_app::handle_pdu_session_create_sm_context_request(
// authorization by the external DN
// Step 3. check if the DNN requested is valid
std
::
string
nd_dnn
;
std
::
string
nd_dnn
=
{}
;
util
::
dotted_to_string
(
dnn
,
nd_dnn
);
dnn
=
nd_dnn
;
// Update DNN
...
...
@@ -1027,7 +1033,7 @@ void smf_app::handle_pdu_session_update_sm_context_request(
"version %d)"
,
smreq
->
http_version
);
// Step 1. Get
supi, dnn, nssai, pdu_session id
from sm_context
// Step 1. Get
SUPI, DNN, NSSAI, PDU Session ID
from sm_context
// SM Context ID - uint32_t in our case
scid_t
scid
=
{};
try
{
...
...
@@ -1058,7 +1064,7 @@ void smf_app::handle_pdu_session_update_sm_context_request(
return
;
}
// Step 2. Store
supi, dnn, nssai
in itti_n11_update_sm_context_request to be
// Step 2. Store
SUPI, DNN, NSSAI
in itti_n11_update_sm_context_request to be
// processed later on
supi64_t
supi64
=
smf_supi_to_u64
(
scf
.
get
()
->
supi
);
smreq
->
req
.
set_supi
(
scf
.
get
()
->
supi
);
...
...
@@ -1110,7 +1116,7 @@ void smf_app::handle_pdu_session_update_sm_context_request(
scf
.
get
()
->
target_amf
=
smreq
.
get
()
->
req
.
get_target_serving_nf_id
();
}
// Step 7.
h
andle the message in smf_context
// Step 7.
H
andle the message in smf_context
if
(
!
sc
.
get
()
->
handle_pdu_session_update_sm_context_request
(
smreq
))
{
Logger
::
smf_app
().
warn
(
"Received PDU Session Update SM Context Request, couldn't process!"
);
...
...
@@ -1668,7 +1674,7 @@ bool smf_app::get_session_management_subscription_data(
const
supi64_t
&
supi
,
const
std
::
string
&
dnn
,
const
snssai_t
&
snssai
,
std
::
shared_ptr
<
session_management_subscription
>
subscription
)
{
Logger
::
smf_app
().
debug
(
"Get Session Management Subscription from configuration file"
);
"Get Session Management Subscription from
the
configuration file"
);
std
::
shared_ptr
<
dnn_configuration_t
>
dnn_configuration
=
std
::
make_shared
<
dnn_configuration_t
>
();
...
...
@@ -1703,7 +1709,7 @@ bool smf_app::get_session_management_subscription_data(
dnn_configuration
->
pdu_session_types
.
default_session_type
=
pdu_session_type
;
// S
sc
_Mode
// S
SC
_Mode
dnn_configuration
->
ssc_modes
.
default_ssc_mode
.
ssc_mode
=
smf_cfg
.
session_management_subscription
[
i
].
ssc_mode
;
...
...
@@ -1722,7 +1728,7 @@ bool smf_app::get_session_management_subscription_data(
dnn_configuration
->
_5g_qos_profile
.
priority_level
=
smf_cfg
.
session_management_subscription
[
i
].
default_qos
.
priority_level
;
//
s
ession_ambr
//
S
ession_ambr
dnn_configuration
->
session_ambr
.
uplink
=
smf_cfg
.
session_management_subscription
[
i
].
session_ambr
.
uplink
;
dnn_configuration
->
session_ambr
.
downlink
=
...
...
src/smf_app/smf_context.cpp
View file @
61ae53a0
...
...
@@ -770,22 +770,26 @@ void smf_context::handle_itti_msg(
pfcp
::
qfi_t
qfi
=
{};
if
(
find_pdu_session
(
pdr_id
,
qfi
,
sd
,
sp
))
{
// Step 1. send N4 Data Report Ack to UPF
itti_n4_session_report_response
*
n4_ser
=
new
itti_n4_session_report_response
(
TASK_SMF_APP
,
TASK_SMF_N4
);
n4_ser
->
seid
=
req
->
seid
;
n4_ser
->
trxn_id
=
req
->
trxn_id
;
n4_ser
->
r_endpoint
=
req
->
r_endpoint
;
/*
itti_n4_session_report_response* n4_ser =
new itti_n4_session_report_response(TASK_SMF_APP,
TASK_SMF_N4); n4_ser->seid = req->seid; n4_ser->trxn_id =
req->trxn_id; n4_ser->r_endpoint = req->r_endpoint
;
*/
std
::
shared_ptr
<
itti_n4_session_report_response
>
n4_report_ack
=
std
::
shared_ptr
<
itti_n4_session_report_response
>
(
n4_ser
);
std
::
make_shared
<
itti_n4_session_report_response
>
(
TASK_SMF_APP
,
TASK_SMF_N4
);
n4_report_ack
->
seid
=
req
->
seid
;
n4_report_ack
->
trxn_id
=
req
->
trxn_id
;
n4_report_ack
->
r_endpoint
=
req
->
r_endpoint
;
Logger
::
smf_app
().
info
(
"Sending ITTI message %s to task TASK_SMF_N4"
,
n4_
ser
->
get_msg_name
());
n4_
report_ack
->
get_msg_name
());
int
ret
=
itti_inst
->
send_msg
(
n4_report_ack
);
if
(
RETURNok
!=
ret
)
{
Logger
::
smf_app
().
error
(
"Could not send ITTI message %s to task TASK_SMF_N4"
,
n4_
ser
->
get_msg_name
());
n4_
report_ack
->
get_msg_name
());
return
;
}
...
...
@@ -855,12 +859,16 @@ void smf_context::handle_itti_msg(
session_report_msg
.
set_json_data
(
json_data
);
itti_n11_session_report_request
*
itti_n11
=
new
itti_n11_session_report_request
(
TASK_SMF_APP
,
TASK_SMF_SBI
);
itti_n11
->
http_version
=
1
;
// use HTTPv1 for the moment
// itti_n11_session_report_request* itti_n11 =
// new itti_n11_session_report_request(TASK_SMF_APP,
// TASK_SMF_SBI);
// 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
;
std
::
make_shared
<
itti_n11_session_report_request
>
(
TASK_SMF_APP
,
TASK_SMF_SBI
);
itti_n11_report
->
http_version
=
1
;
// use HTTPv1 for the moment
itti_n11_report
->
res
=
session_report_msg
;
// send ITTI message to N11 interface to trigger N1N2MessageTransfer
// towards AMFs
Logger
::
smf_app
().
info
(
...
...
@@ -1240,8 +1248,9 @@ void smf_context::handle_pdu_session_create_sm_context_request(
"version %d)"
,
smreq
->
http_version
);
std
::
string
n1_sm_message
,
n1_sm_msg_hex
;
bool
request_accepted
=
true
;
std
::
string
n1_sm_message
=
{};
std
::
string
n1_sm_msg_hex
=
{};
bool
request_accepted
=
true
;
// Step 1. Get necessary information
std
::
string
dnn
=
smreq
->
req
.
get_dnn
();
...
...
@@ -1278,11 +1287,13 @@ void smf_context::handle_pdu_session_create_sm_context_request(
// Store HttpResponse and session-related information to be used when
// receiving the response from UPF
itti_n11_create_sm_context_response
*
sm_context_resp
=
new
itti_n11_create_sm_context_response
(
TASK_SMF_APP
,
TASK_SMF_SBI
,
smreq
->
pid
);
/* itti_n11_create_sm_context_response* sm_context_resp =
new itti_n11_create_sm_context_response(
TASK_SMF_APP, TASK_SMF_SBI, smreq->pid);
*/
std
::
shared_ptr
<
itti_n11_create_sm_context_response
>
sm_context_resp_pending
=
std
::
shared_ptr
<
itti_n11_create_sm_context_response
>
(
sm_context_resp
);
std
::
make_shared
<
itti_n11_create_sm_context_response
>
(
TASK_SMF_APP
,
TASK_SMF_SBI
,
smreq
->
pid
);
// Assign necessary information for the response
xgpp_conv
::
create_sm_context_response_from_ctx_request
(
...
...
@@ -1292,7 +1303,7 @@ void smf_context::handle_pdu_session_create_sm_context_request(
std
::
shared_ptr
<
dnn_context
>
sd
=
{};
bool
find_dnn
=
find_dnn_context
(
snssai
,
dnn
,
sd
);
// Step 3.1. Create
dnn
context if not exist
// Step 3.1. Create
DNN
context if not exist
// At this step, this context should be existed
if
(
nullptr
==
sd
.
get
())
{
Logger
::
smf_app
().
debug
(
...
...
@@ -1308,7 +1319,7 @@ void smf_context::handle_pdu_session_create_sm_context_request(
"DNN context (dnn_in_use %s) is already existed"
,
dnn
.
c_str
());
}
// Step 3.2. Create
pdu
session if not exist
// Step 3.2. Create
PDU
session if not exist
std
::
shared_ptr
<
smf_pdu_session
>
sp
=
{};
bool
find_pdu
=
sd
.
get
()
->
find_pdu_session
(
pdu_session_id
,
sp
);
...
...
@@ -1388,7 +1399,7 @@ void smf_context::handle_pdu_session_create_sm_context_request(
// ALL_DYNAMIC_ADDRESSES_ARE_OCCUPIED;
set_paa
=
false
;
request_accepted
=
false
;
sm_context_resp
->
res
.
set_cause
(
static_cast
<
uint8_t
>
(
sm_context_resp
_pending
->
res
.
set_cause
(
static_cast
<
uint8_t
>
(
cause_value_5gsm_e
::
CAUSE_26_INSUFFICIENT_RESOURCES
));
}
// TODO: Static IP address allocation
...
...
@@ -1442,7 +1453,7 @@ void smf_context::handle_pdu_session_create_sm_context_request(
// ALL_DYNAMIC_ADDRESSES_ARE_OCCUPIED;
set_paa
=
false
;
request_accepted
=
false
;
sm_context_resp
->
res
.
set_cause
(
static_cast
<
uint8_t
>
(
sm_context_resp
_pending
->
res
.
set_cause
(
static_cast
<
uint8_t
>
(
cause_value_5gsm_e
::
CAUSE_26_INSUFFICIENT_RESOURCES
));
}
// Static IP address allocation
...
...
@@ -1486,7 +1497,7 @@ void smf_context::handle_pdu_session_create_sm_context_request(
http_status_code_e
::
HTTP_STATUS_CODE_500_INTERNAL_SERVER_ERROR
,
smreq
->
pid
,
N11_SESSION_CREATE_SM_CONTEXT_RESPONSE
);
}
// sm_context_resp->res.set_cause(static_cast<uint8_t>(cause_value_5gsm_e::CAUSE_28_UNKNOWN_PDU_SESSION_TYPE));
// sm_context_resp
_pending
->res.set_cause(static_cast<uint8_t>(cause_value_5gsm_e::CAUSE_28_UNKNOWN_PDU_SESSION_TYPE));
request_accepted
=
false
;
}
}
...
...
@@ -1580,7 +1591,7 @@ void smf_context::handle_pdu_session_create_sm_context_request(
remove_procedure
(
proc
);
// Set cause to error to trigger PDU session establishment reject (step
// 10)
sm_context_resp
->
res
.
set_cause
(
sm_context_resp
_pending
->
res
.
set_cause
(
PDU_SESSION_APPLICATION_ERROR_PEER_NOT_RESPONDING
);
}
}
else
{
// if request is rejected
...
...
@@ -1592,13 +1603,13 @@ void smf_context::handle_pdu_session_create_sm_context_request(
// Step 10. if error when establishing the pdu session,
// send ITTI message to APP to trigger N1N2MessageTransfer towards AMFs (PDU
// Session Establishment Reject)
if
(
sm_context_resp
->
res
.
get_cause
()
!=
if
(
sm_context_resp
_pending
->
res
.
get_cause
()
!=
static_cast
<
uint8_t
>
(
cause_value_5gsm_e
::
CAUSE_255_REQUEST_ACCEPTED
))
{
// clear pco, ambr
// free paa
paa_t
free_paa
=
{};
free_paa
=
sm_context_resp
->
res
.
get_paa
();
free_paa
=
sm_context_resp
_pending
->
res
.
get_paa
();
if
(
free_paa
.
is_ip_assigned
())
{
switch
(
sp
->
pdu_session_type
.
pdu_session_type
)
{
case
PDU_SESSION_TYPE_E_IPV4
:
...
...
@@ -1621,18 +1632,18 @@ void smf_context::handle_pdu_session_create_sm_context_request(
// Create PDU Session Establishment Reject and embedded in
// Namf_Communication_N1N2MessageTransfer Request
Logger
::
smf_app
().
debug
(
"Create PDU Session Establishment Reject"
);
cause_value_5gsm_e
cause_n1
=
s
tatic_cast
<
cause_value_5gsm_e
>
(
sm_context_resp
->
res
.
get_cause
());
cause_value_5gsm_e
cause_n1
=
static_cast
<
cause_value_5gsm_e
>
(
s
m_context_resp_pending
->
res
.
get_cause
());
smf_n1
::
get_instance
().
create_n1_pdu_session_establishment_reject
(
sm_context_resp_pending
->
res
,
n1_sm_message
,
cause_n1
);
conv
::
convert_string_2_hex
(
n1_sm_message
,
n1_sm_msg_hex
);
sm_context_resp_pending
->
res
.
set_n1_sm_message
(
n1_sm_msg_hex
);
// Get
supi
and put into URL
std
::
string
supi_str
;
supi_t
supi
=
sm_context_resp_pending
->
res
.
get_supi
();
supi_str
=
sm_context_resp_pending
->
res
.
get_supi_prefix
()
+
"-"
+
// Get
SUPI
and put into URL
std
::
string
supi_str
=
{}
;
supi_t
supi
=
sm_context_resp_pending
->
res
.
get_supi
();
supi_str
=
sm_context_resp_pending
->
res
.
get_supi_prefix
()
+
"-"
+
smf_supi_to_string
(
supi
);
std
::
string
url
=
"http://"
+
sp
.
get
()
->
get_amf_addr
()
+
NAMF_COMMUNICATION_BASE
+
...
...
@@ -2322,9 +2333,11 @@ bool smf_context::handle_pdu_session_update_sm_context_request(
"(HTTP version %d)"
,
smreq
->
http_version
);
pdu_session_update_sm_context_request
sm_context_req_msg
=
smreq
->
req
;
std
::
string
n1_sm_msg
,
n1_sm_msg_hex
;
std
::
string
n2_sm_info
,
n2_sm_info_hex
;
bool
update_upf
=
false
;
std
::
string
n1_sm_msg
=
{};
std
::
string
n1_sm_msg_hex
=
{};
std
::
string
n2_sm_info
=
{};
std
::
string
n2_sm_info_hex
=
{};
bool
update_upf
=
false
;
session_management_procedures_type_e
procedure_type
(
session_management_procedures_type_e
::
PDU_SESSION_ESTABLISHMENT_UE_REQUESTED
);
...
...
@@ -2352,13 +2365,14 @@ bool smf_context::handle_pdu_session_update_sm_context_request(
// we need to store HttpResponse and session-related information to be used
// when receiving the response from UPF
itti_n11_update_sm_context_response
*
n11_sm_context_resp
=
new
itti_n11_update_sm_context_response
(
TASK_SMF_SBI
,
TASK_SMF_APP
,
smreq
->
pid
);
//
itti_n11_update_sm_context_response* n11_sm_context_resp =
//
new itti_n11_update_sm_context_response(
//
TASK_SMF_SBI, TASK_SMF_APP, smreq->pid);
std
::
shared_ptr
<
itti_n11_update_sm_context_response
>
sm_context_resp_pending
=
std
::
shared_ptr
<
itti_n11_update_sm_context_response
>
(
n11_sm_context_resp
);
std
::
make_shared
<
itti_n11_update_sm_context_response
>
(
TASK_SMF_SBI
,
TASK_SMF_APP
,
smreq
->
pid
);
n11_sm_context_resp
->
res
.
set_pdu_session_type
(
sm_context_resp_pending
->
res
.
set_pdu_session_type
(
sp
.
get
()
->
get_pdu_session_type
().
pdu_session_type
);
// Assign necessary information for the response
...
...
@@ -2485,8 +2499,10 @@ bool smf_context::handle_pdu_session_update_sm_context_request(
}
// Step 2.2. Decode N2 (if content is available)
std
::
string
n2_sm_info_type_str
,
n2_sm_information
;
std
::
string
n2_sm_info_type_str
=
{};
std
::
string
n2_sm_information
=
{};
n2_sm_info_type_e
n2_sm_info_type
=
{};
if
(
sm_context_req_msg
.
n2_sm_info_is_set
())
{
// get necessary information (N2 SM information)
n2_sm_info_type_str
=
smreq
->
req
.
get_n2_sm_info_type
();
...
...
@@ -2873,24 +2889,26 @@ void smf_context::handle_pdu_session_release_sm_context_request(
return
;
}
itti_n11_release_sm_context_response
*
n11_sm_context_resp
=
new
itti_n11_release_sm_context_response
(
TASK_SMF_SBI
,
TASK_SMF_APP
,
smreq
->
pid
);
/* itti_n11_release_sm_context_response* n11_sm_context_resp =
new itti_n11_release_sm_context_response(
TASK_SMF_SBI, TASK_SMF_APP, smreq->pid);
*/
std
::
shared_ptr
<
itti_n11_release_sm_context_response
>
sm_context_resp_pending
=
std
::
shared_ptr
<
itti_n11_release_sm_context_response
>
(
n11_sm_context_resp
);
std
::
make_shared
<
itti_n11_release_sm_context_response
>
(
TASK_SMF_SBI
,
TASK_SMF_APP
,
smreq
->
pid
);
n11_sm_context_resp
->
res
.
set_http_code
(
sm_context_resp_pending
->
res
.
set_http_code
(
http_status_code_e
::
HTTP_STATUS_CODE_200_OK
);
n11_sm_context_resp
->
res
.
set_supi
(
smreq
->
req
.
get_supi
());
n11_sm_context_resp
->
res
.
set_supi_prefix
(
smreq
->
req
.
get_supi_prefix
());
n11_sm_context_resp
->
res
.
set_cause
(
sm_context_resp_pending
->
res
.
set_supi
(
smreq
->
req
.
get_supi
());
sm_context_resp_pending
->
res
.
set_supi_prefix
(
smreq
->
req
.
get_supi_prefix
());
sm_context_resp_pending
->
res
.
set_cause
(
static_cast
<
uint8_t
>
(
cause_value_5gsm_e
::
CAUSE_255_REQUEST_ACCEPTED
));
n11_sm_context_resp
->
res
.
set_pdu_session_id
(
smreq
->
req
.
get_pdu_session_id
());
n11_sm_context_resp
->
res
.
set_snssai
(
smreq
->
req
.
get_snssai
());
n11_sm_context_resp
->
res
.
set_dnn
(
smreq
->
req
.
get_dnn
());
sm_context_resp_pending
->
res
.
set_pdu_session_id
(
smreq
->
req
.
get_pdu_session_id
());
sm_context_resp_pending
->
res
.
set_snssai
(
smreq
->
req
.
get_snssai
());
sm_context_resp_pending
->
res
.
set_dnn
(
smreq
->
req
.
get_dnn
());
session_release_sm_context_procedure
*
proc
=
new
session_release_sm_context_procedure
(
sp
);
...
...
@@ -2899,7 +2917,7 @@ void smf_context::handle_pdu_session_release_sm_context_request(
insert_procedure
(
sproc
);
if
(
proc
->
run
(
smreq
,
sm_context_resp_pending
,
shared_from_this
()))
{
Logger
::
smf_app
().
info
(
"PDU Release SM Context Request procedure failed"
);
//
t
rigger to send reply to AMF
//
T
rigger to send reply to AMF
smf_app_inst
->
trigger_http_response
(
http_status_code_e
::
HTTP_STATUS_CODE_500_INTERNAL_SERVER_ERROR
,
smreq
->
pid
,
N11_SESSION_RELEASE_SM_CONTEXT_RESPONSE
);
...
...
src/smf_app/smf_n4.cpp
View file @
61ae53a0
...
...
@@ -610,14 +610,21 @@ void smf_n4::handle_receive_session_establishment_response(
handle_receive_message_cb
(
msg
,
remote_endpoint
,
TASK_SMF_N4
,
error
,
trxn_id
);
if
(
!
error
)
{
itti_n4_session_establishment_response
*
itti_msg
=
new
itti_n4_session_establishment_response
(
TASK_SMF_N4
,
TASK_SMF_APP
);
itti_msg
->
pfcp_ies
=
msg_ies_container
;
itti_msg
->
r_endpoint
=
remote_endpoint
;
itti_msg
->
trxn_id
=
trxn_id
;
itti_msg
->
seid
=
msg
.
get_seid
();
/* itti_n4_session_establishment_response* itti_msg =
new itti_n4_session_establishment_response(TASK_SMF_N4,
TASK_SMF_APP); itti_msg->pfcp_ies = msg_ies_container;
itti_msg->r_endpoint = remote_endpoint;
itti_msg->trxn_id = trxn_id;
itti_msg->seid = msg.get_seid();
*/
std
::
shared_ptr
<
itti_n4_session_establishment_response
>
i
=
std
::
shared_ptr
<
itti_n4_session_establishment_response
>
(
itti_msg
);
std
::
make_shared
<
itti_n4_session_establishment_response
>
(
TASK_SMF_N4
,
TASK_SMF_APP
);
i
->
pfcp_ies
=
msg_ies_container
;
i
->
r_endpoint
=
remote_endpoint
;
i
->
trxn_id
=
trxn_id
;
i
->
seid
=
msg
.
get_seid
();
int
ret
=
itti_inst
->
send_msg
(
i
);
if
(
RETURNok
!=
ret
)
{
Logger
::
smf_n4
().
error
(
...
...
@@ -638,19 +645,28 @@ void smf_n4::handle_receive_session_modification_response(
handle_receive_message_cb
(
msg
,
remote_endpoint
,
TASK_SMF_N4
,
error
,
trxn_id
);
if
(
!
error
)
{
itti_n4_session_modification_response
*
itti_msg
=
new
itti_n4_session_modification_response
(
TASK_SMF_N4
,
TASK_SMF_APP
);
/* itti_n4_session_modification_response* itti_msg =
new itti_n4_session_modification_response(TASK_SMF_N4,
TASK_SMF_APP); itti_msg->pfcp_ies = msg_ies_container;
itti_msg->r_endpoint = remote_endpoint;
itti_msg->trxn_id = trxn_id;
itti_msg->seid = msg.get_seid();
*/
std
::
shared_ptr
<
itti_n4_session_modification_response
>
itti_msg
=
std
::
make_shared
<
itti_n4_session_modification_response
>
(
TASK_SMF_N4
,
TASK_SMF_APP
);
itti_msg
->
pfcp_ies
=
msg_ies_container
;
itti_msg
->
r_endpoint
=
remote_endpoint
;
itti_msg
->
trxn_id
=
trxn_id
;
itti_msg
->
seid
=
msg
.
get_seid
();
std
::
shared_ptr
<
itti_n4_session_modification_response
>
i
=
std
::
shared_ptr
<
itti_n4_session_modification_response
>
(
itti_msg
);
int
ret
=
itti_inst
->
send_msg
(
i
);
int
ret
=
itti_inst
->
send_msg
(
itti_msg
);
if
(
RETURNok
!=
ret
)
{
Logger
::
smf_n4
().
error
(
"Could not send ITTI message %s to task TASK_SMF_APP"
,
i
->
get_msg_name
());
i
tti_msg
->
get_msg_name
());
}
}
// else ignore
...
...
@@ -666,19 +682,28 @@ void smf_n4::handle_receive_session_deletion_response(
handle_receive_message_cb
(
msg
,
remote_endpoint
,
TASK_SMF_N4
,
error
,
trxn_id
);
if
(
!
error
)
{
itti_n4_session_deletion_response
*
itti_msg
=
new
itti_n4_session_deletion_response
(
TASK_SMF_N4
,
TASK_SMF_APP
);
/* itti_n4_session_deletion_response* itti_msg =
new itti_n4_session_deletion_response(TASK_SMF_N4, TASK_SMF_APP);
itti_msg->pfcp_ies = msg_ies_container;
itti_msg->r_endpoint = remote_endpoint;
itti_msg->trxn_id = trxn_id;
itti_msg->seid = msg.get_seid();
*/
std
::
shared_ptr
<
itti_n4_session_deletion_response
>
itti_msg
=
std
::
make_shared
<
itti_n4_session_deletion_response
>
(
TASK_SMF_N4
,
TASK_SMF_APP
);
itti_msg
->
pfcp_ies
=
msg_ies_container
;
itti_msg
->
r_endpoint
=
remote_endpoint
;
itti_msg
->
trxn_id
=
trxn_id
;
itti_msg
->
seid
=
msg
.
get_seid
();
std
::
shared_ptr
<
itti_n4_session_deletion_response
>
i
=
std
::
shared_ptr
<
itti_n4_session_deletion_response
>
(
itti_msg
);
int
ret
=
itti_inst
->
send_msg
(
i
);
int
ret
=
itti_inst
->
send_msg
(
itti_msg
);
if
(
RETURNok
!=
ret
)
{
Logger
::
smf_n4
().
error
(
"Could not send ITTI message %s to task TASK_SMF_APP"
,
i
->
get_msg_name
());
i
tti_msg
->
get_msg_name
());
}
}
// else ignore
...
...
@@ -694,19 +719,26 @@ void smf_n4::handle_receive_session_report_request(
handle_receive_message_cb
(
msg
,
remote_endpoint
,
TASK_SMF_N4
,
error
,
trxn_id
);
if
(
!
error
)
{
itti_n4_session_report_request
*
itti_msg
=
new
itti_n4_session_report_request
(
TASK_SMF_N4
,
TASK_SMF_APP
);
/* itti_n4_session_report_request* itti_msg =
new itti_n4_session_report_request(TASK_SMF_N4, TASK_SMF_APP);
itti_msg->pfcp_ies = msg_ies_container;
itti_msg->r_endpoint = remote_endpoint;
itti_msg->trxn_id = trxn_id;
itti_msg->seid = msg.get_seid();
*/
std
::
shared_ptr
<
itti_n4_session_report_request
>
itti_msg
=
std
::
make_shared
<
itti_n4_session_report_request
>
(
TASK_SMF_N4
,
TASK_SMF_APP
);
itti_msg
->
pfcp_ies
=
msg_ies_container
;
itti_msg
->
r_endpoint
=
remote_endpoint
;
itti_msg
->
trxn_id
=
trxn_id
;
itti_msg
->
seid
=
msg
.
get_seid
();
std
::
shared_ptr
<
itti_n4_session_report_request
>
i
=
std
::
shared_ptr
<
itti_n4_session_report_request
>
(
itti_msg
);
int
ret
=
itti_inst
->
send_msg
(
i
);
int
ret
=
itti_inst
->
send_msg
(
itti_msg
);
if
(
RETURNok
!=
ret
)
{
Logger
::
smf_n4
().
error
(
"Could not send ITTI message %s to task TASK_SMF_APP"
,
i
->
get_msg_name
());
i
tti_msg
->
get_msg_name
());
}
}
// else ignore
...
...
src/smf_app/smf_procedure.cpp
View file @
61ae53a0
...
...
@@ -106,8 +106,6 @@ int session_create_sm_context_procedure::run(
snssai_t
snssai
=
sm_context_req
->
req
.
get_snssai
();
std
::
string
dnn
=
sm_context_req
->
req
.
get_dnn
();
// if (not pfcp_associations::get_instance().select_up_node(
// up_node_id, NODE_SELECTION_CRITERIA_MIN_PFCP_SESSIONS)) {
if
(
not
pfcp_associations
::
get_instance
().
select_up_node
(
up_node_id
,
snssai
,
dnn
))
{
sm_context_resp
->
res
.
set_cause
(
...
...
@@ -132,19 +130,27 @@ int session_create_sm_context_procedure::run(
n11_triggered_pending
=
sm_context_resp
;
uint64_t
seid
=
smf_app_inst
->
generate_seid
();
sps
->
set_seid
(
seid
);
/*
itti_n4_session_establishment_request* n4_ser =
new itti_n4_session_establishment_request(TASK_SMF_APP, TASK_SMF_N4);
n4_ser->seid = 0;
n4_ser->trxn_id = this->trxn_id;
n4_ser->r_endpoint = endpoint(up_node_id.u1.ipv4_address, pfcp::default_port);
n4_triggered
=
std
::
shared_ptr
<
itti_n4_session_establishment_request
>
(
n4_ser
);
*/
n4_triggered
=
std
::
make_shared
<
itti_n4_session_establishment_request
>
(
TASK_SMF_APP
,
TASK_SMF_N4
);
n4_triggered
->
seid
=
0
;
n4_triggered
->
trxn_id
=
this
->
trxn_id
;
n4_triggered
->
r_endpoint
=
endpoint
(
up_node_id
.
u1
.
ipv4_address
,
pfcp
::
default_port
);
//-------------------
// IE node_id_t
//-------------------
pfcp
::
node_id_t
node_id
=
{};
smf_cfg
.
get_pfcp_node_id
(
node_id
);
n4_
ser
->
pfcp_ies
.
set
(
node_id
);
n4_
triggered
->
pfcp_ies
.
set
(
node_id
);
//-------------------
// IE fseid_t
...
...
@@ -152,7 +158,7 @@ int session_create_sm_context_procedure::run(
pfcp
::
fseid_t
cp_fseid
=
{};
smf_cfg
.
get_pfcp_fseid
(
cp_fseid
);
cp_fseid
.
seid
=
sps
->
seid
;
n4_
ser
->
pfcp_ies
.
set
(
cp_fseid
);
n4_
triggered
->
pfcp_ies
.
set
(
cp_fseid
);
//*******************
// UPLINK
...
...
@@ -266,8 +272,8 @@ int session_create_sm_context_procedure::run(
//-------------------
// ADD IEs to message
//-------------------
n4_
ser
->
pfcp_ies
.
set
(
create_pdr
);
n4_
ser
->
pfcp_ies
.
set
(
create_far
);
n4_
triggered
->
pfcp_ies
.
set
(
create_pdr
);
n4_
triggered
->
pfcp_ies
.
set
(
create_far
);
// TODO: verify whether N4 SessionID should be included in PDR and FAR
// (Section 5.8.2.11@3GPP TS 23.501)
...
...
@@ -301,12 +307,13 @@ int session_create_sm_context_procedure::run(
smf_app_inst
->
set_seid_2_smf_context
(
cp_fseid
.
seid
,
sc
);
Logger
::
smf_app
().
info
(
"Sending ITTI message %s to task TASK_SMF_N4"
,
n4_ser
->
get_msg_name
());
"Sending ITTI message %s to task TASK_SMF_N4"
,
n4_triggered
->
get_msg_name
());
int
ret
=
itti_inst
->
send_msg
(
n4_triggered
);
if
(
RETURNok
!=
ret
)
{
Logger
::
smf_app
().
error
(
"Could not send ITTI message %s to task TASK_SMF_N4"
,
n4_
ser
->
get_msg_name
());
n4_
triggered
->
get_msg_name
());
return
RETURNerror
;
}
...
...
@@ -386,8 +393,10 @@ void session_create_sm_context_procedure::handle_itti_msg(
// fill content for N1N2MessageTransfer (including N1, N2 SM)
// Create N1 SM container & N2 SM Information
std
::
string
n1_sm_msg
,
n1_sm_msg_hex
;
std
::
string
n2_sm_info
,
n2_sm_info_hex
;
std
::
string
n1_sm_msg
=
{};
std
::
string
n1_sm_msg_hex
=
{};
std
::
string
n2_sm_info
=
{};
std
::
string
n2_sm_info_hex
=
{};
if
(
n11_triggered_pending
->
res
.
get_cause
()
!=
static_cast
<
uint8_t
>
(
cause_value_5gsm_e
::
CAUSE_255_REQUEST_ACCEPTED
))
{
...
...
@@ -436,14 +445,11 @@ void session_create_sm_context_procedure::handle_itti_msg(
}
// Fill N1N2MesasgeTransferRequestData
// get
supi
and put into URL
// get
SUPI
and put into URL
supi_t
supi
=
n11_triggered_pending
->
res
.
get_supi
();
std
::
string
supi_str
=
n11_triggered_pending
->
res
.
get_supi_prefix
()
+
"-"
+
smf_supi_to_string
(
supi
);
std
::
string
url
=
// std::string(inet_ntoa(*((struct in_addr*)
// &smf_cfg.amf_addr.ipv4_addr))) +
//":" + std::to_string(smf_cfg.amf_addr.port) + NAMF_COMMUNICATION_BASE +
"http://"
+
sps
.
get
()
->
get_amf_addr
()
+
NAMF_COMMUNICATION_BASE
+
smf_cfg
.
amf_addr
.
api_version
+
fmt
::
format
(
...
...
@@ -477,9 +483,6 @@ void session_create_sm_context_procedure::handle_itti_msg(
// N1N2MsgTxfrFailureNotification
std
::
string
callback_uri
=
// std::string(
// inet_ntoa(*((struct in_addr*) &smf_cfg.amf_addr.ipv4_addr))) +
//":" + std::to_string(smf_cfg.amf_addr.port) + NSMF_PDU_SESSION_BASE +
sps
.
get
()
->
get_amf_addr
()
+
NSMF_PDU_SESSION_BASE
+
smf_cfg
.
sbi_api_version
+
fmt
::
format
(
...
...
@@ -555,12 +558,20 @@ int session_update_sm_context_procedure::run(
n11_triggered_pending
=
sm_context_resp
;
uint64_t
seid
=
smf_app_inst
->
generate_seid
();
sps
->
set_seid
(
seid
);
itti_n4_session_modification_request
*
n4_ser
=
new
itti_n4_session_modification_request
(
TASK_SMF_APP
,
TASK_SMF_N4
);
n4_ser
->
seid
=
sps
->
up_fseid
.
seid
;
n4_ser
->
trxn_id
=
this
->
trxn_id
;
n4_ser
->
r_endpoint
=
endpoint
(
up_node_id
.
u1
.
ipv4_address
,
pfcp
::
default_port
);
n4_triggered
=
std
::
shared_ptr
<
itti_n4_session_modification_request
>
(
n4_ser
);
/* itti_n4_session_modification_request* n4_ser =
new itti_n4_session_modification_request(TASK_SMF_APP, TASK_SMF_N4);
n4_ser->seid = sps->up_fseid.seid;
n4_ser->trxn_id = this->trxn_id;
n4_ser->r_endpoint = endpoint(up_node_id.u1.ipv4_address,
pfcp::default_port);
*/
n4_triggered
=
std
::
make_shared
<
itti_n4_session_modification_request
>
(
TASK_SMF_APP
,
TASK_SMF_N4
);
n4_triggered
->
seid
=
sps
->
up_fseid
.
seid
;
n4_triggered
->
trxn_id
=
this
->
trxn_id
;
n4_triggered
->
r_endpoint
=
endpoint
(
up_node_id
.
u1
.
ipv4_address
,
pfcp
::
default_port
);
// qos Flow to be modified
pdu_session_update_sm_context_request
sm_context_req_msg
=
...
...
@@ -648,7 +659,7 @@ int session_update_sm_context_procedure::run(
// of a first DL packet
update_far
.
set
(
apply_action
);
n4_
ser
->
pfcp_ies
.
set
(
update_far
);
n4_
triggered
->
pfcp_ies
.
set
(
update_far
);
send_n4
=
true
;
flow
.
far_id_dl
.
first
=
true
;
...
...
@@ -695,7 +706,7 @@ int session_update_sm_context_procedure::run(
create_far
.
set
(
forwarding_parameters
);
// Add IEs to message
n4_
ser
->
pfcp_ies
.
set
(
create_far
);
n4_
triggered
->
pfcp_ies
.
set
(
create_far
);
send_n4
=
true
;
...
...
@@ -764,7 +775,7 @@ int session_update_sm_context_procedure::run(
create_pdr
.
set
(
far_id
);
// Add IEs to message
n4_
ser
->
pfcp_ies
.
set
(
create_pdr
);
n4_
triggered
->
pfcp_ies
.
set
(
create_pdr
);
send_n4
=
true
;
...
...
@@ -788,7 +799,7 @@ int session_update_sm_context_procedure::run(
apply_action.forw = 1;
update_far.set(apply_action);
n4_
ser
->pfcp_ies.set(update_far);
n4_
triggered
->pfcp_ies.set(update_far);
send_n4 = true;
...
...
@@ -825,7 +836,7 @@ int session_update_sm_context_procedure::run(
update_pdr
.
set
(
flow
.
far_id_dl
.
second
);
// Add IEs to message
n4_
ser
->
pfcp_ies
.
set
(
update_pdr
);
n4_
triggered
->
pfcp_ies
.
set
(
update_pdr
);
send_n4
=
true
;
Logger
::
smf_app
().
debug
(
...
...
@@ -884,7 +895,7 @@ int session_update_sm_context_procedure::run(
far
.
set
(
far_id
);
far
.
set
(
apply_action
);
// Add IEs to message
n4_
ser
->
pfcp_ies
.
set
(
far
);
n4_
triggered
->
pfcp_ies
.
set
(
far
);
send_n4
=
true
;
...
...
@@ -906,7 +917,7 @@ int session_update_sm_context_procedure::run(
far
.
set
(
far_id
);
far
.
set
(
apply_action
);
// Add IEs to message
n4_
ser
->
pfcp_ies
.
set
(
far
);
n4_
triggered
->
pfcp_ies
.
set
(
far
);
send_n4
=
true
;
}
...
...
@@ -925,12 +936,13 @@ int session_update_sm_context_procedure::run(
if
(
send_n4
)
{
Logger
::
smf_app
().
info
(
"Sending ITTI message %s to task TASK_SMF_N4"
,
n4_ser
->
get_msg_name
());
"Sending ITTI message %s to task TASK_SMF_N4"
,
n4_triggered
->
get_msg_name
());
int
ret
=
itti_inst
->
send_msg
(
n4_triggered
);
if
(
RETURNok
!=
ret
)
{
Logger
::
smf_app
().
error
(
"Could not send ITTI message %s to task TASK_SMF_N4"
,
n4_
ser
->
get_msg_name
());
n4_
triggered
->
get_msg_name
());
return
RETURNerror
;
}
}
else
{
...
...
@@ -1406,20 +1418,29 @@ int session_release_sm_context_procedure::run(
n11_triggered_pending
=
sm_context_res
;
uint64_t
seid
=
smf_app_inst
->
generate_seid
();
sps
->
set_seid
(
seid
);
itti_n4_session_deletion_request
*
n4_ser
=
new
itti_n4_session_deletion_request
(
TASK_SMF_APP
,
TASK_SMF_N4
);
n4_ser
->
seid
=
sps
->
up_fseid
.
seid
;
n4_ser
->
trxn_id
=
this
->
trxn_id
;
n4_ser
->
r_endpoint
=
endpoint
(
up_node_id
.
u1
.
ipv4_address
,
pfcp
::
default_port
);
n4_triggered
=
std
::
shared_ptr
<
itti_n4_session_deletion_request
>
(
n4_ser
);
/* itti_n4_session_deletion_request* n4_ser =
new itti_n4_session_deletion_request(TASK_SMF_APP, TASK_SMF_N4);
n4_ser->seid = sps->up_fseid.seid;
n4_ser->trxn_id = this->trxn_id;
n4_ser->r_endpoint = endpoint(up_node_id.u1.ipv4_address,
pfcp::default_port);
*/
n4_triggered
=
std
::
make_shared
<
itti_n4_session_deletion_request
>
(
TASK_SMF_APP
,
TASK_SMF_N4
);
n4_triggered
->
seid
=
sps
->
up_fseid
.
seid
;
n4_triggered
->
trxn_id
=
this
->
trxn_id
;
n4_triggered
->
r_endpoint
=
endpoint
(
up_node_id
.
u1
.
ipv4_address
,
pfcp
::
default_port
);
Logger
::
smf_app
().
info
(
"Sending ITTI message %s to task TASK_SMF_N4"
,
n4_ser
->
get_msg_name
());
"Sending ITTI message %s to task TASK_SMF_N4"
,
n4_triggered
->
get_msg_name
());
int
ret
=
itti_inst
->
send_msg
(
n4_triggered
);
if
(
RETURNok
!=
ret
)
{
Logger
::
smf_app
().
error
(
"Could not send ITTI message %s to task TASK_SMF_N4"
,
n4_
ser
->
get_msg_name
());
n4_
triggered
->
get_msg_name
());
return
RETURNerror
;
}
return
RETURNok
;
...
...
src/smf_app/smf_sbi.cpp
View file @
61ae53a0
...
...
@@ -260,9 +260,14 @@ void smf_sbi::send_n1n2_message_transfer_request(
response_data_json
[
"cause"
].
dump
().
c_str
());
// Send response to APP to process
itti_n11_n1n2_message_transfer_response_status
*
itti_msg
=
new
itti_n11_n1n2_message_transfer_response_status
(
/* itti_n11_n1n2_message_transfer_response_status* itti_msg =
new itti_n11_n1n2_message_transfer_response_status(
TASK_SMF_SBI, TASK_SMF_APP);
*/
std
::
shared_ptr
<
itti_n11_n1n2_message_transfer_response_status
>
itti_msg
=
std
::
make_shared
<
itti_n11_n1n2_message_transfer_response_status
>
(
TASK_SMF_SBI
,
TASK_SMF_APP
);
itti_msg
->
set_response_code
(
response_code
);
itti_msg
->
set_scid
(
sm_context_res
->
scid
);
itti_msg
->
set_procedure_type
(
session_management_procedures_type_e
::
...
...
@@ -274,13 +279,12 @@ void smf_sbi::send_n1n2_message_transfer_request(
}
else
{
itti_msg
->
set_msg_type
(
PDU_SESSION_ESTABLISHMENT_REJECT
);
}
std
::
shared_ptr
<
itti_n11_n1n2_message_transfer_response_status
>
i
=
std
::
shared_ptr
<
itti_n11_n1n2_message_transfer_response_status
>
(
itti_msg
);
int
ret
=
itti_inst
->
send_msg
(
i
);
int
ret
=
itti_inst
->
send_msg
(
itti_msg
);
if
(
RETURNok
!=
ret
)
{
Logger
::
smf_sbi
().
error
(
"Could not send ITTI message %s to task TASK_SMF_APP"
,
i
->
get_msg_name
());
i
tti_msg
->
get_msg_name
());
}
return
;
}
...
...
@@ -421,9 +425,14 @@ void smf_sbi::send_n1n2_message_transfer_request(
response_data_json
[
"cause"
].
dump
().
c_str
());
// Send response to APP to process
itti_n11_n1n2_message_transfer_response_status
*
itti_msg
=
/*
itti_n11_n1n2_message_transfer_response_status* itti_msg =
new itti_n11_n1n2_message_transfer_response_status(
TASK_SMF_SBI, TASK_SMF_APP);
*/
std
::
shared_ptr
<
itti_n11_n1n2_message_transfer_response_status
>
itti_msg
=
std
::
make_shared
<
itti_n11_n1n2_message_transfer_response_status
>
(
TASK_SMF_SBI
,
TASK_SMF_APP
);
itti_msg
->
set_response_code
(
httpCode
);
itti_msg
->
set_procedure_type
(
session_management_procedures_type_e
::
SERVICE_REQUEST_NETWORK_TRIGGERED
);
...
...
@@ -431,13 +440,11 @@ void smf_sbi::send_n1n2_message_transfer_request(
itti_msg
->
set_seid
(
report_msg
->
res
.
get_seid
());
itti_msg
->
set_trxn_id
(
report_msg
->
res
.
get_trxn_id
());
std
::
shared_ptr
<
itti_n11_n1n2_message_transfer_response_status
>
i
=
std
::
shared_ptr
<
itti_n11_n1n2_message_transfer_response_status
>
(
itti_msg
);
int
ret
=
itti_inst
->
send_msg
(
i
);
int
ret
=
itti_inst
->
send_msg
(
itti_msg
);
if
(
RETURNok
!=
ret
)
{
Logger
::
smf_sbi
().
error
(
"Could not send ITTI message %s to task TASK_SMF_APP"
,
i
->
get_msg_name
());
i
tti_msg
->
get_msg_name
());
}
}
...
...
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