Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
O
OpenXG-UDR
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-UDR
Commits
ec554974
Commit
ec554974
authored
Jan 15, 2021
by
yangjian
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Update SMFSelectionSubscriptionData: add database
parent
b724ff91
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
73 additions
and
15 deletions
+73
-15
CMakeLists.txt
CMakeLists.txt
+1
-1
README.md
README.md
+4
-3
impl/SMFSelectionSubscriptionDataDocumentApiImpl.cpp
impl/SMFSelectionSubscriptionDataDocumentApiImpl.cpp
+59
-6
impl/SMFSelectionSubscriptionDataDocumentApiImpl.h
impl/SMFSelectionSubscriptionDataDocumentApiImpl.h
+8
-4
main-api-server.cpp
main-api-server.cpp
+1
-1
No files found.
CMakeLists.txt
View file @
ec554974
cmake_minimum_required
(
VERSION 3.2
)
cmake_minimum_required
(
VERSION 3.2
)
project
(
api-serve
r
)
project
(
ud
r
)
set
(
CMAKE_CXX_FLAGS
"
${
CMAKE_CXX_FLAGS
}
-std=c++14 -pg -g3"
)
set
(
CMAKE_CXX_FLAGS
"
${
CMAKE_CXX_FLAGS
}
-std=c++14 -pg -g3"
)
...
...
README.md
View file @
ec554974
...
@@ -35,13 +35,14 @@ Once compiled run the server:
...
@@ -35,13 +35,14 @@ Once compiled run the server:
```
bash
```
bash
cd
build
cd
build
./
api-serve
r
./
ud
r
```
```
## Libraries required
## Libraries required
-
[
pistache
](
http://pistache.io/quickstart
)
-
[
pistache
](
http://pistache.io/quickstart
)
: Please download the
`Pistache`
project and
put the "include" folder and the generated "
*
.so" file into external/include/ and external/lib/ after compilation
-
[
JSON for Modern C++
](
https://github.com/nlohmann/json/#integration
)
: Please download the
`json.hpp`
file and
-
[
JSON for Modern C++
](
https://github.com/nlohmann/json/#integration
)
: Please download the
`json.hpp`
file and
put it under the
model
/nlohmann folder
put it under the
external/include
/nlohmann folder
## Namespaces
## Namespaces
org.openapitools.server.api
org.openapitools.server.api
...
...
impl/SMFSelectionSubscriptionDataDocumentApiImpl.cpp
View file @
ec554974
/**
/**
* Nudr_DataRepository API OpenAPI file
* Nudr_DataRepository API OpenAPI file
* Unified Data Repository Service. © 2020, 3GPP Organizational Partners (ARIB, ATIS, CCSA, ETSI, TSDSI, TTA, TTC). All rights reserved.
* Unified Data Repository Service. © 2020, 3GPP Organizational Partners (ARIB, ATIS, CCSA, ETSI, TSDSI, TTA, TTC). All rights reserved.
*
*
* The version of the OpenAPI document: 2.1.2
* The version of the OpenAPI document: 2.1.2
*
*
*
*
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
* https://openapi-generator.tech
...
@@ -19,13 +19,66 @@ namespace api {
...
@@ -19,13 +19,66 @@ namespace api {
using
namespace
org
::
openapitools
::
server
::
model
;
using
namespace
org
::
openapitools
::
server
::
model
;
SMFSelectionSubscriptionDataDocumentApiImpl
::
SMFSelectionSubscriptionDataDocumentApiImpl
(
std
::
shared_ptr
<
Pistache
::
Rest
::
Router
>
rtr
)
SMFSelectionSubscriptionDataDocumentApiImpl
::
SMFSelectionSubscriptionDataDocumentApiImpl
(
std
::
shared_ptr
<
Pistache
::
Rest
::
Router
>
rtr
,
MYSQL
*
mysql
)
:
SMFSelectionSubscriptionDataDocumentApi
(
rtr
)
:
SMFSelectionSubscriptionDataDocumentApi
(
rtr
)
{
}
{
mysql_WitcommUDRDB
=
mysql
;
}
void
SMFSelectionSubscriptionDataDocumentApiImpl
::
query_smf_select_data
(
const
std
::
string
&
ueId
,
const
std
::
string
&
servingPlmnId
,
const
Pistache
::
Optional
<
std
::
vector
<
std
::
string
>>
&
fields
,
const
Pistache
::
Optional
<
std
::
string
>
&
supportedFeatures
,
const
Pistache
::
Optional
<
Pistache
::
Http
::
Header
::
Raw
>
&
ifNoneMatch
,
const
Pistache
::
Optional
<
Pistache
::
Http
::
Header
::
Raw
>
&
ifModifiedSince
,
Pistache
::
Http
::
ResponseWriter
&
response
)
{
void
SMFSelectionSubscriptionDataDocumentApiImpl
::
query_smf_select_data
(
const
std
::
string
&
ueId
,
const
std
::
string
&
servingPlmnId
,
const
Pistache
::
Optional
<
std
::
vector
<
std
::
string
>>
&
fields
,
const
Pistache
::
Optional
<
std
::
string
>
&
supportedFeatures
,
const
Pistache
::
Optional
<
Pistache
::
Http
::
Header
::
Raw
>
&
ifNoneMatch
,
const
Pistache
::
Optional
<
Pistache
::
Http
::
Header
::
Raw
>
&
ifModifiedSince
,
Pistache
::
Http
::
ResponseWriter
&
response
)
{
response
.
send
(
Pistache
::
Http
::
Code
::
Ok
,
"query_smf_select_data
\n
"
);
//response.send(Pistache::Http::Code::Ok, "query_smf_select_data\n");
//servingPlmnId pattern: "^[0-9]{5,6}$"
//servingPlmnId pattern: "^[0-9]{5,6}$"
MYSQL_RES
*
res
=
NULL
;
MYSQL_ROW
row
;
MYSQL_FIELD
*
field
=
nullptr
;
nlohmann
::
json
j
;
SmfSelectionSubscriptionData
smfselectionsubscriptiondata
;
const
std
::
string
query
=
"select * from SmfSelectionSubscriptionData WHERE ueid="
+
ueId
;
if
(
mysql_real_query
(
mysql_WitcommUDRDB
,
query
.
c_str
(),
(
unsigned
long
)
query
.
size
()))
{
std
::
cout
<<
"mysql_real_query failure!"
<<
std
::
endl
;
return
;
}
res
=
mysql_store_result
(
mysql_WitcommUDRDB
);
if
(
res
==
NULL
)
{
std
::
cout
<<
"mysql_store_result failure!"
<<
std
::
endl
;
return
;
}
row
=
mysql_fetch_row
(
res
);
if
(
row
!=
NULL
)
{
for
(
int
i
=
0
;
field
=
mysql_fetch_field
(
res
);
i
++
)
{
if
(
!
strcmp
(
"supportedFeatures"
,
field
->
name
)
&&
row
[
i
]
!=
NULL
)
{
smfselectionsubscriptiondata
.
setSupportedFeatures
(
row
[
i
]);
}
else
if
(
!
strcmp
(
"subscribedSnssaiInfos"
,
field
->
name
)
&&
row
[
i
]
!=
NULL
)
{
// SmfSelectionSubscriptionData.setSubscribedSnssaiInfos(std :: map < std :: string, SnssaiInfo > const & value);
}
else
if
(
!
strcmp
(
"sharedSnssaiInfosId"
,
field
->
name
)
&&
row
[
i
]
!=
NULL
)
{
smfselectionsubscriptiondata
.
setSharedSnssaiInfosId
(
row
[
i
]);
}
}
to_json
(
j
,
smfselectionsubscriptiondata
);
response
.
send
(
Pistache
::
Http
::
Code
::
Ok
,
j
.
dump
());
}
else
{
std
::
cout
<<
"SmfSelectionSubscriptionData no data!"
<<
std
::
endl
;
}
mysql_free_result
(
res
);
}
}
}
}
...
...
impl/SMFSelectionSubscriptionDataDocumentApiImpl.h
View file @
ec554974
/**
/**
* Nudr_DataRepository API OpenAPI file
* Nudr_DataRepository API OpenAPI file
* Unified Data Repository Service. © 2020, 3GPP Organizational Partners (ARIB, ATIS, CCSA, ETSI, TSDSI, TTA, TTC). All rights reserved.
* Unified Data Repository Service. © 2020, 3GPP Organizational Partners (ARIB, ATIS, CCSA, ETSI, TSDSI, TTA, TTC). All rights reserved.
*
*
* The version of the OpenAPI document: 2.1.2
* The version of the OpenAPI document: 2.1.2
*
*
*
*
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
* https://openapi-generator.tech
...
@@ -13,7 +13,7 @@
...
@@ -13,7 +13,7 @@
/*
/*
* SMFSelectionSubscriptionDataDocumentApiImpl.h
* SMFSelectionSubscriptionDataDocumentApiImpl.h
*
*
*
*
*/
*/
#ifndef SMF_SELECTION_SUBSCRIPTION_DATA_DOCUMENT_API_IMPL_H_
#ifndef SMF_SELECTION_SUBSCRIPTION_DATA_DOCUMENT_API_IMPL_H_
...
@@ -32,6 +32,8 @@
...
@@ -32,6 +32,8 @@
#include "SmfSelectionSubscriptionData.h"
#include "SmfSelectionSubscriptionData.h"
#include <string>
#include <string>
#include <mysql/mysql.h>
namespace
org
{
namespace
org
{
namespace
openapitools
{
namespace
openapitools
{
namespace
server
{
namespace
server
{
...
@@ -41,11 +43,13 @@ using namespace org::openapitools::server::model;
...
@@ -41,11 +43,13 @@ using namespace org::openapitools::server::model;
class
SMFSelectionSubscriptionDataDocumentApiImpl
:
public
org
::
openapitools
::
server
::
api
::
SMFSelectionSubscriptionDataDocumentApi
{
class
SMFSelectionSubscriptionDataDocumentApiImpl
:
public
org
::
openapitools
::
server
::
api
::
SMFSelectionSubscriptionDataDocumentApi
{
public:
public:
SMFSelectionSubscriptionDataDocumentApiImpl
(
std
::
shared_ptr
<
Pistache
::
Rest
::
Router
>
);
SMFSelectionSubscriptionDataDocumentApiImpl
(
std
::
shared_ptr
<
Pistache
::
Rest
::
Router
>
,
MYSQL
*
mysql
);
~
SMFSelectionSubscriptionDataDocumentApiImpl
()
{}
~
SMFSelectionSubscriptionDataDocumentApiImpl
()
{}
void
query_smf_select_data
(
const
std
::
string
&
ueId
,
const
std
::
string
&
servingPlmnId
,
const
Pistache
::
Optional
<
std
::
vector
<
std
::
string
>>
&
fields
,
const
Pistache
::
Optional
<
std
::
string
>
&
supportedFeatures
,
const
Pistache
::
Optional
<
Pistache
::
Http
::
Header
::
Raw
>
&
ifNoneMatch
,
const
Pistache
::
Optional
<
Pistache
::
Http
::
Header
::
Raw
>
&
ifModifiedSince
,
Pistache
::
Http
::
ResponseWriter
&
response
);
void
query_smf_select_data
(
const
std
::
string
&
ueId
,
const
std
::
string
&
servingPlmnId
,
const
Pistache
::
Optional
<
std
::
vector
<
std
::
string
>>
&
fields
,
const
Pistache
::
Optional
<
std
::
string
>
&
supportedFeatures
,
const
Pistache
::
Optional
<
Pistache
::
Http
::
Header
::
Raw
>
&
ifNoneMatch
,
const
Pistache
::
Optional
<
Pistache
::
Http
::
Header
::
Raw
>
&
ifModifiedSince
,
Pistache
::
Http
::
ResponseWriter
&
response
);
private:
MYSQL
*
mysql_WitcommUDRDB
;
};
};
}
}
...
...
main-api-server.cpp
View file @
ec554974
...
@@ -311,7 +311,7 @@ int main() {
...
@@ -311,7 +311,7 @@ int main() {
SMFRegistrationDocumentApiserver
.
init
();
SMFRegistrationDocumentApiserver
.
init
();
SMFRegistrationsCollectionApiImpl
SMFRegistrationsCollectionApiserver
(
router
);
SMFRegistrationsCollectionApiImpl
SMFRegistrationsCollectionApiserver
(
router
);
SMFRegistrationsCollectionApiserver
.
init
();
SMFRegistrationsCollectionApiserver
.
init
();
SMFSelectionSubscriptionDataDocumentApiImpl
SMFSelectionSubscriptionDataDocumentApiserver
(
router
);
SMFSelectionSubscriptionDataDocumentApiImpl
SMFSelectionSubscriptionDataDocumentApiserver
(
router
,
&
mysql
);
SMFSelectionSubscriptionDataDocumentApiserver
.
init
();
SMFSelectionSubscriptionDataDocumentApiserver
.
init
();
SMSF3GPPRegistrationDocumentApiImpl
SMSF3GPPRegistrationDocumentApiserver
(
router
);
SMSF3GPPRegistrationDocumentApiImpl
SMSF3GPPRegistrationDocumentApiserver
(
router
);
SMSF3GPPRegistrationDocumentApiserver
.
init
();
SMSF3GPPRegistrationDocumentApiserver
.
init
();
...
...
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