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-Simple
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
CommunityXG
OpenXG-SMF-Simple
Commits
58b1f280
Commit
58b1f280
authored
Jan 23, 2021
by
Tien-Thinh Nguyen
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add functions to convert from OpenAPI to smf internal type
parent
e1c9d4df
Changes
7
Show whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
292 additions
and
156 deletions
+292
-156
src/api-server/api/SMContextsCollectionApi.cpp
src/api-server/api/SMContextsCollectionApi.cpp
+0
-2
src/api-server/impl/IndividualSMContextApiImpl.cpp
src/api-server/impl/IndividualSMContextApiImpl.cpp
+14
-93
src/api-server/impl/NFStatusNotifyApiImpl.cpp
src/api-server/impl/NFStatusNotifyApiImpl.cpp
+4
-14
src/api-server/impl/SMContextsCollectionApiImpl.cpp
src/api-server/impl/SMContextsCollectionApiImpl.cpp
+3
-2
src/api-server/impl/SubscriptionsCollectionApiImpl.cpp
src/api-server/impl/SubscriptionsCollectionApiImpl.cpp
+7
-41
src/common/utils/3gpp_conversions.cpp
src/common/utils/3gpp_conversions.cpp
+173
-2
src/common/utils/3gpp_conversions.hpp
src/common/utils/3gpp_conversions.hpp
+91
-2
No files found.
src/api-server/api/SMContextsCollectionApi.cpp
View file @
58b1f280
...
...
@@ -117,13 +117,11 @@ void SMContextsCollectionApi::post_sm_contexts_handler(
this
->
post_sm_contexts
(
smContextMessage
,
response
);
}
catch
(
nlohmann
::
detail
::
exception
&
e
)
{
// send a 400 error
Logger
::
smf_api_server
().
warn
(
"Can not parse the json data (error: %s)!"
,
e
.
what
());
response
.
send
(
Pistache
::
Http
::
Code
::
Bad_Request
,
e
.
what
());
return
;
}
catch
(
std
::
exception
&
e
)
{
// send a 500 error
Logger
::
smf_api_server
().
warn
(
"Error: %s!"
,
e
.
what
());
response
.
send
(
Pistache
::
Http
::
Code
::
Internal_Server_Error
,
e
.
what
());
return
;
...
...
src/api-server/impl/IndividualSMContextApiImpl.cpp
View file @
58b1f280
...
...
@@ -35,6 +35,7 @@
#include "IndividualSMContextApiImpl.h"
#include <nghttp2/asio_http2_server.h>
#include "mime_parser.hpp"
#include "3gpp_conversions.hpp"
namespace
oai
{
namespace
smf_server
{
...
...
@@ -58,31 +59,11 @@ void IndividualSMContextApiImpl::release_sm_context(
"Received a PDUSession_ReleaseSMContext Request from AMF."
);
smf
::
pdu_session_release_sm_context_request
sm_context_req_msg
=
{};
SmContextReleaseData
smContextReleaseData
=
smContextReleaseMessage
.
getJsonData
();
if
(
smContextReleaseData
.
n2SmInfoIsSet
())
{
// N2 SM (for Session establishment)
std
::
string
n2_sm_information
=
smContextReleaseMessage
.
getBinaryDataN2SmInformation
();
Logger
::
smf_api_server
().
debug
(
"N2 SM Information %s"
,
n2_sm_information
.
c_str
());
std
::
string
n2_sm_info_type
=
smContextReleaseData
.
getN2SmInfoType
();
sm_context_req_msg
.
set_n2_sm_information
(
n2_sm_information
);
sm_context_req_msg
.
set_n2_sm_info_type
(
n2_sm_info_type
);
}
// Step 2. TODO: initialize necessary values for sm context req from
// smContextReleaseData
// cause:
// ngApCause:
// 5gMmCauseValue:
// ueLocation:
// ueTimeZone:
// addUeLocation:
// vsmfReleaseOnly:
// ismfReleaseOnly:
// convert from SmContextReleaseMessage to
// pdu_session_release_sm_context_request
xgpp_conv
::
sm_context_release_from_openapi
(
smContextReleaseMessage
,
sm_context_req_msg
);
boost
::
shared_ptr
<
boost
::
promise
<
smf
::
pdu_session_release_sm_context_response
>
>
...
...
@@ -96,7 +77,7 @@ void IndividualSMContextApiImpl::release_sm_context(
Logger
::
smf_api_server
().
debug
(
"Promise ID generated %d"
,
promise_id
);
m_smf_app
->
add_promise
(
promise_id
,
p
);
//
Step 3.
Handle the itti_n11_release_sm_context_request message in smf_app
// Handle the itti_n11_release_sm_context_request message in smf_app
std
::
shared_ptr
<
itti_n11_release_sm_context_request
>
itti_msg
=
std
::
make_shared
<
itti_n11_release_sm_context_request
>
(
TASK_SMF_N11
,
TASK_SMF_APP
,
promise_id
,
smContextRef
);
...
...
@@ -104,11 +85,11 @@ void IndividualSMContextApiImpl::release_sm_context(
itti_msg
->
http_version
=
1
;
m_smf_app
->
handle_pdu_session_release_sm_context_request
(
itti_msg
);
//
w
ait for the result from APP and send reply to AMF
//
W
ait for the result from APP and send reply to AMF
smf
::
pdu_session_release_sm_context_response
sm_context_response
=
f
.
get
();
Logger
::
smf_api_server
().
debug
(
"Got result for promise ID %d"
,
promise_id
);
// TODO:
p
rocess the response
// TODO:
P
rocess the response
response
.
send
(
Pistache
::
Http
::
Code
(
sm_context_response
.
get_http_code
()));
}
...
...
@@ -131,72 +112,12 @@ void IndividualSMContextApiImpl::update_sm_context(
"Received a PDUSession_UpdateSMContext Request from AMF."
);
smf
::
pdu_session_update_sm_context_request
sm_context_req_msg
=
{};
SmContextUpdateData
smContextUpdateData
=
smContextUpdateMessage
.
getJsonData
();
if
(
smContextUpdateData
.
n2SmInfoIsSet
())
{
// N2 SM (for Session establishment)
std
::
string
n2_sm_information
=
smContextUpdateMessage
.
getBinaryDataN2SmInformation
();
Logger
::
smf_api_server
().
debug
(
"N2 SM Information %s"
,
n2_sm_information
.
c_str
());
std
::
string
n2_sm_info_type
=
smContextUpdateData
.
getN2SmInfoType
();
sm_context_req_msg
.
set_n2_sm_information
(
n2_sm_information
);
sm_context_req_msg
.
set_n2_sm_info_type
(
n2_sm_info_type
);
}
if
(
smContextUpdateData
.
n1SmMsgIsSet
())
{
// N1 SM (for session modification)
std
::
string
n1_sm_message
=
smContextUpdateMessage
.
getBinaryDataN1SmMessage
();
Logger
::
smf_api_server
().
debug
(
"N1 SM message %s"
,
n1_sm_message
.
c_str
());
sm_context_req_msg
.
set_n1_sm_message
(
n1_sm_message
);
}
// Step 2. TODO: initialize necessary values for sm context req from
// smContextUpdateData
/* UE-initiated Service Request Operation, section 4.2.3.2@3GPP TS 23.502 */
// Step 4: PDU Session IDs, Operation Type, UE location Info, Access Type, RAT
// Type, UE presence in LADN service area, Indication of Access Type can be
// changed PDU Session IDs UpCnxState, for activation of user plane
// (see 5.2.2.3.2.2@3GPP TS 29.502, step 1)
if
(
smContextUpdateData
.
upCnxStateIsSet
())
sm_context_req_msg
.
set_upCnx_state
(
smContextUpdateData
.
getUpCnxState
());
// Access Type (step 1 and 2)
if
(
smContextUpdateData
.
anTypeIsSet
())
sm_context_req_msg
.
set_an_type
(
smContextUpdateData
.
getAnType
());
// RAT Type (step 1 and 2)
if
(
smContextUpdateData
.
ratTypeIsSet
())
sm_context_req_msg
.
set_rat_type
(
smContextUpdateData
.
getRatType
());
// TODO:
// UE presence in LADN service area
// UE location information
// Indication of Access Type can be changed
// if (smContextUpdateData.anTypeCanBeChangedIsSet())
// sm_context_req_msg.set_access_type_can_be_changed(smContextUpdateData.isAnTypeCanBeChanged());
// Step 15: N2 SM Info (AN Tunnel Info, List of accepted QoS Flow, List of
// rejected Qos Flows, PDU Session ID), RAT Type, Access Type
/* UE-initiated PDU Session Establishment Operation - section 4.3.2.2.1@3GPP
* TS 23.502 */
// TODO: Existing PDU session, step 3, SUPI, DNN, S-NSSAIs, SM Context ID, AMF
// ID, Request Type, N1 SM Container (PDU Session Establishment Request), User
// location, Access Type, RAT Type, PEI step 15. (SM Context ID -> SCID, N2
// SM, Request Type)(Initial Request)
// TODO: verify why Request Type is not define in smContextUpdateData
/* AMF-initiated with a release indication to request the release of the PDU
* Session (step 3.d, section 4.3.4.2@3GPP TS 23.502)*/
if
(
smContextUpdateData
.
releaseIsSet
())
{
sm_context_req_msg
.
set_release
(
smContextUpdateData
.
isRelease
());
}
// convert from SmContextUpdateMessage to
// pdu_session_update_sm_context_request
xgpp_conv
::
sm_context_update_from_openapi
(
smContextUpdateMessage
,
sm_context_req_msg
);
/* PDU Session Modification (SM Context ID -> SCID, N1/N2),
* section 4.3.3.2@3GPP TS 23.502: */
// step 1.a,UE-initiated: SM Context ID + N1 (PDU Session Modification
// Request) step 1.e (AN initiated modification): SM Context ID, N2 SM
// information (QFI, User location Information and an indication that the QoS
// Flow is released) step 7a, SM Context ID, N2 SM information, UE location
// information Step 11, SM Context ID, N1 SM (PDU Session Modification Command
// ACK), User location
boost
::
shared_ptr
<
boost
::
promise
<
smf
::
pdu_session_update_sm_context_response
>
>
p
=
boost
::
make_shared
<
...
...
@@ -209,7 +130,7 @@ void IndividualSMContextApiImpl::update_sm_context(
Logger
::
smf_api_server
().
debug
(
"Promise ID generated %d"
,
promise_id
);
m_smf_app
->
add_promise
(
promise_id
,
p
);
//
Step 3.
Handle the itti_n11_update_sm_context_request message in smf_app
// Handle the itti_n11_update_sm_context_request message in smf_app
std
::
shared_ptr
<
itti_n11_update_sm_context_request
>
itti_msg
=
std
::
make_shared
<
itti_n11_update_sm_context_request
>
(
TASK_SMF_N11
,
TASK_SMF_APP
,
promise_id
,
smContextRef
);
...
...
@@ -217,7 +138,7 @@ void IndividualSMContextApiImpl::update_sm_context(
itti_msg
->
http_version
=
1
;
m_smf_app
->
handle_pdu_session_update_sm_context_request
(
itti_msg
);
//
w
ait for the result from APP and send reply to AMF
//
W
ait for the result from APP and send reply to AMF
smf
::
pdu_session_update_sm_context_response
sm_context_response
=
f
.
get
();
Logger
::
smf_api_server
().
debug
(
"Got result for promise ID %d"
,
promise_id
);
...
...
src/api-server/impl/NFStatusNotifyApiImpl.cpp
View file @
58b1f280
...
...
@@ -38,6 +38,7 @@
#include "smf_msg.hpp"
#include "itti_msg_sbi.hpp"
#include "smf_config.hpp"
#include "3gpp_conversions.hpp"
extern
smf
::
smf_config
smf_cfg
;
...
...
@@ -59,21 +60,10 @@ void NFStatusNotifyApiImpl::receive_nf_status_notification(
"NFStatusNotifyApiImpl, received a NF status notification..."
);
smf
::
data_notification_msg
notification_msg
=
{};
notification_msg
.
set_notification_event_type
(
notificationData
.
getEvent
());
notification_msg
.
set_nf_instance_uri
(
notificationData
.
getNfInstanceUri
()
);
// convert from NotificationData to data_notification_msg
xgpp_conv
::
data_notification_from_openapi
(
notificationData
,
notification_msg
);
std
::
shared_ptr
<
smf
::
nf_profile
>
p
=
{};
// Only support UPF for now
if
(
notificationData
.
getNfProfile
().
getNfType
()
==
"UPF"
)
p
=
std
::
make_shared
<
smf
::
upf_profile
>
();
nlohmann
::
json
pj
=
{};
to_json
(
pj
,
notificationData
.
getNfProfile
());
p
.
get
()
->
from_json
(
pj
);
notification_msg
.
set_profile
(
p
);
// Step 2. Handle the message in smf_app
// Handle the message in smf_app
std
::
shared_ptr
<
itti_sbi_notification_data
>
itti_msg
=
std
::
make_shared
<
itti_sbi_notification_data
>
(
TASK_SMF_N11
,
TASK_SMF_APP
);
itti_msg
->
notification_msg
=
notification_msg
;
...
...
src/api-server/impl/SMContextsCollectionApiImpl.cpp
View file @
58b1f280
...
...
@@ -68,10 +68,11 @@ void SMContextsCollectionApiImpl::post_sm_contexts(
"necessary information"
);
smf
::
pdu_session_create_sm_context_request
sm_context_req_msg
=
{};
xgpp_conv
::
sm_context_create_data_from_openapi
(
// convert from SmContextMessage to pdu_session_create_sm_context_request
xgpp_conv
::
sm_context_create_from_openapi
(
smContextMessage
,
sm_context_req_msg
);
// Set
api r
oot to be used as location header in HTTP response
// Set
API R
oot to be used as location header in HTTP response
sm_context_req_msg
.
set_api_root
(
m_address
+
base
+
smf_cfg
.
sbi_api_version
+
NSMF_PDU_SESSION_SM_CONTEXT_CREATE_URL
);
...
...
src/api-server/impl/SubscriptionsCollectionApiImpl.cpp
View file @
58b1f280
...
...
@@ -39,6 +39,7 @@
#include "3gpp_29.508.h"
#include "itti_msg_sbi.hpp"
#include "smf_config.hpp"
#include "3gpp_conversions.hpp"
extern
smf
::
smf_config
smf_cfg
;
...
...
@@ -61,51 +62,16 @@ void SubscriptionsCollectionApiImpl::create_individual_subcription(
Logger
::
smf_api_server
().
info
(
"SubscriptionsCollectionApiImpl::create_individual_subcription..."
);
//
Step1.
Create a message and store the necessary information
// Create a message and store the necessary information
Logger
::
smf_api_server
().
debug
(
"Create a Event Exposure message and store the necessary information"
);
smf
::
event_exposure_msg
event_exposure
=
{};
// Supi
if
(
nsmfEventExposure
.
supiIsSet
())
{
supi_t
supi
=
{.
length
=
0
};
std
::
size_t
pos
=
nsmfEventExposure
.
getSupi
().
find
(
"-"
);
std
::
string
supi_str
=
nsmfEventExposure
.
getSupi
().
substr
(
pos
+
1
);
std
::
string
supi_prefix
=
nsmfEventExposure
.
getSupi
().
substr
(
0
,
pos
);
smf_string_to_supi
(
&
supi
,
supi_str
.
c_str
());
// Convert from NsmfEventExposure to event_exposure_msg
xgpp_conv
::
smf_event_exposure_notification_from_openapi
(
nsmfEventExposure
,
event_exposure
);
event_exposure
.
set_supi
(
supi
);
event_exposure
.
set_supi_prefix
(
supi_prefix
);
Logger
::
smf_api_server
().
debug
(
"SUPI %s, SUPI Prefix %s, IMSI %s"
,
nsmfEventExposure
.
getSupi
().
c_str
(),
supi_prefix
.
c_str
(),
supi_str
.
c_str
());
}
// PDU session ID
if
(
nsmfEventExposure
.
pduSeIdIsSet
())
{
Logger
::
smf_api_server
().
debug
(
"PDU Session ID %d"
,
nsmfEventExposure
.
getPduSeId
());
event_exposure
.
set_pdu_session_id
(
nsmfEventExposure
.
getPduSeId
());
}
event_exposure
.
set_notif_id
(
nsmfEventExposure
.
getNotifId
());
// NotifId
event_exposure
.
set_notif_uri
(
nsmfEventExposure
.
getNotifUri
());
// NotifUri
// EventSubscription: TODO
event_subscription_t
event_subscription
=
{};
event_subscription
.
smf_event
=
smf_event_t
::
SMF_EVENT_PDU_SES_REL
;
std
::
vector
<
event_subscription_t
>
event_subscriptions
=
{};
event_subscriptions
.
push_back
(
event_subscription
);
event_exposure
.
set_event_subs
(
event_subscriptions
);
// std::vector<EventSubscription> eventSubscriptions;
// for (auto it: nsmfEventExposure.getEventSubs()){
// event_subscription.smf_event = it.getEvent();
// getDnaiChgType
// event_subscriptions.push_back(event_subscription);
//}
// Step 2. Handle the message in smf_app
// Handle the message in smf_app
std
::
shared_ptr
<
itti_sbi_event_exposure_request
>
itti_msg
=
std
::
make_shared
<
itti_sbi_event_exposure_request
>
(
TASK_SMF_N11
,
TASK_SMF_APP
);
...
...
@@ -114,7 +80,7 @@ void SubscriptionsCollectionApiImpl::create_individual_subcription(
evsub_id_t
sub_id
=
m_smf_app
->
handle_event_exposure_subscription
(
itti_msg
);
//
s
end response
//
S
end response
nlohmann
::
json
json_data
=
{};
to_json
(
json_data
,
nsmfEventExposure
);
...
...
src/common/utils/3gpp_conversions.cpp
View file @
58b1f280
...
...
@@ -33,6 +33,8 @@
#include <ctype.h>
#include <inttypes.h>
#include "SmContextCreateData.h"
#include "SmContextUpdateData.h"
#include "SmContextReleaseData.h"
//------------------------------------------------------------------------------
void
xgpp_conv
::
paa_to_pfcp_ue_ip_address
(
...
...
@@ -145,12 +147,12 @@ void xgpp_conv::pco_core_to_nas(
}
}
void
xgpp_conv
::
sm_context_create_
data_
from_openapi
(
void
xgpp_conv
::
sm_context_create_from_openapi
(
const
oai
::
smf_server
::
model
::
SmContextMessage
&
scd
,
smf
::
pdu_session_create_sm_context_request
&
pcr
)
{
Logger
::
smf_app
().
debug
(
"Convert SmContextMessage (OpenAPI) to "
"
pdu_session_create_sm_context_reques
t"
);
"
PDUSession_CreateSMContex
t"
);
oai
::
smf_server
::
model
::
SmContextCreateData
context_data
=
scd
.
getJsonData
();
...
...
@@ -228,3 +230,172 @@ void xgpp_conv::sm_context_create_data_from_openapi(
// SM PDU DN request container (Optional)
// Extended protocol configuration options (Optional) e.g, FOR DHCP
}
void
xgpp_conv
::
sm_context_update_from_openapi
(
const
oai
::
smf_server
::
model
::
SmContextUpdateMessage
&
scu
,
smf
::
pdu_session_update_sm_context_request
&
pur
)
{
Logger
::
smf_app
().
debug
(
"Convert SmContextUpdateMessage (OpenAPI) to "
"PDUSession_UpdateSMContext"
);
oai
::
smf_server
::
model
::
SmContextUpdateData
context_data
=
scu
.
getJsonData
();
if
(
context_data
.
n2SmInfoIsSet
())
{
// N2 SM (for Session establishment)
std
::
string
n2_sm_information
=
scu
.
getBinaryDataN2SmInformation
();
Logger
::
smf_app
().
debug
(
"N2 SM Information %s"
,
n2_sm_information
.
c_str
());
pur
.
set_n2_sm_information
(
n2_sm_information
);
pur
.
set_n2_sm_info_type
(
context_data
.
getN2SmInfoType
());
}
if
(
context_data
.
n1SmMsgIsSet
())
{
// N1 SM (for session modification)
std
::
string
n1_sm_message
=
scu
.
getBinaryDataN1SmMessage
();
Logger
::
smf_app
().
debug
(
"N1 SM message %s"
,
n1_sm_message
.
c_str
());
pur
.
set_n1_sm_message
(
n1_sm_message
);
}
/* UE-initiated Service Request Operation, section 4.2.3.2@3GPP TS 23.502 */
// PDU Session IDs, Operation Type, UE location Info, Access Type, RAT
// Type, UE presence in LADN service area, Indication of Access Type can be
// changed PDU Session IDs UpCnxState, for activation of user plane
// (see 5.2.2.3.2.2@3GPP TS 29.502, step 1)
if
(
context_data
.
upCnxStateIsSet
())
pur
.
set_upCnx_state
(
context_data
.
getUpCnxState
());
// Access Type (step 1 and 2)
if
(
context_data
.
anTypeIsSet
())
pur
.
set_an_type
(
context_data
.
getAnType
());
// RAT Type (step 1 and 2)
if
(
context_data
.
ratTypeIsSet
())
pur
.
set_rat_type
(
context_data
.
getRatType
());
// TODO:
// UE presence in LADN service area
// UE location information
// Indication of Access Type can be changed
// if (context_data.anTypeCanBeChangedIsSet())
// pur.set_access_type_can_be_changed(context_data.isAnTypeCanBeChanged());
// Step 15: N2 SM Info (AN Tunnel Info, List of accepted QoS Flow, List of
// rejected Qos Flows, PDU Session ID), RAT Type, Access Type
/* UE-initiated PDU Session Establishment Operation - section 4.3.2.2.1@3GPP
* TS 23.502 */
// TODO: Existing PDU session, step 3, SUPI, DNN, S-NSSAIs, SM Context ID, AMF
// ID, Request Type, N1 SM Container (PDU Session Establishment Request), User
// location, Access Type, RAT Type, PEI step 15. (SM Context ID -> SCID, N2
// SM, Request Type)(Initial Request)
// TODO: verify why Request Type is not define in context_data
/* AMF-initiated with a release indication to request the release of the PDU
* Session (step 3.d, section 4.3.4.2@3GPP TS 23.502)*/
if
(
context_data
.
releaseIsSet
())
{
pur
.
set_release
(
context_data
.
isRelease
());
}
/* PDU Session Modification (SM Context ID -> SCID, N1/N2),
* section 4.3.3.2@3GPP TS 23.502: */
// step 1.a,UE-initiated: SM Context ID + N1 (PDU Session Modification
// Request) step 1.e (AN initiated modification): SM Context ID, N2 SM
// information (QFI, User location Information and an indication that the QoS
// Flow is released) step 7a, SM Context ID, N2 SM information, UE location
// information Step 11, SM Context ID, N1 SM (PDU Session Modification Command
// ACK), User location
}
void
xgpp_conv
::
sm_context_release_from_openapi
(
const
oai
::
smf_server
::
model
::
SmContextReleaseMessage
&
srm
,
smf
::
pdu_session_release_sm_context_request
&
prr
)
{
Logger
::
smf_app
().
debug
(
"Convert SmContextReleaseMessage (OpenAPI) to "
"PDUSession_ReleaseSMContext"
);
oai
::
smf_server
::
model
::
SmContextReleaseData
context_data
=
srm
.
getJsonData
();
if
(
context_data
.
n2SmInfoIsSet
())
{
// N2 SM (for Session establishment)
std
::
string
n2_sm_information
=
srm
.
getBinaryDataN2SmInformation
();
Logger
::
smf_app
().
debug
(
"N2 SM Information %s"
,
n2_sm_information
.
c_str
());
std
::
string
n2_sm_info_type
=
context_data
.
getN2SmInfoType
();
prr
.
set_n2_sm_information
(
n2_sm_information
);
prr
.
set_n2_sm_info_type
(
n2_sm_info_type
);
}
// TODO: Initialize necessary values for sm context req from context_data
// cause:
// ngApCause:
// 5gMmCauseValue:
// ueLocation:
// ueTimeZone:
// addUeLocation:
// vsmfReleaseOnly:
// ismfReleaseOnly:
}
void
xgpp_conv
::
data_notification_from_openapi
(
const
oai
::
smf_server
::
model
::
NotificationData
&
nd
,
smf
::
data_notification_msg
&
dn_msg
)
{
Logger
::
smf_app
().
debug
(
"Convert NotificationData (OpenAPI) to "
"Data Notification Msg"
);
dn_msg
.
set_notification_event_type
(
nd
.
getEvent
());
dn_msg
.
set_nf_instance_uri
(
nd
.
getNfInstanceUri
());
std
::
shared_ptr
<
smf
::
nf_profile
>
p
=
{};
// Only support UPF for now
if
(
nd
.
getNfProfile
().
getNfType
()
==
"UPF"
)
p
=
std
::
make_shared
<
smf
::
upf_profile
>
();
nlohmann
::
json
pj
=
{};
to_json
(
pj
,
nd
.
getNfProfile
());
p
.
get
()
->
from_json
(
pj
);
dn_msg
.
set_profile
(
p
);
}
void
xgpp_conv
::
smf_event_exposure_notification_from_openapi
(
const
oai
::
smf_server
::
model
::
NsmfEventExposure
&
nee
,
smf
::
event_exposure_msg
&
eem
)
{
Logger
::
smf_app
().
debug
(
"Convert NsmfEventExposure (OpenAPI) to "
"Event Exposure Msg"
);
// Supi
if
(
nee
.
supiIsSet
())
{
supi_t
supi
=
{.
length
=
0
};
std
::
size_t
pos
=
nee
.
getSupi
().
find
(
"-"
);
std
::
string
supi_str
=
nee
.
getSupi
().
substr
(
pos
+
1
);
std
::
string
supi_prefix
=
nee
.
getSupi
().
substr
(
0
,
pos
);
smf_string_to_supi
(
&
supi
,
supi_str
.
c_str
());
eem
.
set_supi
(
supi
);
eem
.
set_supi_prefix
(
supi_prefix
);
Logger
::
smf_api_server
().
debug
(
"SUPI %s, SUPI Prefix %s, IMSI %s"
,
nee
.
getSupi
().
c_str
(),
supi_prefix
.
c_str
(),
supi_str
.
c_str
());
}
// PDU session ID
if
(
nee
.
pduSeIdIsSet
())
{
Logger
::
smf_api_server
().
debug
(
"PDU Session ID %d"
,
nee
.
getPduSeId
());
eem
.
set_pdu_session_id
(
nee
.
getPduSeId
());
}
eem
.
set_notif_id
(
nee
.
getNotifId
());
// NotifId
eem
.
set_notif_uri
(
nee
.
getNotifUri
());
// NotifUri
// EventSubscription: TODO
event_subscription_t
event_subscription
=
{};
event_subscription
.
smf_event
=
smf_event_t
::
SMF_EVENT_PDU_SES_REL
;
std
::
vector
<
event_subscription_t
>
event_subscriptions
=
{};
event_subscriptions
.
push_back
(
event_subscription
);
eem
.
set_event_subs
(
event_subscriptions
);
// std::vector<EventSubscription> eventSubscriptions;
// for (auto it: nee.getEventSubs()){
// event_subscription.smf_event = it.getEvent();
// getDnaiChgType
// event_subscriptions.push_back(event_subscription);
//}
}
src/common/utils/3gpp_conversions.hpp
View file @
58b1f280
...
...
@@ -35,28 +35,117 @@
#include "3gpp_24.008.h"
#include "nas_lib.h"
#include "SmContextMessage.h"
#include "SmContextUpdateMessage.h"
#include "SmContextReleaseMessage.h"
#include "NotificationData.h"
#include "NsmfEventExposure.h"
#include "smf_msg.hpp"
namespace
xgpp_conv
{
/*
* Convert PAA to PFCP UE IP Addr
* @param [const paa_t&] paa: paa
* @param [pfcp::ue_ip_address_t&] ue_ip_address: UE IP Addr
* @return void
*/
void
paa_to_pfcp_ue_ip_address
(
const
paa_t
&
paa
,
pfcp
::
ue_ip_address_t
&
ue_ip_address
);
/*
* Convert PDN IP to PFCP UE IP Addr
* @param [const pdu_session_type_t&] pdu_session_type: PDU Session Type
* @param [const struct in_addr&] ipv4_address: IPv4 Addr
* @param [const struct in6_addr] ipv6_address: IPv6 Addr
* @param [pfcp::ue_ip_address_t&] ue_ip_address: UE IP Addr
* @return void
*/
void
pdn_ip_to_pfcp_ue_ip_address
(
const
pdu_session_type_t
&
pdu_session_type
,
const
struct
in_addr
&
ipv4_address
,
const
struct
in6_addr
ipv6_address
,
pfcp
::
ue_ip_address_t
&
ue_ip_address
);
/*
* Convert PCO in NAS into core type
* @param [const protocol_configuration_options_nas_t&] pco_nas: PCO in NAS msg
* @param [protocol_configuration_options_t&] pco: PCO in core type
* @return void
*/
void
pco_nas_to_core
(
const
protocol_configuration_options_nas_t
&
pco_nas
,
protocol_configuration_options_t
&
pco
);
/*
* Convert PCO in core type to NAS type
* @param [const protocol_configuration_options_t&] pco: PCO in cpre type
* @param [protocol_configuration_options_nas_t&] pco_nas: PCO in NAS type
* @return void
*/
void
pco_core_to_nas
(
const
protocol_configuration_options_t
&
pco
,
protocol_configuration_options_nas_t
&
pco_nas
);
void
sm_context_create_data_from_openapi
(
const
oai
::
smf_server
::
model
::
SmContextMessage
&
scd
,
/*
* Convert SM Context Create Msg from OpenAPI into PDU
* SessionCreateSMContextRequest msg
* @param [const oai::smf_server::model::SmContextMessage&] scm: SM Context
* Create Msg in OpenAPI
* @param [smf::pdu_session_create_sm_context_request&] pcr: PDU
* SessionCreateSMContextRequest msg
* @return void
*/
void
sm_context_create_from_openapi
(
const
oai
::
smf_server
::
model
::
SmContextMessage
&
scm
,
smf
::
pdu_session_create_sm_context_request
&
pcr
);
/*
* Convert SM Context Update Msg from OpenAPI into PDU
* SessionUpdateSMContextRequest msg
* @param [const oai::smf_server::model::SmContextUpdateMessage&] scu: SM
* Context Update Msg in OpenAPI
* @param [smf::pdu_session_update_sm_context_request&] pur: PDU
* SessionUpdateSMContextRequest msg
* @return void
*/
void
sm_context_update_from_openapi
(
const
oai
::
smf_server
::
model
::
SmContextUpdateMessage
&
scu
,
smf
::
pdu_session_update_sm_context_request
&
pur
);
/*
* Convert SM Context Release Msg from OpenAPI into PDU
* SessionReleaseSMContextRequest msg
* @param [const oai::smf_server::model::SmContextReleaseMessage&] srm: SM
* Context Release Msg in OpenAPI
* @param [smf::pdu_session_release_sm_context_request&] prr: PDU
* SessionReleaseSMContextRequest msg
* @return void
*/
void
sm_context_release_from_openapi
(
const
oai
::
smf_server
::
model
::
SmContextReleaseMessage
&
srm
,
smf
::
pdu_session_release_sm_context_request
&
prr
);
/*
* Convert Data Notification from OpenAPI into Data Notification Msg
* @param [const oai::smf_server::model::NotificationData&] nd: Data
* Notification in OpenAPI
* @param [smf::data_notification_msg&] dn_msg: Data Notification msg
* @return void
*/
void
data_notification_from_openapi
(
const
oai
::
smf_server
::
model
::
NotificationData
&
nd
,
smf
::
data_notification_msg
&
dn_msg
);
/*
* Convert NsmfEventExposure from OpenAPI into Event Exposure Msg
* @param [const oai::smf_server::model::NsmfEventExposure&] nee:
* NsmfEventExposure in OpenAPI
* @param [smf::event_exposure_msg&] eem: Event Exposure Msg
* @return void
*/
void
smf_event_exposure_notification_from_openapi
(
const
oai
::
smf_server
::
model
::
NsmfEventExposure
&
nee
,
smf
::
event_exposure_msg
&
eem
);
}
// namespace xgpp_conv
#endif
/* FILE_3GPP_CONVERSIONS_HPP_SEEN */
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