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
fdbe4e0a
Commit
fdbe4e0a
authored
Nov 10, 2021
by
Niuhaiwen
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
data exposure
parent
10120aa7
Changes
7
Show whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
194 additions
and
0 deletions
+194
-0
src/api-server/api/DataExposure.cpp
src/api-server/api/DataExposure.cpp
+90
-0
src/api-server/api/DataExposure.h
src/api-server/api/DataExposure.h
+60
-0
src/api-server/smf-api-server.cpp
src/api-server/smf-api-server.cpp
+1
-0
src/api-server/smf-api-server.h
src/api-server/smf-api-server.h
+3
-0
src/smf_app/smf_app.cpp
src/smf_app/smf_app.cpp
+4
-0
src/smf_app/smf_context.cpp
src/smf_app/smf_context.cpp
+26
-0
src/smf_app/smf_context.hpp
src/smf_app/smf_context.hpp
+10
-0
No files found.
src/api-server/api/DataExposure.cpp
0 → 100644
View file @
fdbe4e0a
/**
* Nudsf_DataRepository
* Nudsf Data Repository Service. © 2021, 3GPP Organizational Partners (ARIB, ATIS, CCSA, ETSI, TSDSI, TTA, TTC). All rights reserved.
*
* The version of the OpenAPI document: 1.1.0-alpha.2
*
*
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
* Do not edit the class manually.
*/
#include "DataExposure.h"
//#include "Helpers.h"
#include "logger.hpp"
#include <nlohmann/json.hpp>
//#include "TransData.hpp"
#include <stdlib.h>
#include <map>
#include <algorithm>
#include <cmath>
#include "smf_context.hpp"
extern
std
::
vector
<
struct
sessions_data
>
sess_data
;
using
json
=
nlohmann
::
json
;
//using namespace org::openapitools::server::model;
namespace
oai
{
namespace
smf_server
{
namespace
api
{
//using namespace oai::smf_server::model;
DataExposureApi
::
DataExposureApi
(
std
::
shared_ptr
<
Pistache
::
Rest
::
Router
>
rtr
)
{
router
=
rtr
;
}
void
DataExposureApi
::
init
()
{
setupRoutes
();
}
void
DataExposureApi
::
setupRoutes
()
{
using
namespace
Pistache
::
Rest
;
Routes
::
Get
(
*
router
,
base
+
"/getNFService"
,
Routes
::
bind
(
&
DataExposureApi
::
getNFService
,
this
));
}
void
DataExposureApi
::
getNFService
(
const
Pistache
::
Rest
::
Request
&
request
,
Pistache
::
Http
::
ResponseWriter
response
)
{
printf
(
"getNFService
\n
"
);
try
{
json
resp
;
json
ues
;
for
(
int
i
=
0
;
i
<
sess_data
.
size
();
i
++
){
ues
[
"supi"
]
=
sess_data
[
i
].
supi
;
ues
[
"pdu_session_id"
]
=
sess_data
[
i
].
pdu_sess_id
;
ues
[
"snssai"
][
"sst"
]
=
sess_data
[
i
].
sst
;
ues
[
"snssai"
][
"sd"
]
=
sess_data
[
i
].
sd
;
ues
[
"pdu_session_type"
]
=
sess_data
[
i
].
pdu_sess_type
;
ues
[
"ip_address"
]
=
sess_data
[
i
].
ip
;
ues
[
"dnn"
]
=
sess_data
[
i
].
dnn
;
resp
[
"ues"
].
push_back
(
ues
);
}
printf
(
"response: %s
\n
"
,
resp
.
dump
().
c_str
());
response
.
send
(
Pistache
::
Http
::
Code
::
Ok
,
resp
.
dump
().
c_str
());
return
;
}
catch
(
nlohmann
::
detail
::
exception
&
e
)
{
//send a 400 error
response
.
send
(
Pistache
::
Http
::
Code
::
Bad_Request
,
e
.
what
());
return
;
}
catch
(
Pistache
::
Http
::
HttpError
&
e
)
{
response
.
send
(
static_cast
<
Pistache
::
Http
::
Code
>
(
e
.
code
()),
e
.
what
());
return
;
}
catch
(
std
::
exception
&
e
)
{
//send a 500 error
response
.
send
(
Pistache
::
Http
::
Code
::
Internal_Server_Error
,
e
.
what
());
return
;
}
}
}
}
}
src/api-server/api/DataExposure.h
0 → 100644
View file @
fdbe4e0a
/**
* Nudsf_DataRepository
* Nudsf Data Repository Service. © 2021, 3GPP Organizational Partners (ARIB, ATIS, CCSA, ETSI, TSDSI, TTA, TTC). All rights reserved.
*
* The version of the OpenAPI document: 1.1.0-alpha.2
*
*
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
* Do not edit the class manually.
*/
/*
* RecordCRUDApi.h
*
*
*/
#ifndef _DATA_EXPOSURE_API_H_
#define _DATA_EXPOSURE_API_H_
#include <pistache/http.h>
#include <pistache/router.h>
#include <pistache/http_headers.h>
#include <pistache/optional.h>
#include <string>
#include <vector>
//#include "TransData.hpp"
#include <iostream>
#include <stdlib.h>
#include "smf.h"
namespace
oai
{
namespace
smf_server
{
namespace
api
{
//using namespace oai::smf_server::model;
class
DataExposureApi
{
public:
DataExposureApi
(
std
::
shared_ptr
<
Pistache
::
Rest
::
Router
>
);
virtual
~
DataExposureApi
()
{}
void
init
();
const
std
::
string
base
=
"/data_exposure/v1"
;
private:
void
setupRoutes
();
void
getNFService
(
const
Pistache
::
Rest
::
Request
&
request
,
Pistache
::
Http
::
ResponseWriter
response
);
std
::
shared_ptr
<
Pistache
::
Rest
::
Router
>
router
;
};
}
}
}
#endif
/* RecordCRUDApi_H_ */
src/api-server/smf-api-server.cpp
View file @
fdbe4e0a
...
@@ -83,6 +83,7 @@ void SMFApiServer::init(size_t thr) {
...
@@ -83,6 +83,7 @@ void SMFApiServer::init(size_t thr) {
m_individualSubscriptionDocumentApiImpl
->
init
();
m_individualSubscriptionDocumentApiImpl
->
init
();
m_subscriptionsCollectionApiImpl
->
init
();
m_subscriptionsCollectionApiImpl
->
init
();
m_nfStatusNotifyApiImpl
->
init
();
m_nfStatusNotifyApiImpl
->
init
();
m_dataExposure
->
init
();
}
}
void
SMFApiServer
::
start
()
{
void
SMFApiServer
::
start
()
{
Logger
::
smf_api_server
().
info
(
"HTTP1 server started"
);
Logger
::
smf_api_server
().
info
(
"HTTP1 server started"
);
...
...
src/api-server/smf-api-server.h
View file @
fdbe4e0a
...
@@ -52,6 +52,7 @@
...
@@ -52,6 +52,7 @@
#include "NFStatusNotifyApiImpl.h"
#include "NFStatusNotifyApiImpl.h"
#include "smf_app.hpp"
#include "smf_app.hpp"
#include "DataExposure.h"
using
namespace
oai
::
smf_server
::
api
;
using
namespace
oai
::
smf_server
::
api
;
class
SMFApiServer
{
class
SMFApiServer
{
...
@@ -79,6 +80,7 @@ class SMFApiServer {
...
@@ -79,6 +80,7 @@ class SMFApiServer {
m_router
,
smf_app_inst
,
m_address
);
m_router
,
smf_app_inst
,
m_address
);
m_nfStatusNotifyApiImpl
=
std
::
make_shared
<
NFStatusNotifyApiImpl
>
(
m_nfStatusNotifyApiImpl
=
std
::
make_shared
<
NFStatusNotifyApiImpl
>
(
m_router
,
smf_app_inst
,
m_address
);
m_router
,
smf_app_inst
,
m_address
);
m_dataExposure
=
std
::
make_shared
<
DataExposureApi
>
(
m_router
);
}
}
void
init
(
size_t
thr
=
1
);
void
init
(
size_t
thr
=
1
);
void
start
();
void
start
();
...
@@ -98,6 +100,7 @@ class SMFApiServer {
...
@@ -98,6 +100,7 @@ class SMFApiServer {
m_subscriptionsCollectionApiImpl
;
m_subscriptionsCollectionApiImpl
;
std
::
shared_ptr
<
NFStatusNotifyApiImpl
>
m_nfStatusNotifyApiImpl
;
std
::
shared_ptr
<
NFStatusNotifyApiImpl
>
m_nfStatusNotifyApiImpl
;
std
::
string
m_address
;
std
::
string
m_address
;
std
::
shared_ptr
<
DataExposureApi
>
m_dataExposure
;
};
};
#endif
#endif
src/smf_app/smf_app.cpp
View file @
fdbe4e0a
...
@@ -67,6 +67,7 @@ extern "C" {
...
@@ -67,6 +67,7 @@ extern "C" {
#include "nas_message.h"
#include "nas_message.h"
}
}
using
namespace
smf
;
using
namespace
smf
;
extern
util
::
async_shell_cmd
*
async_shell_cmd_inst
;
extern
util
::
async_shell_cmd
*
async_shell_cmd_inst
;
...
@@ -775,6 +776,7 @@ void smf_app::handle_pdu_session_create_sm_context_request(
...
@@ -775,6 +776,7 @@ void smf_app::handle_pdu_session_create_sm_context_request(
"SUPI "
SUPI_64_FMT
", SNSSAI SST %d, SD %s"
,
"SUPI "
SUPI_64_FMT
", SNSSAI SST %d, SD %s"
,
supi64
,
snssai
.
sST
,
snssai
.
sD
.
c_str
());
supi64
,
snssai
.
sST
,
snssai
.
sD
.
c_str
());
// 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.
// request type, etc.
// Check PTI
// Check PTI
...
@@ -819,6 +821,7 @@ void smf_app::handle_pdu_session_create_sm_context_request(
...
@@ -819,6 +821,7 @@ 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
;
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
)
{
...
@@ -864,6 +867,7 @@ void smf_app::handle_pdu_session_create_sm_context_request(
...
@@ -864,6 +867,7 @@ void smf_app::handle_pdu_session_create_sm_context_request(
dnn
==
smf_cfg
.
get_default_dnn
();
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
...
...
src/smf_app/smf_context.cpp
View file @
fdbe4e0a
...
@@ -64,6 +64,9 @@ extern "C" {
...
@@ -64,6 +64,9 @@ extern "C" {
using
namespace
smf
;
using
namespace
smf
;
std
::
vector
<
struct
sessions_data
>
sess_data
;
extern
itti_mw
*
itti_inst
;
extern
itti_mw
*
itti_inst
;
extern
smf
::
smf_app
*
smf_app_inst
;
extern
smf
::
smf_app
*
smf_app_inst
;
extern
smf
::
smf_config
smf_cfg
;
extern
smf
::
smf_config
smf_cfg
;
...
@@ -1220,6 +1223,8 @@ void smf_context::handle_pdu_session_create_sm_context_request(
...
@@ -1220,6 +1223,8 @@ void smf_context::handle_pdu_session_create_sm_context_request(
"version %d)"
,
"version %d)"
,
smreq
->
http_version
);
smreq
->
http_version
);
struct
sessions_data
item
;
std
::
string
n1_sm_message
,
n1_sm_msg_hex
;
std
::
string
n1_sm_message
,
n1_sm_msg_hex
;
bool
request_accepted
=
true
;
bool
request_accepted
=
true
;
...
@@ -1228,6 +1233,11 @@ void smf_context::handle_pdu_session_create_sm_context_request(
...
@@ -1228,6 +1233,11 @@ void smf_context::handle_pdu_session_create_sm_context_request(
snssai_t
snssai
=
smreq
->
req
.
get_snssai
();
snssai_t
snssai
=
smreq
->
req
.
get_snssai
();
supi64_t
supi64
=
smf_supi_to_u64
(
smreq
->
req
.
get_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
();
item
.
supi
=
supi64
;
item
.
dnn
=
dnn
;
item
.
sst
=
snssai
.
sST
;
item
.
sd
=
snssai
.
sD
;
item
.
pdu_sess_id
=
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
// Accept, otherwise send PDU Session Reject to AMF
// Accept, otherwise send PDU Session Reject to AMF
...
@@ -1432,6 +1442,8 @@ void smf_context::handle_pdu_session_create_sm_context_request(
...
@@ -1432,6 +1442,8 @@ void smf_context::handle_pdu_session_create_sm_context_request(
Logger
::
smf_app
().
info
(
Logger
::
smf_app
().
info
(
"PAA, Ipv4 Address: %s"
,
"PAA, Ipv4 Address: %s"
,
inet_ntoa
(
*
((
struct
in_addr
*
)
&
paa
.
ipv4_address
)));
inet_ntoa
(
*
((
struct
in_addr
*
)
&
paa
.
ipv4_address
)));
item
.
pdu_sess_type
=
"Ipv4"
;
item
.
ip
=
inet_ntoa
(
*
((
struct
in_addr
*
)
&
paa
.
ipv4_address
));
}
else
{
// use DHCP
}
else
{
// use DHCP
Logger
::
smf_app
().
info
(
Logger
::
smf_app
().
info
(
"UE requests to use DHCPv4 for IPv4 address assignment, this "
"UE requests to use DHCPv4 for IPv4 address assignment, this "
...
@@ -1470,6 +1482,20 @@ void smf_context::handle_pdu_session_create_sm_context_request(
...
@@ -1470,6 +1482,20 @@ void smf_context::handle_pdu_session_create_sm_context_request(
}
}
// TODO: Step 8. SMF-initiated SM Policy Modification (with PCF)
// TODO: Step 8. SMF-initiated SM Policy Modification (with PCF)
for
(
int
i
=
0
;
i
<
sess_data
.
size
();
i
++
){
if
(
sess_data
[
i
].
supi
==
item
.
supi
){
sess_data
[
i
].
supi
=
item
.
supi
;
sess_data
[
i
].
sd
=
item
.
sd
;
sess_data
[
i
].
sst
=
item
.
sst
;
sess_data
[
i
].
pdu_sess_id
=
item
.
pdu_sess_id
;
sess_data
[
i
].
dnn
=
item
.
dnn
;
sess_data
[
i
].
pdu_sess_type
=
item
.
pdu_sess_type
;
sess_data
[
i
].
ip
=
item
.
ip
;
break
;
}
else
{
sess_data
.
push_back
(
item
);
}
}
// Step 9. Create session establishment procedure and run the procedure
// Step 9. Create session establishment procedure and run the procedure
// if request is accepted
// if request is accepted
...
...
src/smf_app/smf_context.hpp
View file @
fdbe4e0a
...
@@ -58,6 +58,16 @@ extern "C" {
...
@@ -58,6 +58,16 @@ extern "C" {
#include "nas_message.h"
#include "nas_message.h"
}
}
struct
sessions_data
{
supi64_t
supi
;
std
::
string
sd
;
int
sst
;
int
pdu_sess_id
;
std
::
string
dnn
;
std
::
string
pdu_sess_type
;
std
::
string
ip
;
};
namespace
smf
{
namespace
smf
{
class
smf_qos_flow
{
class
smf_qos_flow
{
...
...
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