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
497f7bc2
Commit
497f7bc2
authored
Feb 02, 2021
by
yangjian
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Modify udr database
parent
2cc79369
Changes
11
Hide whitespace changes
Inline
Side-by-side
Showing
11 changed files
with
256 additions
and
84 deletions
+256
-84
README.md
README.md
+30
-47
src/impl/AMF3GPPAccessRegistrationDocumentApiImpl.cpp
src/impl/AMF3GPPAccessRegistrationDocumentApiImpl.cpp
+25
-4
src/impl/AccessAndMobilitySubscriptionDataDocumentApiImpl.cpp
...impl/AccessAndMobilitySubscriptionDataDocumentApiImpl.cpp
+11
-1
src/impl/AuthenticationStatusDocumentApiImpl.cpp
src/impl/AuthenticationStatusDocumentApiImpl.cpp
+34
-6
src/impl/AuthenticationSubscriptionDocumentApiImpl.cpp
src/impl/AuthenticationSubscriptionDocumentApiImpl.cpp
+28
-10
src/impl/SDMSubscriptionDocumentApiImpl.cpp
src/impl/SDMSubscriptionDocumentApiImpl.cpp
+36
-5
src/impl/SDMSubscriptionsCollectionApiImpl.cpp
src/impl/SDMSubscriptionsCollectionApiImpl.cpp
+23
-3
src/impl/SMFRegistrationDocumentApiImpl.cpp
src/impl/SMFRegistrationDocumentApiImpl.cpp
+36
-5
src/impl/SMFRegistrationsCollectionApiImpl.cpp
src/impl/SMFRegistrationsCollectionApiImpl.cpp
+11
-1
src/impl/SMFSelectionSubscriptionDataDocumentApiImpl.cpp
src/impl/SMFSelectionSubscriptionDataDocumentApiImpl.cpp
+11
-1
src/impl/SessionManagementSubscriptionDataApiImpl.cpp
src/impl/SessionManagementSubscriptionDataApiImpl.cpp
+11
-1
No files found.
README.md
100644 → 100755
View file @
497f7bc2
# REST API Server for Nudr_DataRepository API OpenAPI file
# OpenXG-UDR
## Overview
This API Server was generated by the
[
OpenAPI Generator
](
https://openapi-generator.tech
)
project.
It uses the
[
Pistache
](
https://github.com/oktal/pistache
)
Framework.
OpenXG-UDR Arch
## Files organization
├── build: Build directory, contains targets and object files generated by compilation of network functions.
The Pistache C++ REST server generator creates three folders:
├── scripts: Directory containing scripts for building network functions.
-
`api`
: This folder contains the handlers for each method specified in the OpenAPI definition. Every handler extracts
├── ext: Directory containing spdlog and pistache and the JSON library.
the path and body parameters (if any) from the requests and tries to parse and possibly validate them.
└── UDR: Directory containing object files generated by compilation of UDR network function.
Once this step is completed, the main API class calls the corresponding abstract method that should be implemented
├── etc: Directory containing the configuration file to be deployed for UDR.
by the developer (a basic implementation is provided under the
`impl`
folder)
└── src: Source files of UDR.
-
`impl`
: As written above, the implementation folder contains, for each API, the corresponding implementation class,
├── udr_app: UDR Procedures handling logic.
which extends the main API class and implements the abstract methods.
├── common: Common definitions for 3GPP specifications.
Every method receives the path and body parameters as constant reference variables and a reference to the response
├── model: UDR service.
object, that should be filled with the right response and sent at the end of the method with the command:
├── api: UDR service.
response.send(returnCode, responseBody, [mimeType])
└── impl: UDR service.
-
`model`
: This folder contains the corresponding class for every object schema found in the OpenAPI specification.
## Download source code from Gitlab
The main folder contains also a file with a main that can be used to start the server.
git clone http://git.opensource5g.org/openxg/openxg-udr.git
Of course, is you should customize this file based on your needs
cd openxg-udr/
git checkout master
## Installation
First of all, you need to download and install the libraries listed
[
here
](
#libraries-required
)
.
## install dependencies
cd ./build/scripts
Once the libraries are installed, in order to compile and run the server please follow the steps below:
sudo ./build_udr -I
```
bash
## build UDR
cd
scripts
sudo ./build_udr -c -b Debug -j
./build_udr
## launch UDR
```
sudo ./build/UDR/udr -c etc/udr.conf -o
\ No newline at end of file
Once compiled run the server:
```
bash
cd
build
./udr
```
## Libraries required
-
[
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
put it under the external/include/nlohmann folder
## Namespaces
org.openapitools.server.api
org.openapitools.server.model
src/impl/AMF3GPPAccessRegistrationDocumentApiImpl.cpp
View file @
497f7bc2
...
@@ -41,7 +41,18 @@ void AMF3GPPAccessRegistrationDocumentApiImpl::amf_context3gpp(const std::string
...
@@ -41,7 +41,18 @@ void AMF3GPPAccessRegistrationDocumentApiImpl::amf_context3gpp(const std::string
void
AMF3GPPAccessRegistrationDocumentApiImpl
::
create_amf_context3gpp
(
const
std
::
string
&
ueId
,
Amf3GppAccessRegistration
&
amf3GppAccessRegistration
,
Pistache
::
Http
::
ResponseWriter
&
response
)
{
void
AMF3GPPAccessRegistrationDocumentApiImpl
::
create_amf_context3gpp
(
const
std
::
string
&
ueId
,
Amf3GppAccessRegistration
&
amf3GppAccessRegistration
,
Pistache
::
Http
::
ResponseWriter
&
response
)
{
MYSQL_RES
*
res
=
NULL
;
MYSQL_RES
*
res
=
NULL
;
MYSQL_ROW
row
;
MYSQL_ROW
row
;
const
std
::
string
select_AMF3GPPAccessRegistration
=
"select * from Amf3GppAccessRegistration WHERE ueid='"
+
ueId
+
"'"
;
std
::
string
tmp_ueId
=
""
;
if
(
ueId
.
size
()
==
15
)
{
tmp_ueId
=
"imsi-"
+
ueId
;
}
else
{
tmp_ueId
=
ueId
;
}
const
std
::
string
select_AMF3GPPAccessRegistration
=
"select * from Amf3GppAccessRegistration WHERE ueid='"
+
tmp_ueId
+
"'"
;
std
::
string
query
;
std
::
string
query
;
nlohmann
::
json
j
;
nlohmann
::
json
j
;
...
@@ -121,11 +132,11 @@ void AMF3GPPAccessRegistrationDocumentApiImpl::create_amf_context3gpp(const std:
...
@@ -121,11 +132,11 @@ void AMF3GPPAccessRegistrationDocumentApiImpl::create_amf_context3gpp(const std:
query
+=
",guami='"
+
j
.
dump
()
+
"'"
;
query
+=
",guami='"
+
j
.
dump
()
+
"'"
;
to_json
(
j
,
amf3GppAccessRegistration
.
getRatType
());
to_json
(
j
,
amf3GppAccessRegistration
.
getRatType
());
query
+=
",ratType='"
+
j
.
dump
()
+
"'"
;
query
+=
",ratType='"
+
j
.
dump
()
+
"'"
;
query
+=
" where ueid='"
+
ueId
+
"'"
;
query
+=
" where ueid='"
+
tmp_
ueId
+
"'"
;
}
}
else
else
{
{
query
=
"insert into Amf3GppAccessRegistration set ueid='"
+
ueId
+
"'"
+
\
query
=
"insert into Amf3GppAccessRegistration set ueid='"
+
tmp_
ueId
+
"'"
+
\
",amfInstanceId='"
+
amf3GppAccessRegistration
.
getAmfInstanceId
()
+
"'"
+
\
",amfInstanceId='"
+
amf3GppAccessRegistration
.
getAmfInstanceId
()
+
"'"
+
\
(
amf3GppAccessRegistration
.
supportedFeaturesIsSet
()
?
",supportedFeatures='"
+
amf3GppAccessRegistration
.
getSupportedFeatures
()
+
"'"
:
""
)
+
\
(
amf3GppAccessRegistration
.
supportedFeaturesIsSet
()
?
",supportedFeatures='"
+
amf3GppAccessRegistration
.
getSupportedFeatures
()
+
"'"
:
""
)
+
\
(
amf3GppAccessRegistration
.
purgeFlagIsSet
()
?
(
amf3GppAccessRegistration
.
isPurgeFlag
()
?
",purgeFlag=1"
:
",purgeFlag=0"
)
:
""
)
+
\
(
amf3GppAccessRegistration
.
purgeFlagIsSet
()
?
(
amf3GppAccessRegistration
.
isPurgeFlag
()
?
",purgeFlag=1"
:
",purgeFlag=0"
)
:
""
)
+
\
...
@@ -211,8 +222,18 @@ void AMF3GPPAccessRegistrationDocumentApiImpl::query_amf_context3gpp(const std::
...
@@ -211,8 +222,18 @@ void AMF3GPPAccessRegistrationDocumentApiImpl::query_amf_context3gpp(const std::
nlohmann
::
json
j
;
nlohmann
::
json
j
;
std
::
string
tmp_ueId
=
""
;
if
(
ueId
.
size
()
==
15
)
{
tmp_ueId
=
"imsi-"
+
ueId
;
}
else
{
tmp_ueId
=
ueId
;
}
Amf3GppAccessRegistration
amf3gppaccessregistration
;
Amf3GppAccessRegistration
amf3gppaccessregistration
;
const
std
::
string
query
=
"select * from Amf3GppAccessRegistration WHERE ueid='"
+
ueId
+
"'"
;
const
std
::
string
query
=
"select * from Amf3GppAccessRegistration WHERE ueid='"
+
tmp_
ueId
+
"'"
;
if
(
mysql_real_query
(
mysql_WitcommUDRDB
,
query
.
c_str
(),
(
unsigned
long
)
query
.
size
()))
if
(
mysql_real_query
(
mysql_WitcommUDRDB
,
query
.
c_str
(),
(
unsigned
long
)
query
.
size
()))
{
{
...
...
src/impl/AccessAndMobilitySubscriptionDataDocumentApiImpl.cpp
View file @
497f7bc2
...
@@ -33,8 +33,18 @@ void AccessAndMobilitySubscriptionDataDocumentApiImpl::query_am_data(const std::
...
@@ -33,8 +33,18 @@ void AccessAndMobilitySubscriptionDataDocumentApiImpl::query_am_data(const std::
nlohmann
::
json
j
;
nlohmann
::
json
j
;
std
::
string
tmp_ueId
=
""
;
if
(
ueId
.
size
()
==
15
)
{
tmp_ueId
=
"imsi-"
+
ueId
;
}
else
{
tmp_ueId
=
ueId
;
}
AccessAndMobilitySubscriptionData
accessandmobilitysubscriptiondata
;
AccessAndMobilitySubscriptionData
accessandmobilitysubscriptiondata
;
const
std
::
string
query
=
"select * from AccessAndMobilitySubscriptionData WHERE ueid='"
+
ueId
+
"' and servingPlmnid='"
+
servingPlmnId
+
"'"
;
const
std
::
string
query
=
"select * from AccessAndMobilitySubscriptionData WHERE ueid='"
+
tmp_
ueId
+
"' and servingPlmnid='"
+
servingPlmnId
+
"'"
;
if
(
mysql_real_query
(
mysql_WitcommUDRDB
,
query
.
c_str
(),
(
unsigned
long
)
query
.
size
()))
if
(
mysql_real_query
(
mysql_WitcommUDRDB
,
query
.
c_str
(),
(
unsigned
long
)
query
.
size
()))
{
{
...
...
src/impl/AuthenticationStatusDocumentApiImpl.cpp
View file @
497f7bc2
...
@@ -30,7 +30,17 @@ void AuthenticationStatusDocumentApiImpl::create_authentication_status(const std
...
@@ -30,7 +30,17 @@ void AuthenticationStatusDocumentApiImpl::create_authentication_status(const std
//response.send(Pistache::Http::Code::Ok, "create_authentication_status\n");
//response.send(Pistache::Http::Code::Ok, "create_authentication_status\n");
MYSQL_RES
*
res
=
NULL
;
MYSQL_RES
*
res
=
NULL
;
MYSQL_ROW
row
;
MYSQL_ROW
row
;
const
std
::
string
select_AuthenticationStatus
=
"select * from AuthenticationStatus WHERE ueid='"
+
ueId
+
"'"
;
std
::
string
tmp_ueId
=
""
;
if
(
ueId
.
size
()
==
15
)
{
tmp_ueId
=
"imsi-"
+
ueId
;
}
else
{
tmp_ueId
=
ueId
;
}
const
std
::
string
select_AuthenticationStatus
=
"select * from AuthenticationStatus WHERE ueid='"
+
tmp_ueId
+
"'"
;
std
::
string
query
;
std
::
string
query
;
nlohmann
::
json
j
;
nlohmann
::
json
j
;
...
@@ -56,11 +66,11 @@ void AuthenticationStatusDocumentApiImpl::create_authentication_status(const std
...
@@ -56,11 +66,11 @@ void AuthenticationStatusDocumentApiImpl::create_authentication_status(const std
(
authEvent
.
authRemovalIndIsSet
()
?
(
authEvent
.
isAuthRemovalInd
()
?
",authRemovalInd=1"
:
",authRemovalInd=0"
)
:
""
);
(
authEvent
.
authRemovalIndIsSet
()
?
(
authEvent
.
isAuthRemovalInd
()
?
",authRemovalInd=1"
:
",authRemovalInd=0"
)
:
""
);
// to_json(j,authEvent.getAuthType());
// to_json(j,authEvent.getAuthType());
// query += ",authType='"+j.dump()+"'";
// query += ",authType='"+j.dump()+"'";
query
+=
" where ueid='"
+
ueId
+
"'"
;
query
+=
" where ueid='"
+
tmp_
ueId
+
"'"
;
}
}
else
else
{
{
query
=
"insert into AuthenticationStatus set ueid='"
+
ueId
+
"'"
+
\
query
=
"insert into AuthenticationStatus set ueid='"
+
tmp_
ueId
+
"'"
+
\
",nfInstanceId='"
+
authEvent
.
getNfInstanceId
()
+
"'"
+
\
",nfInstanceId='"
+
authEvent
.
getNfInstanceId
()
+
"'"
+
\
",success="
+
(
authEvent
.
isSuccess
()
?
"1"
:
"0"
)
+
\
",success="
+
(
authEvent
.
isSuccess
()
?
"1"
:
"0"
)
+
\
",timeStamp='"
+
authEvent
.
getTimeStamp
()
+
"'"
+
\
",timeStamp='"
+
authEvent
.
getTimeStamp
()
+
"'"
+
\
...
@@ -86,8 +96,17 @@ void AuthenticationStatusDocumentApiImpl::create_authentication_status(const std
...
@@ -86,8 +96,17 @@ void AuthenticationStatusDocumentApiImpl::create_authentication_status(const std
}
}
void
AuthenticationStatusDocumentApiImpl
::
delete_authentication_status
(
const
std
::
string
&
ueId
,
Pistache
::
Http
::
ResponseWriter
&
response
)
{
void
AuthenticationStatusDocumentApiImpl
::
delete_authentication_status
(
const
std
::
string
&
ueId
,
Pistache
::
Http
::
ResponseWriter
&
response
)
{
//response.send(Pistache::Http::Code::Ok, "delete_authentication_status\n");
std
::
string
tmp_ueId
=
""
;
const
std
::
string
query
=
"DELETE from AuthenticationStatus WHERE ueid='"
+
ueId
+
"'"
;
if
(
ueId
.
size
()
==
15
)
{
tmp_ueId
=
"imsi-"
+
ueId
;
}
else
{
tmp_ueId
=
ueId
;
}
const
std
::
string
query
=
"DELETE from AuthenticationStatus WHERE ueid='"
+
tmp_ueId
+
"'"
;
if
(
mysql_real_query
(
mysql_WitcommUDRDB
,
query
.
c_str
(),
(
unsigned
long
)
query
.
size
()))
if
(
mysql_real_query
(
mysql_WitcommUDRDB
,
query
.
c_str
(),
(
unsigned
long
)
query
.
size
()))
{
{
...
@@ -105,9 +124,18 @@ void AuthenticationStatusDocumentApiImpl::query_authentication_status(const std:
...
@@ -105,9 +124,18 @@ void AuthenticationStatusDocumentApiImpl::query_authentication_status(const std:
MYSQL_FIELD
*
field
=
nullptr
;
MYSQL_FIELD
*
field
=
nullptr
;
nlohmann
::
json
j
;
nlohmann
::
json
j
;
std
::
string
tmp_ueId
=
""
;
if
(
ueId
.
size
()
==
15
)
{
tmp_ueId
=
"imsi-"
+
ueId
;
}
else
{
tmp_ueId
=
ueId
;
}
AuthEvent
authenticationstatus
;
AuthEvent
authenticationstatus
;
const
std
::
string
query
=
"select * from AuthenticationStatus WHERE ueid='"
+
ueId
+
"'"
;
const
std
::
string
query
=
"select * from AuthenticationStatus WHERE ueid='"
+
tmp_
ueId
+
"'"
;
if
(
mysql_real_query
(
mysql_WitcommUDRDB
,
query
.
c_str
(),
(
unsigned
long
)
query
.
size
()))
if
(
mysql_real_query
(
mysql_WitcommUDRDB
,
query
.
c_str
(),
(
unsigned
long
)
query
.
size
()))
{
{
...
...
src/impl/AuthenticationSubscriptionDocumentApiImpl.cpp
View file @
497f7bc2
...
@@ -34,7 +34,16 @@ void AuthenticationSubscriptionDocumentApiImpl::modify_authentication_subscripti
...
@@ -34,7 +34,16 @@ void AuthenticationSubscriptionDocumentApiImpl::modify_authentication_subscripti
MYSQL_RES
*
res
=
NULL
;
MYSQL_RES
*
res
=
NULL
;
MYSQL_ROW
row
;
MYSQL_ROW
row
;
const
std
::
string
select_Authenticationsubscription
=
"select * from AuthenticationSubscription WHERE ueid='"
+
ueId
+
"'"
;
std
::
string
tmp_ueId
=
""
;
if
(
ueId
.
size
()
==
15
)
{
tmp_ueId
=
"imsi-"
+
ueId
;
}
else
{
tmp_ueId
=
ueId
;
}
const
std
::
string
select_Authenticationsubscription
=
"select * from AuthenticationSubscription WHERE ueid='"
+
tmp_ueId
+
"'"
;
std
::
string
query
;
std
::
string
query
;
nlohmann
::
json
j
,
tmp_j
;
nlohmann
::
json
j
,
tmp_j
;
...
@@ -48,14 +57,14 @@ void AuthenticationSubscriptionDocumentApiImpl::modify_authentication_subscripti
...
@@ -48,14 +57,14 @@ void AuthenticationSubscriptionDocumentApiImpl::modify_authentication_subscripti
if
(
mysql_real_query
(
mysql_WitcommUDRDB
,
select_Authenticationsubscription
.
c_str
(),
(
unsigned
long
)
select_Authenticationsubscription
.
size
()))
if
(
mysql_real_query
(
mysql_WitcommUDRDB
,
select_Authenticationsubscription
.
c_str
(),
(
unsigned
long
)
select_Authenticationsubscription
.
size
()))
{
{
Logger
::
udr_server
().
error
(
"mysql_real_query failure!SQL(%s)"
,
select_Authenticationsubscription
);
Logger
::
udr_server
().
error
(
"mysql_real_query failure!SQL(%s)"
,
select_Authenticationsubscription
.
c_str
()
);
return
;
return
;
}
}
res
=
mysql_store_result
(
mysql_WitcommUDRDB
);
res
=
mysql_store_result
(
mysql_WitcommUDRDB
);
if
(
res
==
NULL
)
if
(
res
==
NULL
)
{
{
Logger
::
udr_server
().
error
(
"mysql_store_result failure!SQL(%s)"
,
select_Authenticationsubscription
);
Logger
::
udr_server
().
error
(
"mysql_store_result failure!SQL(%s)"
,
select_Authenticationsubscription
.
c_str
()
);
return
;
return
;
}
}
if
(
mysql_num_rows
(
res
))
if
(
mysql_num_rows
(
res
))
...
@@ -65,11 +74,11 @@ void AuthenticationSubscriptionDocumentApiImpl::modify_authentication_subscripti
...
@@ -65,11 +74,11 @@ void AuthenticationSubscriptionDocumentApiImpl::modify_authentication_subscripti
to_json
(
sequencenumber_j
,
sequencenumber
);
to_json
(
sequencenumber_j
,
sequencenumber
);
query
+=
sequencenumber_j
.
dump
()
+
"'"
;
query
+=
sequencenumber_j
.
dump
()
+
"'"
;
query
+=
" where ueid='"
+
ueId
+
"'"
;
query
+=
" where ueid='"
+
tmp_
ueId
+
"'"
;
}
}
else
else
{
{
Logger
::
udr_server
().
error
(
"AuthenticationSubscription no data!
"
);
Logger
::
udr_server
().
error
(
"AuthenticationSubscription no data!
SQL(%s)"
,
select_Authenticationsubscription
.
c_str
()
);
}
}
mysql_free_result
(
res
);
mysql_free_result
(
res
);
...
@@ -77,7 +86,7 @@ void AuthenticationSubscriptionDocumentApiImpl::modify_authentication_subscripti
...
@@ -77,7 +86,7 @@ void AuthenticationSubscriptionDocumentApiImpl::modify_authentication_subscripti
// Logger::udr_server().debug("modify content: %s",query.c_str());
// Logger::udr_server().debug("modify content: %s",query.c_str());
if
(
mysql_real_query
(
mysql_WitcommUDRDB
,
query
.
c_str
(),
(
unsigned
long
)
query
.
size
()))
if
(
mysql_real_query
(
mysql_WitcommUDRDB
,
query
.
c_str
(),
(
unsigned
long
)
query
.
size
()))
{
{
Logger
::
udr_server
().
error
(
"update mysql failure!
"
);
Logger
::
udr_server
().
error
(
"update mysql failure!
SQL(%s)"
,
query
.
c_str
()
);
return
;
return
;
}
}
}
}
...
@@ -100,21 +109,30 @@ void AuthenticationSubscriptionDocumentApiImpl::read_authentication_subscription
...
@@ -100,21 +109,30 @@ void AuthenticationSubscriptionDocumentApiImpl::read_authentication_subscription
MYSQL_FIELD
*
field
=
nullptr
;
MYSQL_FIELD
*
field
=
nullptr
;
nlohmann
::
json
j
;
nlohmann
::
json
j
;
std
::
string
tmp_ueId
=
"s"
;
if
(
ueId
.
size
()
==
15
)
{
tmp_ueId
=
"imsi-"
+
ueId
;
}
else
{
tmp_ueId
=
ueId
;
}
AuthenticationSubscription
authenticationsubscription
;
AuthenticationSubscription
authenticationsubscription
;
const
std
::
string
query
=
"select * from AuthenticationSubscription WHERE ueid='"
+
ueId
+
"'"
;
const
std
::
string
query
=
"select * from AuthenticationSubscription WHERE ueid='"
+
tmp_
ueId
+
"'"
;
if
(
mysql_real_query
(
mysql_WitcommUDRDB
,
query
.
c_str
(),
(
unsigned
long
)
query
.
size
()))
if
(
mysql_real_query
(
mysql_WitcommUDRDB
,
query
.
c_str
(),
(
unsigned
long
)
query
.
size
()))
{
{
Logger
::
udr_server
().
error
(
"mysql_real_query failure!
"
);
Logger
::
udr_server
().
error
(
"mysql_real_query failure!
SQL(%s)"
,
query
.
c_str
()
);
return
;
return
;
}
}
res
=
mysql_store_result
(
mysql_WitcommUDRDB
);
res
=
mysql_store_result
(
mysql_WitcommUDRDB
);
if
(
res
==
NULL
)
if
(
res
==
NULL
)
{
{
Logger
::
udr_server
().
error
(
"mysql_store_result failure!
"
);
Logger
::
udr_server
().
error
(
"mysql_store_result failure!
SQL(%s)"
,
query
.
c_str
()
);
return
;
return
;
}
}
...
@@ -196,7 +214,7 @@ void AuthenticationSubscriptionDocumentApiImpl::read_authentication_subscription
...
@@ -196,7 +214,7 @@ void AuthenticationSubscriptionDocumentApiImpl::read_authentication_subscription
}
}
else
else
{
{
Logger
::
udr_server
().
error
(
"AuthenticationSubscription no data!
"
);
Logger
::
udr_server
().
error
(
"AuthenticationSubscription no data!
SQL(%s)"
,
query
.
c_str
()
);
}
}
mysql_free_result
(
res
);
mysql_free_result
(
res
);
...
...
src/impl/SDMSubscriptionDocumentApiImpl.cpp
View file @
497f7bc2
...
@@ -34,10 +34,20 @@ void SDMSubscriptionDocumentApiImpl::querysdm_subscription(const std::string &ue
...
@@ -34,10 +34,20 @@ void SDMSubscriptionDocumentApiImpl::querysdm_subscription(const std::string &ue
MYSQL_ROW
row
;
MYSQL_ROW
row
;
MYSQL_FIELD
*
field
=
nullptr
;
MYSQL_FIELD
*
field
=
nullptr
;
std
::
string
tmp_ueId
=
""
;
if
(
ueId
.
size
()
==
15
)
{
tmp_ueId
=
"imsi-"
+
ueId
;
}
else
{
tmp_ueId
=
ueId
;
}
nlohmann
::
json
j
;
nlohmann
::
json
j
;
SdmSubscription
SdmSubscriptions
;
SdmSubscription
SdmSubscriptions
;
const
std
::
string
query
=
"SELECT * from SdmSubscriptions WHERE ueid='"
+
ueId
+
"' AND subsId="
+
subsId
;
const
std
::
string
query
=
"SELECT * from SdmSubscriptions WHERE ueid='"
+
tmp_
ueId
+
"' AND subsId="
+
subsId
;
if
(
mysql_real_query
(
mysql_WitcommUDRDB
,
query
.
c_str
(),
(
unsigned
long
)
query
.
size
()))
if
(
mysql_real_query
(
mysql_WitcommUDRDB
,
query
.
c_str
(),
(
unsigned
long
)
query
.
size
()))
{
{
...
@@ -151,9 +161,19 @@ void SDMSubscriptionDocumentApiImpl::removesdm_subscriptions(const std::string &
...
@@ -151,9 +161,19 @@ void SDMSubscriptionDocumentApiImpl::removesdm_subscriptions(const std::string &
nlohmann
::
json
j
;
nlohmann
::
json
j
;
ProblemDetails
problemdetails
;
ProblemDetails
problemdetails
;
const
std
::
string
select_query
=
"SELECT * from SdmSubscriptions WHERE ueid='"
+
ueId
+
"' AND subsId="
+
subsId
;
std
::
string
tmp_ueId
=
""
;
if
(
ueId
.
size
()
==
15
)
{
tmp_ueId
=
"imsi-"
+
ueId
;
}
else
{
tmp_ueId
=
ueId
;
}
const
std
::
string
select_query
=
"SELECT * from SdmSubscriptions WHERE ueid='"
+
tmp_ueId
+
"' AND subsId="
+
subsId
;
const
std
::
string
query
=
"DELETE from SdmSubscriptions WHERE ueid='"
+
ueId
+
"' AND subsId="
+
subsId
;
const
std
::
string
query
=
"DELETE from SdmSubscriptions WHERE ueid='"
+
tmp_
ueId
+
"' AND subsId="
+
subsId
;
if
(
mysql_real_query
(
mysql_WitcommUDRDB
,
select_query
.
c_str
(),
(
unsigned
long
)
select_query
.
size
()))
if
(
mysql_real_query
(
mysql_WitcommUDRDB
,
select_query
.
c_str
(),
(
unsigned
long
)
select_query
.
size
()))
{
{
...
@@ -196,7 +216,18 @@ void SDMSubscriptionDocumentApiImpl::removesdm_subscriptions(const std::string &
...
@@ -196,7 +216,18 @@ void SDMSubscriptionDocumentApiImpl::removesdm_subscriptions(const std::string &
void
SDMSubscriptionDocumentApiImpl
::
updatesdmsubscriptions
(
const
std
::
string
&
ueId
,
const
std
::
string
&
subsId
,
SdmSubscription
&
sdmSubscription
,
Pistache
::
Http
::
ResponseWriter
&
response
)
{
void
SDMSubscriptionDocumentApiImpl
::
updatesdmsubscriptions
(
const
std
::
string
&
ueId
,
const
std
::
string
&
subsId
,
SdmSubscription
&
sdmSubscription
,
Pistache
::
Http
::
ResponseWriter
&
response
)
{
MYSQL_RES
*
res
=
NULL
;
MYSQL_RES
*
res
=
NULL
;
MYSQL_ROW
row
;
MYSQL_ROW
row
;
const
std
::
string
select_query
=
"SELECT * from SdmSubscriptions WHERE ueid='"
+
ueId
+
"' AND subsId="
+
subsId
;
std
::
string
tmp_ueId
=
""
;
if
(
ueId
.
size
()
==
15
)
{
tmp_ueId
=
"imsi-"
+
ueId
;
}
else
{
tmp_ueId
=
ueId
;
}
const
std
::
string
select_query
=
"SELECT * from SdmSubscriptions WHERE ueid='"
+
tmp_ueId
+
"' AND subsId="
+
subsId
;
std
::
string
query
;
std
::
string
query
;
nlohmann
::
json
j
;
nlohmann
::
json
j
;
ProblemDetails
problemdetails
;
ProblemDetails
problemdetails
;
...
@@ -254,7 +285,7 @@ void SDMSubscriptionDocumentApiImpl::updatesdmsubscriptions(const std::string &u
...
@@ -254,7 +285,7 @@ void SDMSubscriptionDocumentApiImpl::updatesdmsubscriptions(const std::string &u
query
+=
",monitoredResourceUris='"
+
MonitoredResourceUris_json
.
dump
()
+
"'"
;
query
+=
",monitoredResourceUris='"
+
MonitoredResourceUris_json
.
dump
()
+
"'"
;
query
+=
" where ueid='"
+
ueId
+
"' AND subsId="
+
subsId
;
query
+=
" where ueid='"
+
tmp_
ueId
+
"' AND subsId="
+
subsId
;
}
}
else
else
{
{
...
...
src/impl/SDMSubscriptionsCollectionApiImpl.cpp
View file @
497f7bc2
...
@@ -31,9 +31,19 @@ void SDMSubscriptionsCollectionApiImpl::create_sdm_subscriptions(const std::stri
...
@@ -31,9 +31,19 @@ void SDMSubscriptionsCollectionApiImpl::create_sdm_subscriptions(const std::stri
MYSQL_ROW
row
;
MYSQL_ROW
row
;
nlohmann
::
json
j
;
nlohmann
::
json
j
;
std
::
string
tmp_ueId
=
""
;
if
(
ueId
.
size
()
==
15
)
{
tmp_ueId
=
"imsi-"
+
ueId
;
}
else
{
tmp_ueId
=
ueId
;
}
int32_t
subsId
=
0
;
int32_t
subsId
=
0
;
int32_t
count
=
0
;
int32_t
count
=
0
;
std
::
string
query
=
"SELECT subsId from SdmSubscriptions WHERE ueid='"
+
ueId
+
"'"
;
std
::
string
query
=
"SELECT subsId from SdmSubscriptions WHERE ueid='"
+
tmp_
ueId
+
"'"
;
if
(
mysql_real_query
(
mysql_WitcommUDRDB
,
query
.
c_str
(),
(
unsigned
long
)
query
.
size
()))
if
(
mysql_real_query
(
mysql_WitcommUDRDB
,
query
.
c_str
(),
(
unsigned
long
)
query
.
size
()))
{
{
Logger
::
udr_server
().
error
(
"mysql_real_query failure!SQL(%s)"
,
query
.
c_str
());
Logger
::
udr_server
().
error
(
"mysql_real_query failure!SQL(%s)"
,
query
.
c_str
());
...
@@ -59,7 +69,7 @@ void SDMSubscriptionsCollectionApiImpl::create_sdm_subscriptions(const std::stri
...
@@ -59,7 +69,7 @@ void SDMSubscriptionsCollectionApiImpl::create_sdm_subscriptions(const std::stri
//****** add query *******
//****** add query *******
query
=
"insert into SdmSubscriptions set ueid='"
+
ueId
+
"'"
+
\
query
=
"insert into SdmSubscriptions set ueid='"
+
tmp_
ueId
+
"'"
+
\
",nfInstanceId='"
+
sdmSubscription
.
getNfInstanceId
()
+
"'"
+
\
",nfInstanceId='"
+
sdmSubscription
.
getNfInstanceId
()
+
"'"
+
\
(
sdmSubscription
.
implicitUnsubscribeIsSet
()
?
(
sdmSubscription
.
isImplicitUnsubscribe
()
?
",implicitUnsubscribe=1"
:
",implicitUnsubscribe=0"
)
:
""
)
+
\
(
sdmSubscription
.
implicitUnsubscribeIsSet
()
?
(
sdmSubscription
.
isImplicitUnsubscribe
()
?
",implicitUnsubscribe=1"
:
",implicitUnsubscribe=0"
)
:
""
)
+
\
(
sdmSubscription
.
expiresIsSet
()
?
",expires='"
+
sdmSubscription
.
getExpires
()
+
"'"
:
""
)
+
\
(
sdmSubscription
.
expiresIsSet
()
?
",expires='"
+
sdmSubscription
.
getExpires
()
+
"'"
:
""
)
+
\
...
@@ -127,7 +137,17 @@ void SDMSubscriptionsCollectionApiImpl::querysdmsubscriptions(const std::string
...
@@ -127,7 +137,17 @@ void SDMSubscriptionsCollectionApiImpl::querysdmsubscriptions(const std::string
nlohmann
::
json
j
,
tmp
;
nlohmann
::
json
j
,
tmp
;
const
std
::
string
query
=
"SELECT * from SdmSubscriptions WHERE ueid='"
+
ueId
+
"'"
;
std
::
string
tmp_ueId
=
""
;
if
(
ueId
.
size
()
==
15
)
{
tmp_ueId
=
"imsi-"
+
ueId
;
}
else
{
tmp_ueId
=
ueId
;
}
const
std
::
string
query
=
"SELECT * from SdmSubscriptions WHERE ueid='"
+
tmp_ueId
+
"'"
;
if
(
mysql_real_query
(
mysql_WitcommUDRDB
,
query
.
c_str
(),
(
unsigned
long
)
query
.
size
()))
if
(
mysql_real_query
(
mysql_WitcommUDRDB
,
query
.
c_str
(),
(
unsigned
long
)
query
.
size
()))
{
{
...
...
src/impl/SMFRegistrationDocumentApiImpl.cpp
View file @
497f7bc2
...
@@ -29,7 +29,18 @@ SMFRegistrationDocumentApiImpl::SMFRegistrationDocumentApiImpl(std::shared_ptr<P
...
@@ -29,7 +29,18 @@ SMFRegistrationDocumentApiImpl::SMFRegistrationDocumentApiImpl(std::shared_ptr<P
void
SMFRegistrationDocumentApiImpl
::
create_smf_context_non3gpp
(
const
std
::
string
&
ueId
,
const
int32_t
&
pduSessionId
,
const
SmfRegistration
&
smfRegistration
,
Pistache
::
Http
::
ResponseWriter
&
response
)
{
void
SMFRegistrationDocumentApiImpl
::
create_smf_context_non3gpp
(
const
std
::
string
&
ueId
,
const
int32_t
&
pduSessionId
,
const
SmfRegistration
&
smfRegistration
,
Pistache
::
Http
::
ResponseWriter
&
response
)
{
MYSQL_RES
*
res
=
NULL
;
MYSQL_RES
*
res
=
NULL
;
MYSQL_ROW
row
;
MYSQL_ROW
row
;
const
std
::
string
select_SmfRegistration
=
"SELECT * from SmfRegistrations WHERE ueid='"
+
ueId
+
"' AND subpduSessionId="
+
std
::
to_string
(
pduSessionId
);
std
::
string
tmp_ueId
=
""
;
if
(
ueId
.
size
()
==
15
)
{
tmp_ueId
=
"imsi-"
+
ueId
;
}
else
{
tmp_ueId
=
ueId
;
}
const
std
::
string
select_SmfRegistration
=
"SELECT * from SmfRegistrations WHERE ueid='"
+
tmp_ueId
+
"' AND subpduSessionId="
+
std
::
to_string
(
pduSessionId
);
std
::
string
query
;
std
::
string
query
;
nlohmann
::
json
j
;
nlohmann
::
json
j
;
...
@@ -74,11 +85,11 @@ void SMFRegistrationDocumentApiImpl::create_smf_context_non3gpp(const std::strin
...
@@ -74,11 +85,11 @@ void SMFRegistrationDocumentApiImpl::create_smf_context_non3gpp(const std::strin
query
+=
",singleNssai='"
+
j
.
dump
()
+
"'"
;
query
+=
",singleNssai='"
+
j
.
dump
()
+
"'"
;
to_json
(
j
,
smfRegistration
.
getPlmnId
());
to_json
(
j
,
smfRegistration
.
getPlmnId
());
query
+=
",plmnId='"
+
j
.
dump
()
+
"'"
;
query
+=
",plmnId='"
+
j
.
dump
()
+
"'"
;
query
+=
" where ueid='"
+
ueId
+
"' AND subpduSessionId="
+
std
::
to_string
(
pduSessionId
);
query
+=
" where ueid='"
+
tmp_
ueId
+
"' AND subpduSessionId="
+
std
::
to_string
(
pduSessionId
);
}
}
else
else
{
{
query
=
"insert into SmfRegistrations set ueid='"
+
ueId
+
"'"
+
\
query
=
"insert into SmfRegistrations set ueid='"
+
tmp_
ueId
+
"'"
+
\
",subpduSessionId="
+
std
::
to_string
(
pduSessionId
)
+
\
",subpduSessionId="
+
std
::
to_string
(
pduSessionId
)
+
\
",pduSessionId="
+
std
::
to_string
(
smfRegistration
.
getPduSessionId
())
+
\
",pduSessionId="
+
std
::
to_string
(
smfRegistration
.
getPduSessionId
())
+
\
",smfInstanceId='"
+
smfRegistration
.
getSmfInstanceId
()
+
"'"
+
\
",smfInstanceId='"
+
smfRegistration
.
getSmfInstanceId
()
+
"'"
+
\
...
@@ -124,7 +135,17 @@ void SMFRegistrationDocumentApiImpl::create_smf_context_non3gpp(const std::strin
...
@@ -124,7 +135,17 @@ void SMFRegistrationDocumentApiImpl::create_smf_context_non3gpp(const std::strin
Logger
::
udr_server
().
debug
(
"SmfRegistration PUT - json:
\n\"
%s
\"
"
,
out
.
c_str
());
Logger
::
udr_server
().
debug
(
"SmfRegistration PUT - json:
\n\"
%s
\"
"
,
out
.
c_str
());
}
}
void
SMFRegistrationDocumentApiImpl
::
delete_smf_context
(
const
std
::
string
&
ueId
,
const
int32_t
&
pduSessionId
,
Pistache
::
Http
::
ResponseWriter
&
response
)
{
void
SMFRegistrationDocumentApiImpl
::
delete_smf_context
(
const
std
::
string
&
ueId
,
const
int32_t
&
pduSessionId
,
Pistache
::
Http
::
ResponseWriter
&
response
)
{
const
std
::
string
query
=
"DELETE from SmfRegistrations WHERE ueid='"
+
ueId
+
"' AND subpduSessionId="
+
std
::
to_string
(
pduSessionId
);
std
::
string
tmp_ueId
=
""
;
if
(
ueId
.
size
()
==
15
)
{
tmp_ueId
=
"imsi-"
+
ueId
;
}
else
{
tmp_ueId
=
ueId
;
}
const
std
::
string
query
=
"DELETE from SmfRegistrations WHERE ueid='"
+
tmp_ueId
+
"' AND subpduSessionId="
+
std
::
to_string
(
pduSessionId
);
if
(
mysql_real_query
(
mysql_WitcommUDRDB
,
query
.
c_str
(),
(
unsigned
long
)
query
.
size
()))
if
(
mysql_real_query
(
mysql_WitcommUDRDB
,
query
.
c_str
(),
(
unsigned
long
)
query
.
size
()))
{
{
...
@@ -140,10 +161,20 @@ void SMFRegistrationDocumentApiImpl::query_smf_registration(const std::string &u
...
@@ -140,10 +161,20 @@ void SMFRegistrationDocumentApiImpl::query_smf_registration(const std::string &u
MYSQL_ROW
row
;
MYSQL_ROW
row
;
MYSQL_FIELD
*
field
=
nullptr
;
MYSQL_FIELD
*
field
=
nullptr
;
std
::
string
tmp_ueId
=
""
;
if
(
ueId
.
size
()
==
15
)
{
tmp_ueId
=
"imsi-"
+
ueId
;
}
else
{
tmp_ueId
=
ueId
;
}
nlohmann
::
json
j
;
nlohmann
::
json
j
;
SmfRegistration
smfregistration
;
SmfRegistration
smfregistration
;
const
std
::
string
query
=
"SELECT * from SmfRegistrations WHERE ueid='"
+
ueId
+
"' AND subpduSessionId="
+
std
::
to_string
(
pduSessionId
);
const
std
::
string
query
=
"SELECT * from SmfRegistrations WHERE ueid='"
+
tmp_
ueId
+
"' AND subpduSessionId="
+
std
::
to_string
(
pduSessionId
);
if
(
mysql_real_query
(
mysql_WitcommUDRDB
,
query
.
c_str
(),
(
unsigned
long
)
query
.
size
()))
if
(
mysql_real_query
(
mysql_WitcommUDRDB
,
query
.
c_str
(),
(
unsigned
long
)
query
.
size
()))
{
{
...
...
src/impl/SMFRegistrationsCollectionApiImpl.cpp
View file @
497f7bc2
...
@@ -31,11 +31,21 @@ void SMFRegistrationsCollectionApiImpl::query_smf_reg_list(const std::string &ue
...
@@ -31,11 +31,21 @@ void SMFRegistrationsCollectionApiImpl::query_smf_reg_list(const std::string &ue
MYSQL_ROW
row
;
MYSQL_ROW
row
;
MYSQL_FIELD
*
field
=
nullptr
;
MYSQL_FIELD
*
field
=
nullptr
;
std
::
string
tmp_ueId
=
""
;
if
(
ueId
.
size
()
==
15
)
{
tmp_ueId
=
"imsi-"
+
ueId
;
}
else
{
tmp_ueId
=
ueId
;
}
std
::
vector
<
std
::
string
>
fields
;
std
::
vector
<
std
::
string
>
fields
;
nlohmann
::
json
j
,
tmp
;
nlohmann
::
json
j
,
tmp
;
const
std
::
string
query
=
"SELECT * from SmfRegistrations WHERE ueid='"
+
ueId
+
"'"
;
const
std
::
string
query
=
"SELECT * from SmfRegistrations WHERE ueid='"
+
tmp_
ueId
+
"'"
;
if
(
mysql_real_query
(
mysql_WitcommUDRDB
,
query
.
c_str
(),
(
unsigned
long
)
query
.
size
()))
if
(
mysql_real_query
(
mysql_WitcommUDRDB
,
query
.
c_str
(),
(
unsigned
long
)
query
.
size
()))
{
{
...
...
src/impl/SMFSelectionSubscriptionDataDocumentApiImpl.cpp
View file @
497f7bc2
...
@@ -33,8 +33,18 @@ void SMFSelectionSubscriptionDataDocumentApiImpl::query_smf_select_data(const st
...
@@ -33,8 +33,18 @@ void SMFSelectionSubscriptionDataDocumentApiImpl::query_smf_select_data(const st
nlohmann
::
json
j
;
nlohmann
::
json
j
;
std
::
string
tmp_ueId
=
""
;
if
(
ueId
.
size
()
==
15
)
{
tmp_ueId
=
"imsi-"
+
ueId
;
}
else
{
tmp_ueId
=
ueId
;
}
SmfSelectionSubscriptionData
smfselectionsubscriptiondata
;
SmfSelectionSubscriptionData
smfselectionsubscriptiondata
;
const
std
::
string
query
=
"select * from SmfSelectionSubscriptionData WHERE ueid='"
+
ueId
+
"' and servingPlmnid='"
+
servingPlmnId
+
"'"
;
const
std
::
string
query
=
"select * from SmfSelectionSubscriptionData WHERE ueid='"
+
tmp_
ueId
+
"' and servingPlmnid='"
+
servingPlmnId
+
"'"
;
if
(
mysql_real_query
(
mysql_WitcommUDRDB
,
query
.
c_str
(),
(
unsigned
long
)
query
.
size
()))
if
(
mysql_real_query
(
mysql_WitcommUDRDB
,
query
.
c_str
(),
(
unsigned
long
)
query
.
size
()))
{
{
...
...
src/impl/SessionManagementSubscriptionDataApiImpl.cpp
View file @
497f7bc2
...
@@ -35,8 +35,18 @@ void SessionManagementSubscriptionDataApiImpl::query_sm_data(const std::string &
...
@@ -35,8 +35,18 @@ void SessionManagementSubscriptionDataApiImpl::query_sm_data(const std::string &
nlohmann
::
json
j
;
nlohmann
::
json
j
;
std
::
string
tmp_ueId
=
""
;
if
(
ueId
.
size
()
==
15
)
{
tmp_ueId
=
"imsi-"
+
ueId
;
}
else
{
tmp_ueId
=
ueId
;
}
SessionManagementSubscriptionData
sessionmanagementsubscriptiondata
;
SessionManagementSubscriptionData
sessionmanagementsubscriptiondata
;
const
std
::
string
query
=
"select * from SessionManagementSubscriptionData WHERE ueid='"
+
ueId
+
"' and servingPlmnid='"
+
servingPlmnId
+
"'"
;
const
std
::
string
query
=
"select * from SessionManagementSubscriptionData WHERE ueid='"
+
tmp_
ueId
+
"' and servingPlmnid='"
+
servingPlmnId
+
"'"
;
if
(
mysql_real_query
(
mysql_WitcommUDRDB
,
query
.
c_str
(),
(
unsigned
long
)
query
.
size
()))
if
(
mysql_real_query
(
mysql_WitcommUDRDB
,
query
.
c_str
(),
(
unsigned
long
)
query
.
size
()))
{
{
...
...
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