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
c3107524
Commit
c3107524
authored
Jan 25, 2021
by
Tien-Thinh Nguyen
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Update SMF_APP
parent
a414fe4f
Changes
5
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
187 additions
and
103 deletions
+187
-103
src/common/utils/3gpp_conversions.cpp
src/common/utils/3gpp_conversions.cpp
+94
-0
src/common/utils/3gpp_conversions.hpp
src/common/utils/3gpp_conversions.hpp
+23
-0
src/common/utils/CMakeLists.txt
src/common/utils/CMakeLists.txt
+7
-0
src/smf_app/smf_app.cpp
src/smf_app/smf_app.cpp
+29
-74
src/smf_app/smf_context.cpp
src/smf_app/smf_context.cpp
+34
-29
No files found.
src/common/utils/3gpp_conversions.cpp
View file @
c3107524
...
@@ -35,6 +35,7 @@
...
@@ -35,6 +35,7 @@
#include "SmContextCreateData.h"
#include "SmContextCreateData.h"
#include "SmContextUpdateData.h"
#include "SmContextUpdateData.h"
#include "SmContextReleaseData.h"
#include "SmContextReleaseData.h"
#include "3gpp_29.500.h"
//------------------------------------------------------------------------------
//------------------------------------------------------------------------------
void
xgpp_conv
::
paa_to_pfcp_ue_ip_address
(
void
xgpp_conv
::
paa_to_pfcp_ue_ip_address
(
...
@@ -60,6 +61,7 @@ void xgpp_conv::paa_to_pfcp_ue_ip_address(
...
@@ -60,6 +61,7 @@ void xgpp_conv::paa_to_pfcp_ue_ip_address(
default:
;
default:
;
}
}
}
}
//------------------------------------------------------------------------------
//------------------------------------------------------------------------------
void
xgpp_conv
::
pdn_ip_to_pfcp_ue_ip_address
(
void
xgpp_conv
::
pdn_ip_to_pfcp_ue_ip_address
(
const
pdu_session_type_t
&
pdu_session_type
,
const
pdu_session_type_t
&
pdu_session_type
,
...
@@ -87,6 +89,7 @@ void xgpp_conv::pdn_ip_to_pfcp_ue_ip_address(
...
@@ -87,6 +89,7 @@ void xgpp_conv::pdn_ip_to_pfcp_ue_ip_address(
}
}
}
}
//------------------------------------------------------------------------------
void
xgpp_conv
::
pco_nas_to_core
(
void
xgpp_conv
::
pco_nas_to_core
(
const
protocol_configuration_options_nas_t
&
pco_nas
,
const
protocol_configuration_options_nas_t
&
pco_nas
,
protocol_configuration_options_t
&
pco
)
{
protocol_configuration_options_t
&
pco
)
{
...
@@ -122,6 +125,7 @@ void xgpp_conv::pco_nas_to_core(
...
@@ -122,6 +125,7 @@ void xgpp_conv::pco_nas_to_core(
}
}
}
}
//------------------------------------------------------------------------------
void
xgpp_conv
::
pco_core_to_nas
(
void
xgpp_conv
::
pco_core_to_nas
(
const
protocol_configuration_options_t
&
pco
,
const
protocol_configuration_options_t
&
pco
,
protocol_configuration_options_nas_t
&
pco_nas
)
{
protocol_configuration_options_nas_t
&
pco_nas
)
{
...
@@ -147,6 +151,7 @@ void xgpp_conv::pco_core_to_nas(
...
@@ -147,6 +151,7 @@ void xgpp_conv::pco_core_to_nas(
}
}
}
}
//------------------------------------------------------------------------------
void
xgpp_conv
::
sm_context_create_from_openapi
(
void
xgpp_conv
::
sm_context_create_from_openapi
(
const
oai
::
smf_server
::
model
::
SmContextMessage
&
scd
,
const
oai
::
smf_server
::
model
::
SmContextMessage
&
scd
,
smf
::
pdu_session_create_sm_context_request
&
pcr
)
{
smf
::
pdu_session_create_sm_context_request
&
pcr
)
{
...
@@ -231,6 +236,7 @@ void xgpp_conv::sm_context_create_from_openapi(
...
@@ -231,6 +236,7 @@ void xgpp_conv::sm_context_create_from_openapi(
// Extended protocol configuration options (Optional) e.g, FOR DHCP
// Extended protocol configuration options (Optional) e.g, FOR DHCP
}
}
//------------------------------------------------------------------------------
void
xgpp_conv
::
sm_context_update_from_openapi
(
void
xgpp_conv
::
sm_context_update_from_openapi
(
const
oai
::
smf_server
::
model
::
SmContextUpdateMessage
&
scu
,
const
oai
::
smf_server
::
model
::
SmContextUpdateMessage
&
scu
,
smf
::
pdu_session_update_sm_context_request
&
pur
)
{
smf
::
pdu_session_update_sm_context_request
&
pur
)
{
...
@@ -302,6 +308,7 @@ void xgpp_conv::sm_context_update_from_openapi(
...
@@ -302,6 +308,7 @@ void xgpp_conv::sm_context_update_from_openapi(
// ACK), User location
// ACK), User location
}
}
//------------------------------------------------------------------------------
void
xgpp_conv
::
sm_context_release_from_openapi
(
void
xgpp_conv
::
sm_context_release_from_openapi
(
const
oai
::
smf_server
::
model
::
SmContextReleaseMessage
&
srm
,
const
oai
::
smf_server
::
model
::
SmContextReleaseMessage
&
srm
,
smf
::
pdu_session_release_sm_context_request
&
prr
)
{
smf
::
pdu_session_release_sm_context_request
&
prr
)
{
...
@@ -332,6 +339,7 @@ void xgpp_conv::sm_context_release_from_openapi(
...
@@ -332,6 +339,7 @@ void xgpp_conv::sm_context_release_from_openapi(
// ismfReleaseOnly:
// ismfReleaseOnly:
}
}
//------------------------------------------------------------------------------
void
xgpp_conv
::
data_notification_from_openapi
(
void
xgpp_conv
::
data_notification_from_openapi
(
const
oai
::
smf_server
::
model
::
NotificationData
&
nd
,
const
oai
::
smf_server
::
model
::
NotificationData
&
nd
,
smf
::
data_notification_msg
&
dn_msg
)
{
smf
::
data_notification_msg
&
dn_msg
)
{
...
@@ -354,6 +362,7 @@ void xgpp_conv::data_notification_from_openapi(
...
@@ -354,6 +362,7 @@ void xgpp_conv::data_notification_from_openapi(
dn_msg
.
set_profile
(
p
);
dn_msg
.
set_profile
(
p
);
}
}
//------------------------------------------------------------------------------
void
xgpp_conv
::
smf_event_exposure_notification_from_openapi
(
void
xgpp_conv
::
smf_event_exposure_notification_from_openapi
(
const
oai
::
smf_server
::
model
::
NsmfEventExposure
&
nee
,
const
oai
::
smf_server
::
model
::
NsmfEventExposure
&
nee
,
smf
::
event_exposure_msg
&
eem
)
{
smf
::
event_exposure_msg
&
eem
)
{
...
@@ -399,3 +408,88 @@ void xgpp_conv::smf_event_exposure_notification_from_openapi(
...
@@ -399,3 +408,88 @@ void xgpp_conv::smf_event_exposure_notification_from_openapi(
// event_subscriptions.push_back(event_subscription);
// event_subscriptions.push_back(event_subscription);
//}
//}
}
}
//------------------------------------------------------------------------------
void
xgpp_conv
::
sm_context_request_from_nas
(
const
nas_message_t
&
nas_msg
,
smf
::
pdu_session_create_sm_context_request
&
pcr
)
{
pdu_session_type_t
pdu_session_type
=
{.
pdu_session_type
=
PDU_SESSION_TYPE_E_IPV4
};
// Extended Protocol Discriminator
pcr
.
set_epd
(
nas_msg
.
header
.
extended_protocol_discriminator
);
// Message Type
pcr
.
set_message_type
(
nas_msg
.
plain
.
sm
.
header
.
message_type
);
// TODO: Integrity protection maximum data rate (Mandatory)
// PDU session type (Optional)
if
(
nas_msg
.
plain
.
sm
.
header
.
message_type
==
PDU_SESSION_ESTABLISHMENT_REQUEST
)
{
Logger
::
smf_app
().
debug
(
"PDU Session Type %d"
,
nas_msg
.
plain
.
sm
.
pdu_session_establishment_request
.
_pdusessiontype
.
pdu_session_type_value
);
pdu_session_type
.
pdu_session_type
=
nas_msg
.
plain
.
sm
.
pdu_session_establishment_request
.
_pdusessiontype
.
pdu_session_type_value
;
}
pcr
.
set_pdu_session_type
(
pdu_session_type
.
pdu_session_type
);
// TODO: SSCMode
// TODO: store UE 5GSM Capability
// TODO: MaximumNumberOfSupportedPacketFilters
// TODO: AlwaysonPDUSessionRequested
// TODO: SMPDUDNRequestContainer
// ExtendedProtocolConfigurationOptions
protocol_configuration_options_t
pco
=
{};
pco_nas_to_core
(
nas_msg
.
plain
.
sm
.
pdu_session_establishment_request
.
extendedprotocolconfigurationoptions
,
pco
);
pcr
.
set_epco
(
pco
);
// PTI
procedure_transaction_id_t
pti
=
{
.
procedure_transaction_id
=
nas_msg
.
plain
.
sm
.
header
.
procedure_transaction_identity
};
pcr
.
set_pti
(
pti
);
}
//------------------------------------------------------------------------------
void
xgpp_conv
::
create_sm_context_response_from_ct_request
(
const
std
::
shared_ptr
<
itti_n11_create_sm_context_request
>&
ctx_request
,
std
::
shared_ptr
<
itti_n11_create_sm_context_response
>&
ctx_response
)
{
ctx_response
->
http_version
=
ctx_request
->
http_version
;
ctx_response
->
res
.
set_http_code
(
http_status_code_e
::
HTTP_STATUS_CODE_200_OK
);
ctx_response
->
res
.
set_supi
(
ctx_request
->
req
.
get_supi
());
ctx_response
->
res
.
set_supi_prefix
(
ctx_request
->
req
.
get_supi_prefix
());
ctx_response
->
res
.
set_cause
(
REQUEST_ACCEPTED
);
ctx_response
->
res
.
set_pdu_session_id
(
ctx_request
->
req
.
get_pdu_session_id
());
ctx_response
->
res
.
set_snssai
(
ctx_request
->
req
.
get_snssai
());
ctx_response
->
res
.
set_dnn
(
ctx_request
->
req
.
get_dnn
());
ctx_response
->
res
.
set_pdu_session_type
(
ctx_request
->
req
.
get_pdu_session_type
());
ctx_response
->
res
.
set_pti
(
ctx_request
->
req
.
get_pti
());
ctx_response
->
set_scid
(
ctx_request
->
scid
);
}
//------------------------------------------------------------------------------
void
xgpp_conv
::
update_sm_context_response_from_ct_request
(
const
std
::
shared_ptr
<
itti_n11_update_sm_context_request
>&
ct_request
,
std
::
shared_ptr
<
itti_n11_update_sm_context_response
>&
ct_response
)
{
ct_response
->
res
.
set_http_code
(
http_status_code_e
::
HTTP_STATUS_CODE_200_OK
);
// default status code
ct_response
->
res
.
set_supi
(
ct_request
->
req
.
get_supi
());
ct_response
->
res
.
set_supi_prefix
(
ct_request
->
req
.
get_supi_prefix
());
ct_response
->
res
.
set_cause
(
REQUEST_ACCEPTED
);
ct_response
->
res
.
set_pdu_session_id
(
ct_request
->
req
.
get_pdu_session_id
());
ct_response
->
res
.
set_snssai
(
ct_request
->
req
.
get_snssai
());
ct_response
->
res
.
set_dnn
(
ct_request
->
req
.
get_dnn
());
}
src/common/utils/3gpp_conversions.hpp
View file @
c3107524
...
@@ -40,6 +40,11 @@
...
@@ -40,6 +40,11 @@
#include "NotificationData.h"
#include "NotificationData.h"
#include "NsmfEventExposure.h"
#include "NsmfEventExposure.h"
#include "smf_msg.hpp"
#include "smf_msg.hpp"
#include "itti_msg_n11.hpp"
extern
"C"
{
#include "nas_message.h"
}
namespace
xgpp_conv
{
namespace
xgpp_conv
{
...
@@ -146,6 +151,24 @@ void smf_event_exposure_notification_from_openapi(
...
@@ -146,6 +151,24 @@ void smf_event_exposure_notification_from_openapi(
const
oai
::
smf_server
::
model
::
NsmfEventExposure
&
nee
,
const
oai
::
smf_server
::
model
::
NsmfEventExposure
&
nee
,
smf
::
event_exposure_msg
&
eem
);
smf
::
event_exposure_msg
&
eem
);
/*
* Convert NAS to SM Context Request msg
* @param [const nas_message_t&] nm: NAS msg
* @param [smf::pdu_session_create_sm_context_request&] pcr: PDU
* SessionCreateSMContextRequest msg
* @return void
*/
void
sm_context_request_from_nas
(
const
nas_message_t
&
nm
,
smf
::
pdu_session_create_sm_context_request
&
pcr
);
void
create_sm_context_response_from_ct_request
(
const
std
::
shared_ptr
<
itti_n11_create_sm_context_request
>&
ct_request
,
std
::
shared_ptr
<
itti_n11_create_sm_context_response
>&
ct_response
);
void
update_sm_context_response_from_ct_request
(
const
std
::
shared_ptr
<
itti_n11_update_sm_context_request
>&
ct_request
,
std
::
shared_ptr
<
itti_n11_update_sm_context_response
>&
ct_response
);
}
// namespace xgpp_conv
}
// namespace xgpp_conv
#endif
/* FILE_3GPP_CONVERSIONS_HPP_SEEN */
#endif
/* FILE_3GPP_CONVERSIONS_HPP_SEEN */
src/common/utils/CMakeLists.txt
View file @
c3107524
...
@@ -27,7 +27,14 @@ include_directories(${SRC_TOP_DIR}/itti)
...
@@ -27,7 +27,14 @@ include_directories(${SRC_TOP_DIR}/itti)
include_directories
(
${
SRC_TOP_DIR
}
/common/nas
)
include_directories
(
${
SRC_TOP_DIR
}
/common/nas
)
include_directories
(
${
SRC_TOP_DIR
}
/api-server/model
)
include_directories
(
${
SRC_TOP_DIR
}
/api-server/model
)
include_directories
(
${
SRC_TOP_DIR
}
/smf_app
)
include_directories
(
${
SRC_TOP_DIR
}
/smf_app
)
include_directories
(
${
SRC_TOP_DIR
}
/nas
)
include_directories
(
${
SRC_TOP_DIR
}
/nas/ies
)
include_directories
(
${
SRC_TOP_DIR
}
/nas/ies
)
include_directories
(
${
SRC_TOP_DIR
}
/nas/sm/msg
)
include_directories
(
${
SRC_TOP_DIR
}
/nas/mm
)
include_directories
(
${
SRC_TOP_DIR
}
/nas/mm/msg
)
include_directories
(
${
SRC_TOP_DIR
}
/nas/sm
)
include_directories
(
${
SRC_TOP_DIR
}
/nas/sm/msg
)
#include_directories(${SRC_TOP_DIR}/nas/security)
include_directories
(
${
SRC_TOP_DIR
}
/ngap/asn1c
)
include_directories
(
${
SRC_TOP_DIR
}
/ngap/asn1c
)
include_directories
(
${
SRC_TOP_DIR
}
/../build/ext/spdlog/include
)
include_directories
(
${
SRC_TOP_DIR
}
/../build/ext/spdlog/include
)
...
...
src/smf_app/smf_app.cpp
View file @
c3107524
...
@@ -354,7 +354,6 @@ smf_app::smf_app(const std::string& config_file)
...
@@ -354,7 +354,6 @@ smf_app::smf_app(const std::string& config_file)
}
}
//------------------------------------------------------------------------------
//------------------------------------------------------------------------------
// From SPGWU
void
smf_app
::
start_upf_association
(
const
pfcp
::
node_id_t
&
node_id
)
{
void
smf_app
::
start_upf_association
(
const
pfcp
::
node_id_t
&
node_id
)
{
std
::
time_t
time_epoch
=
std
::
time
(
nullptr
);
std
::
time_t
time_epoch
=
std
::
time
(
nullptr
);
uint64_t
tv_ntp
=
time_epoch
+
SECONDS_SINCE_FIRST_EPOCH
;
uint64_t
tv_ntp
=
time_epoch
+
SECONDS_SINCE_FIRST_EPOCH
;
...
@@ -452,7 +451,6 @@ void smf_app::handle_itti_msg(
...
@@ -452,7 +451,6 @@ void smf_app::handle_itti_msg(
//------------------------------------------------------------------------------
//------------------------------------------------------------------------------
void
smf_app
::
handle_itti_msg
(
void
smf_app
::
handle_itti_msg
(
itti_n11_n1n2_message_transfer_response_status
&
m
)
{
itti_n11_n1n2_message_transfer_response_status
&
m
)
{
// see TS29518_Namf_Communication.yaml
Logger
::
smf_app
().
info
(
"Process N1N2MessageTransfer Response"
);
Logger
::
smf_app
().
info
(
"Process N1N2MessageTransfer Response"
);
switch
(
m
.
procedure_type
)
{
switch
(
m
.
procedure_type
)
{
...
@@ -487,6 +485,7 @@ void smf_app::handle_itti_msg(
...
@@ -487,6 +485,7 @@ void smf_app::handle_itti_msg(
"Got response from AMF (response code %d)"
,
m
.
response_code
);
"Got response from AMF (response code %d)"
,
m
.
response_code
);
}
}
}
break
;
}
break
;
case
session_management_procedures_type_e
:
:
case
session_management_procedures_type_e
:
:
SERVICE_REQUEST_NETWORK_TRIGGERED:
{
SERVICE_REQUEST_NETWORK_TRIGGERED:
{
Logger
::
smf_app
().
debug
(
Logger
::
smf_app
().
debug
(
...
@@ -527,6 +526,7 @@ void smf_app::handle_itti_msg(
...
@@ -527,6 +526,7 @@ void smf_app::handle_itti_msg(
}
}
}
}
}
break
;
}
break
;
default:
{
default:
{
Logger
::
smf_app
().
warn
(
"Unknown procedure type %d"
,
m
.
procedure_type
);
Logger
::
smf_app
().
warn
(
"Unknown procedure type %d"
,
m
.
procedure_type
);
}
}
...
@@ -658,28 +658,8 @@ void smf_app::handle_pdu_session_create_sm_context_request(
...
@@ -658,28 +658,8 @@ void smf_app::handle_pdu_session_create_sm_context_request(
return
;
return
;
}
}
// Fill the mandatory IEs
// Get necessary info from NAS
smreq
->
req
.
set_epd
(
decoded_nas_msg
.
header
.
extended_protocol_discriminator
);
xgpp_conv
::
sm_context_request_from_nas
(
decoded_nas_msg
,
smreq
->
req
);
pdu_session_id_t
pdu_session_id
=
decoded_nas_msg
.
plain
.
sm
.
header
.
pdu_session_identity
;
procedure_transaction_id_t
pti
=
{
.
procedure_transaction_id
=
decoded_nas_msg
.
plain
.
sm
.
header
.
procedure_transaction_identity
};
smreq
->
req
.
set_message_type
(
decoded_nas_msg
.
plain
.
sm
.
header
.
message_type
);
// TODO: Integrity protection maximum data rate (Mandatory)
// PDU session type (Optional)
if
(
decoded_nas_msg
.
plain
.
sm
.
header
.
message_type
==
PDU_SESSION_ESTABLISHMENT_REQUEST
)
{
Logger
::
smf_app
().
debug
(
"PDU Session Type %d"
,
decoded_nas_msg
.
plain
.
sm
.
pdu_session_establishment_request
.
_pdusessiontype
.
pdu_session_type_value
);
pdu_session_type
.
pdu_session_type
=
decoded_nas_msg
.
plain
.
sm
.
pdu_session_establishment_request
.
_pdusessiontype
.
pdu_session_type_value
;
}
smreq
->
req
.
set_pdu_session_type
(
pdu_session_type
.
pdu_session_type
);
// TODO: Support IPv4 only for now
// TODO: Support IPv4 only for now
if
(
pdu_session_type
.
pdu_session_type
==
PDU_SESSION_TYPE_E_IPV6
)
{
if
(
pdu_session_type
.
pdu_session_type
==
PDU_SESSION_TYPE_E_IPV6
)
{
...
@@ -707,55 +687,22 @@ void smf_app::handle_pdu_session_create_sm_context_request(
...
@@ -707,55 +687,22 @@ void smf_app::handle_pdu_session_create_sm_context_request(
return
;
return
;
}
}
// TODO: SSCMode
// Get SUPI, SNSSAI
// TODO: store UE 5GSM Capability
// TODO: MaximumNumberOfSupportedPacketFilters
// TODO: AlwaysonPDUSessionRequested
// TODO: SMPDUDNRequestContainer
// TODO: ExtendedProtocolConfigurationOptions
Logger
::
smf_app
().
debug
(
"pco ext %d, spare %d, configuration protocol %d,number_ids %d"
,
decoded_nas_msg
.
plain
.
sm
.
pdu_session_establishment_request
.
extendedprotocolconfigurationoptions
.
ext
,
decoded_nas_msg
.
plain
.
sm
.
pdu_session_establishment_request
.
extendedprotocolconfigurationoptions
.
spare
,
decoded_nas_msg
.
plain
.
sm
.
pdu_session_establishment_request
.
extendedprotocolconfigurationoptions
.
configuration_protocol
,
decoded_nas_msg
.
plain
.
sm
.
pdu_session_establishment_request
.
extendedprotocolconfigurationoptions
.
num_protocol_or_container_id
);
// if (decoded_nas_msg.plain.sm.pdu_session_establishment_request
// .extendedprotocolconfigurationoptions.num_protocol_or_container_id
// >
// 0) {
protocol_configuration_options_t
pco
=
{};
xgpp_conv
::
pco_nas_to_core
(
decoded_nas_msg
.
plain
.
sm
.
pdu_session_establishment_request
.
extendedprotocolconfigurationoptions
,
pco
);
smreq
->
req
.
set_epco
(
pco
);
// }
// Get necessary information
supi_t
supi
=
smreq
->
req
.
get_supi
();
supi_t
supi
=
smreq
->
req
.
get_supi
();
std
::
string
supi_prefix
=
smreq
->
req
.
get_supi_prefix
();
std
::
string
supi_prefix
=
smreq
->
req
.
get_supi_prefix
();
supi64_t
supi64
=
smf_supi_to_u64
(
supi
);
supi64_t
supi64
=
smf_supi_to_u64
(
supi
);
std
::
string
dnn
=
smreq
->
req
.
get_dnn
();
snssai_t
snssai
=
smreq
->
req
.
get_snssai
();
snssai_t
snssai
=
smreq
->
req
.
get_snssai
();
uint8_t
message_type
=
decoded_nas_msg
.
plain
.
sm
.
header
.
message_type
;
std
::
string
request_type
=
smreq
->
req
.
get_request_type
();
Logger
::
smf_app
().
info
(
Logger
::
smf_app
().
info
(
"Handle a PDU Session Create SM Context Request message from AMF, "
"Handle a PDU Session Create SM Context Request message from AMF, "
"SUPI "
SUPI_64_FMT
", DNN %s, SNSSAI SST %d, SD %s"
,
"SUPI "
SUPI_64_FMT
", SNSSAI SST %d, SD %s"
,
supi64
,
dnn
.
c_str
(),
snssai
.
sST
,
snssai
.
sD
.
c_str
());
supi64
,
snssai
.
sST
,
snssai
.
sD
.
c_str
());
// If no DNN information from UE, set to default value
if
(
dnn
.
length
()
==
0
)
{
dnn
==
smf_cfg
.
get_default_dnn
();
}
// Step 2. Verify Procedure transaction id, pdu session id, message type,
// Step 2. Verify Procedure transaction id, pdu session id, message type,
// request type, etc. check pti
// request type, etc.
// Check PTI
procedure_transaction_id_t
pti
=
{
.
procedure_transaction_id
=
decoded_nas_msg
.
plain
.
sm
.
header
.
procedure_transaction_identity
};
if
((
pti
.
procedure_transaction_id
==
if
((
pti
.
procedure_transaction_id
==
PROCEDURE_TRANSACTION_IDENTITY_UNASSIGNED
)
||
PROCEDURE_TRANSACTION_IDENTITY_UNASSIGNED
)
||
(
pti
.
procedure_transaction_id
>
PROCEDURE_TRANSACTION_IDENTITY_LAST
))
{
(
pti
.
procedure_transaction_id
>
PROCEDURE_TRANSACTION_IDENTITY_LAST
))
{
...
@@ -779,9 +726,10 @@ void smf_app::handle_pdu_session_create_sm_context_request(
...
@@ -779,9 +726,10 @@ void smf_app::handle_pdu_session_create_sm_context_request(
}
}
return
;
return
;
}
}
smreq
->
req
.
set_pti
(
pti
);
// check pdu session id
// Check pdu session id
pdu_session_id_t
pdu_session_id
=
decoded_nas_msg
.
plain
.
sm
.
header
.
pdu_session_identity
;
if
((
pdu_session_id
==
PDU_SESSION_IDENTITY_UNASSIGNED
)
||
if
((
pdu_session_id
==
PDU_SESSION_IDENTITY_UNASSIGNED
)
||
(
pdu_session_id
>
PDU_SESSION_IDENTITY_LAST
))
{
(
pdu_session_id
>
PDU_SESSION_IDENTITY_LAST
))
{
Logger
::
smf_app
().
warn
(
"Invalid PDU Session ID value (%d)"
,
pdu_session_id
);
Logger
::
smf_app
().
warn
(
"Invalid PDU Session ID value (%d)"
,
pdu_session_id
);
...
@@ -793,7 +741,8 @@ void smf_app::handle_pdu_session_create_sm_context_request(
...
@@ -793,7 +741,8 @@ void smf_app::handle_pdu_session_create_sm_context_request(
return
;
return
;
}
}
// check message type
// Check message type
uint8_t
message_type
=
decoded_nas_msg
.
plain
.
sm
.
header
.
message_type
;
if
(
message_type
!=
PDU_SESSION_ESTABLISHMENT_REQUEST
)
{
if
(
message_type
!=
PDU_SESSION_ESTABLISHMENT_REQUEST
)
{
Logger
::
smf_app
().
warn
(
Logger
::
smf_app
().
warn
(
"Invalid message type (message type = %d)"
,
message_type
);
"Invalid message type (message type = %d)"
,
message_type
);
...
@@ -819,7 +768,8 @@ void smf_app::handle_pdu_session_create_sm_context_request(
...
@@ -819,7 +768,8 @@ void smf_app::handle_pdu_session_create_sm_context_request(
return
;
return
;
}
}
// check request type
// Check request type
std
::
string
request_type
=
smreq
->
req
.
get_request_type
();
if
(
request_type
.
compare
(
"INITIAL_REQUEST"
)
!=
0
)
{
if
(
request_type
.
compare
(
"INITIAL_REQUEST"
)
!=
0
)
{
Logger
::
smf_app
().
warn
(
Logger
::
smf_app
().
warn
(
"Invalid request type (request type = %s)"
,
request_type
.
c_str
());
"Invalid request type (request type = %s)"
,
request_type
.
c_str
());
...
@@ -829,6 +779,12 @@ void smf_app::handle_pdu_session_create_sm_context_request(
...
@@ -829,6 +779,12 @@ void smf_app::handle_pdu_session_create_sm_context_request(
return
;
return
;
}
}
// If no DNN information from UE, set to default value
std
::
string
dnn
=
smreq
->
req
.
get_dnn
();
if
(
dnn
.
length
()
==
0
)
{
dnn
==
smf_cfg
.
get_default_dnn
();
}
// TODO: For the moment, not support PDU session authentication and
// TODO: For the moment, not support PDU session authentication and
// authorization by the external DN
// authorization by the external DN
...
@@ -1075,7 +1031,6 @@ void smf_app::handle_pdu_session_update_sm_context_request(
...
@@ -1075,7 +1031,6 @@ void smf_app::handle_pdu_session_update_sm_context_request(
//------------------------------------------------------------------------------
//------------------------------------------------------------------------------
void
smf_app
::
handle_pdu_session_release_sm_context_request
(
void
smf_app
::
handle_pdu_session_release_sm_context_request
(
std
::
shared_ptr
<
itti_n11_release_sm_context_request
>
smreq
)
{
std
::
shared_ptr
<
itti_n11_release_sm_context_request
>
smreq
)
{
// handle PDU Session Release SM Context Request
Logger
::
smf_app
().
info
(
Logger
::
smf_app
().
info
(
"Handle a PDU Session Release SM Context Request from an AMF"
);
"Handle a PDU Session Release SM Context Request from an AMF"
);
...
...
src/smf_app/smf_context.cpp
View file @
c3107524
...
@@ -46,6 +46,7 @@
...
@@ -46,6 +46,7 @@
#include "smf_paa_dynamic.hpp"
#include "smf_paa_dynamic.hpp"
#include "smf_pfcp_association.hpp"
#include "smf_pfcp_association.hpp"
#include "smf_procedure.hpp"
#include "smf_procedure.hpp"
#include "3gpp_conversions.hpp"
extern
"C"
{
extern
"C"
{
#include "Ngap_AssociatedQosFlowItem.h"
#include "Ngap_AssociatedQosFlowItem.h"
...
@@ -1199,9 +1200,9 @@ void smf_context::handle_pdu_session_create_sm_context_request(
...
@@ -1199,9 +1200,9 @@ void smf_context::handle_pdu_session_create_sm_context_request(
// Step 1. get necessary information
// Step 1. get necessary information
std
::
string
dnn
=
smreq
->
req
.
get_dnn
();
std
::
string
dnn
=
smreq
->
req
.
get_dnn
();
snssai_t
snssai
=
smreq
->
req
.
get_snssai
();
snssai_t
snssai
=
smreq
->
req
.
get_snssai
();
std
::
string
request_type
=
smreq
->
req
.
get_request_type
();
//
std::string request_type = smreq->req.get_request_type();
supi_t
supi
=
smreq
->
req
.
get_supi
();
//
supi_t supi = smreq->req.get_supi();
supi64_t
supi64
=
smf_supi_to_u64
(
supi
);
supi64_t
supi64
=
smf_supi_to_u64
(
smreq
->
req
.
get_supi
()
);
uint32_t
pdu_session_id
=
smreq
->
req
.
get_pdu_session_id
();
uint32_t
pdu_session_id
=
smreq
->
req
.
get_pdu_session_id
();
// Step 2. check the validity of the UE request, if valid send PDU Session
// Step 2. check the validity of the UE request, if valid send PDU Session
...
@@ -1220,7 +1221,6 @@ void smf_context::handle_pdu_session_create_sm_context_request(
...
@@ -1220,7 +1221,6 @@ void smf_context::handle_pdu_session_create_sm_context_request(
http_status_code_e
::
HTTP_STATUS_CODE_401_UNAUTHORIZED
,
http_status_code_e
::
HTTP_STATUS_CODE_401_UNAUTHORIZED
,
PDU_SESSION_APPLICATION_ERROR_SUBSCRIPTION_DENIED
,
n1_sm_msg_hex
,
PDU_SESSION_APPLICATION_ERROR_SUBSCRIPTION_DENIED
,
n1_sm_msg_hex
,
smreq
->
pid
);
smreq
->
pid
);
}
else
{
}
else
{
smf_app_inst
->
trigger_http_response
(
smf_app_inst
->
trigger_http_response
(
http_status_code_e
::
HTTP_STATUS_CODE_500_INTERNAL_SERVER_ERROR
,
http_status_code_e
::
HTTP_STATUS_CODE_500_INTERNAL_SERVER_ERROR
,
...
@@ -1240,6 +1240,11 @@ void smf_context::handle_pdu_session_create_sm_context_request(
...
@@ -1240,6 +1240,11 @@ void smf_context::handle_pdu_session_create_sm_context_request(
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_pending
=
std
::
shared_ptr
<
itti_n11_create_sm_context_response
>
(
sm_context_resp
);
std
::
shared_ptr
<
itti_n11_create_sm_context_response
>
(
sm_context_resp
);
// Assign necessary information for the response
xgpp_conv
::
create_sm_context_response_from_ct_request
(
smreq
,
sm_context_resp_pending
);
/*
sm_context_resp->http_version = smreq->http_version;
sm_context_resp->http_version = smreq->http_version;
sm_context_resp->res.set_http_code(
sm_context_resp->res.set_http_code(
http_status_code_e::HTTP_STATUS_CODE_200_OK);
http_status_code_e::HTTP_STATUS_CODE_200_OK);
...
@@ -1252,6 +1257,7 @@ void smf_context::handle_pdu_session_create_sm_context_request(
...
@@ -1252,6 +1257,7 @@ void smf_context::handle_pdu_session_create_sm_context_request(
sm_context_resp->res.set_pdu_session_type(smreq->req.get_pdu_session_type());
sm_context_resp->res.set_pdu_session_type(smreq->req.get_pdu_session_type());
sm_context_resp->res.set_pti(smreq->req.get_pti());
sm_context_resp->res.set_pti(smreq->req.get_pti());
sm_context_resp->set_scid(smreq->scid);
sm_context_resp->set_scid(smreq->scid);
*/
// Step 3. find pdu_session
// Step 3. find pdu_session
std
::
shared_ptr
<
dnn_context
>
sd
=
{};
std
::
shared_ptr
<
dnn_context
>
sd
=
{};
...
@@ -1298,12 +1304,6 @@ void smf_context::handle_pdu_session_create_sm_context_request(
...
@@ -1298,12 +1304,6 @@ void smf_context::handle_pdu_session_create_sm_context_request(
// rules for this PDU session from PCF For the moment, SMF uses the local
// rules for this PDU session from PCF For the moment, SMF uses the local
// policy (e.g., default QoS rule)
// policy (e.g., default QoS rule)
// address allocation based on PDN type
// IP Address pool is controlled by SMF
// Step 6. paa
bool
set_paa
=
false
;
paa_t
paa
=
{};
// Step 6. PCO
// Step 6. PCO
// section 6.2.4.2, TS 24.501
// section 6.2.4.2, TS 24.501
// If the UE wants to use DHCPv4 for IPv4 address assignment, it shall
// If the UE wants to use DHCPv4 for IPv4 address assignment, it shall
...
@@ -1324,7 +1324,10 @@ void smf_context::handle_pdu_session_create_sm_context_request(
...
@@ -1324,7 +1324,10 @@ void smf_context::handle_pdu_session_create_sm_context_request(
smf_app_inst
->
process_pco_request
(
pco_req
,
pco_resp
,
pco_ids
);
smf_app_inst
->
process_pco_request
(
pco_req
,
pco_resp
,
pco_ids
);
sm_context_resp_pending
->
res
.
set_epco
(
pco_resp
);
sm_context_resp_pending
->
res
.
set_epco
(
pco_resp
);
// Step 7. Address allocation based on PDN type
// Step 7. Address allocation based on PDN type, IP Address pool is controlled
// by SMF
bool
set_paa
=
false
;
paa_t
paa
=
{};
Logger
::
smf_app
().
debug
(
"UE Address Allocation"
);
Logger
::
smf_app
().
debug
(
"UE Address Allocation"
);
switch
(
sp
->
pdu_session_type
.
pdu_session_type
)
{
switch
(
sp
->
pdu_session_type
.
pdu_session_type
)
{
case
PDU_SESSION_TYPE_E_IPV4
:
{
case
PDU_SESSION_TYPE_E_IPV4
:
{
...
@@ -1490,7 +1493,7 @@ void smf_context::handle_pdu_session_create_sm_context_request(
...
@@ -1490,7 +1493,7 @@ void smf_context::handle_pdu_session_create_sm_context_request(
// for (SUPI, DNN, S-NSSAI)
// for (SUPI, DNN, S-NSSAI)
}
}
//
s
tep 10. if error when establishing the pdu session,
//
S
tep 10. if error when establishing the pdu session,
// send ITTI message to APP to trigger N1N2MessageTransfer towards AMFs (PDU
// send ITTI message to APP to trigger N1N2MessageTransfer towards AMFs (PDU
// Session Establishment Reject)
// Session Establishment Reject)
if
(
sm_context_resp
->
res
.
get_cause
()
!=
REQUEST_ACCEPTED
)
{
if
(
sm_context_resp
->
res
.
get_cause
()
!=
REQUEST_ACCEPTED
)
{
...
@@ -1513,7 +1516,6 @@ void smf_context::handle_pdu_session_create_sm_context_request(
...
@@ -1513,7 +1516,6 @@ void smf_context::handle_pdu_session_create_sm_context_request(
case
PDU_SESSION_TYPE_E_RESERVED
:
case
PDU_SESSION_TYPE_E_RESERVED
:
default:
;
default:
;
}
}
// sm_context_resp->res.clear_paa(); //TODO:
}
}
// clear the created context??
// clear the created context??
// TODO:
// TODO:
...
@@ -1612,7 +1614,7 @@ void smf_context::handle_pdu_session_update_sm_context_request(
...
@@ -1612,7 +1614,7 @@ void smf_context::handle_pdu_session_update_sm_context_request(
std
::
shared_ptr
<
itti_n11_update_sm_context_response
>
sm_context_resp_pending
=
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
::
shared_ptr
<
itti_n11_update_sm_context_response
>
(
n11_sm_context_resp
);
sm_context_resp_pending
->
res
.
set_http_code
(
/*
sm_context_resp_pending->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); // default status code
n11_sm_context_resp->res.set_supi(sm_context_req_msg.get_supi());
n11_sm_context_resp->res.set_supi(sm_context_req_msg.get_supi());
n11_sm_context_resp->res.set_supi_prefix(
n11_sm_context_resp->res.set_supi_prefix(
...
@@ -1622,9 +1624,12 @@ void smf_context::handle_pdu_session_update_sm_context_request(
...
@@ -1622,9 +1624,12 @@ void smf_context::handle_pdu_session_update_sm_context_request(
sm_context_req_msg.get_pdu_session_id());
sm_context_req_msg.get_pdu_session_id());
n11_sm_context_resp->res.set_snssai(sm_context_req_msg.get_snssai());
n11_sm_context_resp->res.set_snssai(sm_context_req_msg.get_snssai());
n11_sm_context_resp->res.set_dnn(sm_context_req_msg.get_dnn());
n11_sm_context_resp->res.set_dnn(sm_context_req_msg.get_dnn());
*/
n11_sm_context_resp
->
res
.
set_pdu_session_type
(
n11_sm_context_resp
->
res
.
set_pdu_session_type
(
sp
.
get
()
->
get_pdu_session_type
().
pdu_session_type
);
sp
.
get
()
->
get_pdu_session_type
().
pdu_session_type
);
xgpp_conv
::
update_sm_context_response_from_ct_request
(
smreq
,
sm_context_resp_pending
);
// Step 2.1. Decode N1 (if content is available)
// Step 2.1. Decode N1 (if content is available)
if
(
sm_context_req_msg
.
n1_sm_msg_is_set
())
{
if
(
sm_context_req_msg
.
n1_sm_msg_is_set
())
{
nas_message_t
decoded_nas_msg
=
{};
nas_message_t
decoded_nas_msg
=
{};
...
...
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