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
749f63c1
Commit
749f63c1
authored
May 30, 2022
by
Tien-Thinh Nguyen
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
First version with DB abstraction
parent
a75853e6
Changes
10
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
10 changed files
with
2044 additions
and
2107 deletions
+2044
-2107
src/common/logger.cpp
src/common/logger.cpp
+1
-0
src/common/logger.hpp
src/common/logger.hpp
+2
-0
src/udr_app/cassandra_db.cpp
src/udr_app/cassandra_db.cpp
+2
-1
src/udr_app/cassandra_db.hpp
src/udr_app/cassandra_db.hpp
+2
-2
src/udr_app/database_wrapper.hpp
src/udr_app/database_wrapper.hpp
+15
-149
src/udr_app/database_wrapper_abstraction.hpp
src/udr_app/database_wrapper_abstraction.hpp
+34
-9
src/udr_app/mysql_db.cpp
src/udr_app/mysql_db.cpp
+1806
-16
src/udr_app/mysql_db.hpp
src/udr_app/mysql_db.hpp
+15
-6
src/udr_app/udr_app.cpp
src/udr_app/udr_app.cpp
+164
-1923
src/udr_app/udr_app.hpp
src/udr_app/udr_app.hpp
+3
-1
No files found.
src/common/logger.cpp
View file @
749f63c1
...
@@ -71,6 +71,7 @@ void Logger::_init(
...
@@ -71,6 +71,7 @@ void Logger::_init(
m_udr_server
=
new
_Logger
(
"udr_server"
,
m_sinks
,
ss
.
str
().
c_str
());
m_udr_server
=
new
_Logger
(
"udr_server"
,
m_sinks
,
ss
.
str
().
c_str
());
m_udr_app
=
new
_Logger
(
"udr_app"
,
m_sinks
,
ss
.
str
().
c_str
());
m_udr_app
=
new
_Logger
(
"udr_app"
,
m_sinks
,
ss
.
str
().
c_str
());
m_udr_nrf
=
new
_Logger
(
"udr_nrf"
,
m_sinks
,
ss
.
str
().
c_str
());
m_udr_nrf
=
new
_Logger
(
"udr_nrf"
,
m_sinks
,
ss
.
str
().
c_str
());
m_udr_mysql
=
new
_Logger
(
"udr_mysql"
,
m_sinks
,
ss
.
str
().
c_str
());
}
}
//------------------------------------------------------------------------------
//------------------------------------------------------------------------------
...
...
src/common/logger.hpp
View file @
749f63c1
...
@@ -87,6 +87,7 @@ class Logger {
...
@@ -87,6 +87,7 @@ class Logger {
static
_Logger
&
config
()
{
return
*
singleton
().
m_config
;
}
static
_Logger
&
config
()
{
return
*
singleton
().
m_config
;
}
static
_Logger
&
udr_server
()
{
return
*
singleton
().
m_udr_server
;
}
static
_Logger
&
udr_server
()
{
return
*
singleton
().
m_udr_server
;
}
static
_Logger
&
udr_nrf
()
{
return
*
singleton
().
m_udr_nrf
;
}
static
_Logger
&
udr_nrf
()
{
return
*
singleton
().
m_udr_nrf
;
}
static
_Logger
&
udr_mysql
()
{
return
*
singleton
().
m_udr_mysql
;
}
private:
private:
static
Logger
*
m_singleton
;
static
Logger
*
m_singleton
;
...
@@ -109,6 +110,7 @@ class Logger {
...
@@ -109,6 +110,7 @@ class Logger {
_Logger
*
m_system
;
_Logger
*
m_system
;
_Logger
*
m_udr_server
;
_Logger
*
m_udr_server
;
_Logger
*
m_udr_nrf
;
_Logger
*
m_udr_nrf
;
_Logger
*
m_udr_mysql
;
};
};
#endif
#endif
src/udr_app/cassandra_db.cpp
View file @
749f63c1
...
@@ -139,7 +139,8 @@ bool cassandra_db::query_sdm_subscriptions(
...
@@ -139,7 +139,8 @@ bool cassandra_db::query_sdm_subscriptions(
//------------------------------------------------------------------------------
//------------------------------------------------------------------------------
bool
cassandra_db
::
query_sm_data
(
bool
cassandra_db
::
query_sm_data
(
const
std
::
string
&
ue_id
,
const
std
::
string
&
serving_plmn_id
,
const
std
::
string
&
ue_id
,
const
std
::
string
&
serving_plmn_id
,
nlohmann
::
json
&
json_data
,
oai
::
udr
::
model
::
Snssai
,
std
::
string
dnn
)
{
nlohmann
::
json
&
json_data
,
const
oai
::
udr
::
model
::
Snssai
&
,
const
std
::
string
&
dnn
)
{
return
true
;
return
true
;
}
}
...
...
src/udr_app/cassandra_db.hpp
View file @
749f63c1
...
@@ -80,8 +80,8 @@ class cassandra_db : public database_wrapper<cassandra_db> {
...
@@ -80,8 +80,8 @@ class cassandra_db : public database_wrapper<cassandra_db> {
bool
query_sm_data
(
bool
query_sm_data
(
const
std
::
string
&
ue_id
,
const
std
::
string
&
serving_plmn_id
,
const
std
::
string
&
ue_id
,
const
std
::
string
&
serving_plmn_id
,
nlohmann
::
json
&
json_data
,
oai
::
udr
::
model
::
Snssai
snssai
=
{},
nlohmann
::
json
&
json_data
,
const
oai
::
udr
::
model
::
Snssai
&
snssai
=
{},
std
::
string
dnn
=
{});
const
std
::
string
&
dnn
=
{});
bool
insert_smf_context_non_3gpp
(
bool
insert_smf_context_non_3gpp
(
const
std
::
string
&
ue_id
,
const
int32_t
&
pdu_session_id
,
const
std
::
string
&
ue_id
,
const
int32_t
&
pdu_session_id
,
...
...
src/udr_app/database_wrapper.hpp
View file @
749f63c1
...
@@ -43,11 +43,6 @@ class database_wrapper : public database_wrapper_abstraction {
...
@@ -43,11 +43,6 @@ class database_wrapper : public database_wrapper_abstraction {
}
}
*/
*/
/*
* Initialize a connection to the DB
* @param void
* @return true if successful, otherwise return false
*/
bool
initialize
()
override
{
bool
initialize
()
override
{
Logger
::
udr_app
().
debug
(
"Initialize from database_wrapper"
);
Logger
::
udr_app
().
debug
(
"Initialize from database_wrapper"
);
auto
derived
=
static_cast
<
DerivedT
*>
(
this
);
auto
derived
=
static_cast
<
DerivedT
*>
(
this
);
...
@@ -55,255 +50,126 @@ class database_wrapper : public database_wrapper_abstraction {
...
@@ -55,255 +50,126 @@ class database_wrapper : public database_wrapper_abstraction {
return
true
;
return
true
;
}
}
/*
* Close the connection established to the DB
* @param void
* @return true if successful, otherwise return false
*/
bool
close_connection
()
override
{
bool
close_connection
()
override
{
Logger
::
udr_app
().
debug
(
"Initialize from database_wrapper"
);
Logger
::
udr_app
().
debug
(
"Initialize from database_wrapper"
);
auto
derived
=
static_cast
<
DerivedT
*>
(
this
);
auto
derived
=
static_cast
<
DerivedT
*>
(
this
);
return
derived
->
close_connection
();
return
derived
->
close_connection
();
}
}
/*
* Insert a new item to the DB for the Authentication Subscription
* @param [const std::string&] id: UE Identity
* @param [nlohmann::json&] json_data: Data in Json format
* @return true if successful, otherwise return false
*/
bool
insert_authentication_subscription
(
bool
insert_authentication_subscription
(
const
std
::
string
&
id
,
const
nlohmann
::
json
&
json_data
)
override
{
const
std
::
string
&
id
,
const
nlohmann
::
json
&
json_data
)
override
{
return
true
;
return
true
;
}
}
/*
* Query an item from the DB for the Authentication Subscription
* @param [const std::string&] id: UE Identity
* @param [nlohmann::json&] json_data: Data in Json format
* @return true if successful, otherwise return false
*/
bool
query_authentication_subscription
(
bool
query_authentication_subscription
(
const
std
::
string
&
id
,
nlohmann
::
json
&
json_data
)
override
{
const
std
::
string
&
id
,
nlohmann
::
json
&
json_data
)
override
{
return
true
;
return
true
;
}
}
/*
* Update an item from the DB for the Authentication Subscription
* @param [const std::string&] id: UE Identity
* @param [nlohmann::json&] json_data: Data in Json format
* @return true if successful, otherwise return false
*/
bool
update_authentication_subscription
(
bool
update_authentication_subscription
(
const
std
::
string
&
id
,
const
nlohmann
::
json
&
json_data
)
override
{
const
std
::
string
&
id
,
const
std
::
vector
<
oai
::
udr
::
model
::
PatchItem
>&
patchItem
,
nlohmann
::
json
&
json_data
)
override
{
return
true
;
return
true
;
}
}
/*
* Delete an item from the DB for the Authentication Subscription
* @param [const std::string&] id: UE Identity
* @return true if successful, otherwise return false
*/
bool
delete_authentication_subscription
(
const
std
::
string
&
id
)
override
{
bool
delete_authentication_subscription
(
const
std
::
string
&
id
)
override
{
return
true
;
return
true
;
}
}
/*
* Query an item from the DB for AccessandMobilitySubscriptionData
* @param [const std::string&] ue_id: UE Identity
* @param [const std::string& ] serving_plmn_id: Serving PLMN ID
* @param [nlohmann::json&] json_data: Data in Json format
* @return true if successful, otherwise return false
*/
bool
query_am_data
(
bool
query_am_data
(
const
std
::
string
&
ue_id
,
const
std
::
string
&
serving_plmn_id
,
const
std
::
string
&
ue_id
,
const
std
::
string
&
serving_plmn_id
,
nlohmann
::
json
&
json_data
)
override
{
nlohmann
::
json
&
json_data
)
override
{
return
true
;
return
true
;
}
}
/*
* Insert an item into DB for AMF3GPPAccessRegistration Context
* @param [const std::string&] ue_id: UE Identity
* @param [nlohmann::json&] json_data: Data in Json format
* @return true if successful, otherwise return false
*/
bool
create_amf_context_3gpp
(
bool
create_amf_context_3gpp
(
const
std
::
string
&
ue_id
,
const
nlohmann
::
json
&
json_data
)
override
{
const
std
::
string
&
ue_id
,
oai
::
udr
::
model
::
Amf3GppAccessRegistration
&
amf3GppAccessRegistration
)
override
{
return
true
;
return
true
;
}
}
/*
* Query for an item from the DB for AMF3GPPAccessRegistration
* @param [const std::string&] ue_id: UE Identity
* @param [nlohmann::json&] json_data: Data in Json format
* @param [long code] code: HTTP response code
* @return true if successful, otherwise return false
*/
bool
query_amf_context_3gpp
(
bool
query_amf_context_3gpp
(
const
std
::
string
&
ue_id
,
nlohmann
::
json
&
json_data
)
override
{
const
std
::
string
&
ue_id
,
nlohmann
::
json
&
json_data
)
override
{
return
true
;
return
true
;
}
}
/*
* Insert a new item into the DB for AuthenticationStatus
* @param [const std::string&] ue_id: UE Identity
* @param [nlohmann::json&] json_data: Data in Json format
* @return true if successful, otherwise return false
*/
bool
insert_authentication_status
(
bool
insert_authentication_status
(
const
std
::
string
&
ue_id
,
const
nlohmann
::
json
&
json_data
)
override
{
const
std
::
string
&
ue_id
,
const
oai
::
udr
::
model
::
AuthEvent
&
authEvent
,
nlohmann
::
json
&
json_data
)
override
{
return
true
;
return
true
;
}
}
/*
* Delete an item from the DB for AuthenticationStatus
* @param [const std::string&] ue_id: UE Identity
* @return true if successful, otherwise return false
*/
bool
delete_authentication_status
(
const
std
::
string
&
ue_id
)
override
{
bool
delete_authentication_status
(
const
std
::
string
&
ue_id
)
override
{
return
true
;
return
true
;
}
}
/*
* Query for an item from the DB for AuthenticationStatus
* @param [const std::string&] ue_id: UE Identity
* @param [nlohmann::json&] json_data: Data in Json format
* @return true if successful, otherwise return false
*/
bool
query_authentication_status
(
bool
query_authentication_status
(
const
std
::
string
&
ue_id
,
nlohmann
::
json
&
json_data
)
override
{
const
std
::
string
&
ue_id
,
nlohmann
::
json
&
json_data
)
override
{
return
true
;
return
true
;
}
}
/*
* Query an item from the DB for SDMSubscription
* @param [const std::string&] ue_id: UE Identity
* @param [const std::string&] subs_id: subscription ID
* @param [nlohmann::json&] json_data: Data in Json format
* @return true if successful, otherwise return false
*/
bool
query_sdm_subscription
(
bool
query_sdm_subscription
(
const
std
::
string
&
ue_id
,
const
std
::
string
&
subs_id
,
const
std
::
string
&
ue_id
,
const
std
::
string
&
subs_id
,
nlohmann
::
json
&
json_data
)
override
{
nlohmann
::
json
&
json_data
)
override
{
return
true
;
return
true
;
}
}
/*
* Delete an item from the DB for SDMSubscription
* @param [const std::string&] ue_id: UE Identity
* @param [const std::string&] subs_id: subscription ID
* @return true if successful, otherwise return false
*/
bool
delete_sdm_subscription
(
bool
delete_sdm_subscription
(
const
std
::
string
&
ue_id
,
const
std
::
string
&
subs_id
)
override
{
const
std
::
string
&
ue_id
,
const
std
::
string
&
subs_id
)
override
{
return
true
;
return
true
;
}
}
/*
* Update an item from the DB for SDMSubscription
* @param [const std::string&] ue_id: UE Identity
* @param [const std::string&] subs_id: subscription ID
* @param [nlohmann::json&] json_data: Data in Json format
* @return true if successful, otherwise return false
*/
bool
update_sdm_subscription
(
bool
update_sdm_subscription
(
const
std
::
string
&
ue_id
,
const
std
::
string
&
subs_id
,
const
std
::
string
&
ue_id
,
const
std
::
string
&
subs_id
,
oai
::
udr
::
model
::
SdmSubscription
&
sdmSubscription
,
nlohmann
::
json
&
json_data
)
override
{
nlohmann
::
json
&
json_data
)
override
{
return
true
;
return
true
;
}
}
/*
* Insert a new item into the DB for SDMSubscriptions
* @param [const std::string&] ue_id: UE Identity
* @param [nlohmann::json&] json_data: Data in Json format
* @return true if successful, otherwise return false
*/
bool
create_sdm_subscriptions
(
bool
create_sdm_subscriptions
(
const
std
::
string
&
ue_id
,
nlohmann
::
json
&
json_data
)
override
{
const
std
::
string
&
ue_id
,
oai
::
udr
::
model
::
SdmSubscription
&
sdmSubscription
,
nlohmann
::
json
&
json_data
)
override
{
return
true
;
return
true
;
}
}
/*
* Query an item from the DB for SDMSubscriptions
* @param [const std::string&] ue_id: UE Identity
* @param [nlohmann::json&] json_data: Data in Json format
* @return true if successful, otherwise return false
*/
bool
query_sdm_subscriptions
(
bool
query_sdm_subscriptions
(
const
std
::
string
&
ue_id
,
nlohmann
::
json
&
json_data
)
override
{
const
std
::
string
&
ue_id
,
nlohmann
::
json
&
json_data
)
override
{
return
true
;
return
true
;
}
}
/*
* Query an item from the DB for SessionManagementSubscription
* @param [const std::string&] ue_id: UE Identity
* @param [const std::string&] serving_plmn_id: Serving PLMN ID
* @param [nlohmann::json&] json_data: Data in Json format
* @return true if successful, otherwise return false
*/
bool
query_sm_data
(
bool
query_sm_data
(
const
std
::
string
&
ue_id
,
const
std
::
string
&
serving_plmn_id
,
const
std
::
string
&
ue_id
,
const
std
::
string
&
serving_plmn_id
,
nlohmann
::
json
&
json_data
,
oai
::
udr
::
model
::
Snssai
snssai
=
{},
nlohmann
::
json
&
json_data
,
const
oai
::
udr
::
model
::
Snssai
&
snssai
=
{},
std
::
string
dnn
=
{})
override
{
const
std
::
string
&
dnn
=
{})
override
{
return
true
;
return
true
;
}
}
/*
* Insert an item into the DB for SMFRegistration
* @param [const std::string&] ue_id: UE Identity
* @param [const int32_t&] pdu_session_id: PDU Session ID
* @param [nlohmann::json&] json_data: Data in Json format
* @return true if successful, otherwise return false
*/
bool
insert_smf_context_non_3gpp
(
bool
insert_smf_context_non_3gpp
(
const
std
::
string
&
ue_id
,
const
int32_t
&
pdu_session_id
,
const
std
::
string
&
ue_id
,
const
int32_t
&
pdu_session_id
,
const
oai
::
udr
::
model
::
SmfRegistration
&
smfRegistration
,
nlohmann
::
json
&
json_data
)
override
{
nlohmann
::
json
&
json_data
)
override
{
return
true
;
return
true
;
}
}
/*
* Delete an item from the DB for SMFRegistration
* @param [const std::string&] ue_id: UE Identity
* @param [const int32_t&] pdu_session_id: PDU Session ID
* @return true if successful, otherwise return false
*/
bool
delete_smf_context
(
bool
delete_smf_context
(
const
std
::
string
&
ue_id
,
const
int32_t
&
pdu_session_id
)
override
{
const
std
::
string
&
ue_id
,
const
int32_t
&
pdu_session_id
)
override
{
return
true
;
return
true
;
}
}
/*
* Query an item from the DB SMFRegistration
* @param [const std::string&] ue_id: UE Identity
* @param [const int32_t&] pdu_session_id: PDU Session ID
* @param [nlohmann::json&] json_data: Data in Json format
* @return true if successful, otherwise return false
*/
bool
query_smf_registration
(
bool
query_smf_registration
(
const
std
::
string
&
ue_id
,
const
int32_t
&
pdu_session_id
,
const
std
::
string
&
ue_id
,
const
int32_t
&
pdu_session_id
,
nlohmann
::
json
&
json_data
)
override
{
nlohmann
::
json
&
json_data
)
override
{
return
true
;
return
true
;
}
}
/*
* Query an item from the DB for a request to retrieve
* SMFRegistrationsCollection (SMFRegistrationsCollectionApiImpl)
* @param [const std::string&] ue_id: UE Identity
* @param [nlohmann::json&] json_data: Data in Json format
* @return true if successful, otherwise return false
*/
bool
query_smf_reg_list
(
bool
query_smf_reg_list
(
const
std
::
string
&
ue_id
,
nlohmann
::
json
&
json_data
)
override
{
const
std
::
string
&
ue_id
,
nlohmann
::
json
&
json_data
)
override
{
return
true
;
return
true
;
}
}
/*
* Query an item from the DB for SMFSelectionSubscription
* @param [const std::string&] ue_id: UE Identity
* @param [const std::string&] serving_plmn_id: Serving PLMN ID
* @param [nlohmann::json&] json_data: Data in Json format
* @return true if successful, otherwise return false
*/
bool
query_smf_select_data
(
bool
query_smf_select_data
(
const
std
::
string
&
ue_id
,
const
std
::
string
&
serving_plmn_id
,
const
std
::
string
&
ue_id
,
const
std
::
string
&
serving_plmn_id
,
nlohmann
::
json
&
json_data
)
override
{
nlohmann
::
json
&
json_data
)
override
{
...
...
src/udr_app/database_wrapper_abstraction.hpp
View file @
749f63c1
...
@@ -25,6 +25,12 @@
...
@@ -25,6 +25,12 @@
#include "Snssai.h"
#include "Snssai.h"
#include "logger.hpp"
#include "logger.hpp"
#include "Amf3GppAccessRegistration.h"
#include "AuthEvent.h"
#include "PatchItem.h"
#include "SdmSubscription.h"
#include "SmfRegistration.h"
#include <nlohmann/json.hpp>
#include <nlohmann/json.hpp>
namespace
oai
::
udr
::
app
{
namespace
oai
::
udr
::
app
{
...
@@ -69,11 +75,15 @@ class database_wrapper_abstraction {
...
@@ -69,11 +75,15 @@ class database_wrapper_abstraction {
/*
/*
* Update an item from the DB for the Authentication Subscription
* Update an item from the DB for the Authentication Subscription
* @param [const std::string&] id: UE Identity
* @param [const std::string&] id: UE Identity
* @param [const std::vector<oai::udr::model::PatchItem>&] patchItem:
* patchItem
* @param [nlohmann::json&] json_data: Data in Json format
* @param [nlohmann::json&] json_data: Data in Json format
* @return true if successful, otherwise return false
* @return true if successful, otherwise return false
*/
*/
virtual
bool
update_authentication_subscription
(
virtual
bool
update_authentication_subscription
(
const
std
::
string
&
id
,
const
nlohmann
::
json
&
json_data
)
=
0
;
const
std
::
string
&
id
,
const
std
::
vector
<
oai
::
udr
::
model
::
PatchItem
>&
patchItem
,
nlohmann
::
json
&
json_data
)
=
0
;
/*
/*
* Delete an item from the DB for the Authentication Subscription
* Delete an item from the DB for the Authentication Subscription
...
@@ -96,11 +106,13 @@ class database_wrapper_abstraction {
...
@@ -96,11 +106,13 @@ class database_wrapper_abstraction {
/*
/*
* Insert an item into DB for AMF3GPPAccessRegistration Context
* Insert an item into DB for AMF3GPPAccessRegistration Context
* @param [const std::string&] ue_id: UE Identity
* @param [const std::string&] ue_id: UE Identity
* @param [nlohmann::json&] json_data: Data in Json format
* @param [oai::udr::model::Amf3GppAccessRegistration&]
* amf3GppAccessRegistration: Context to be stored
* @return true if successful, otherwise return false
* @return true if successful, otherwise return false
*/
*/
virtual
bool
create_amf_context_3gpp
(
virtual
bool
create_amf_context_3gpp
(
const
std
::
string
&
ue_id
,
const
nlohmann
::
json
&
json_data
)
=
0
;
const
std
::
string
&
ue_id
,
oai
::
udr
::
model
::
Amf3GppAccessRegistration
&
amf3GppAccessRegistration
)
=
0
;
/*
/*
* Query for an item from the DB for AMF3GPPAccessRegistration
* Query for an item from the DB for AMF3GPPAccessRegistration
...
@@ -115,11 +127,13 @@ class database_wrapper_abstraction {
...
@@ -115,11 +127,13 @@ class database_wrapper_abstraction {
/*
/*
* Insert a new item into the DB for AuthenticationStatus
* Insert a new item into the DB for AuthenticationStatus
* @param [const std::string&] ue_id: UE Identity
* @param [const std::string&] ue_id: UE Identity
* @param [const AuthEvent&] authEvent: Authentication Status data
* @param [nlohmann::json&] json_data: Data in Json format
* @param [nlohmann::json&] json_data: Data in Json format
* @return true if successful, otherwise return false
* @return true if successful, otherwise return false
*/
*/
virtual
bool
insert_authentication_status
(
virtual
bool
insert_authentication_status
(
const
std
::
string
&
ue_id
,
const
nlohmann
::
json
&
json_data
)
=
0
;
const
std
::
string
&
ue_id
,
const
oai
::
udr
::
model
::
AuthEvent
&
authEvent
,
nlohmann
::
json
&
json_data
)
=
0
;
/*
/*
* Delete an item from the DB for AuthenticationStatus
* Delete an item from the DB for AuthenticationStatus
...
@@ -161,21 +175,28 @@ class database_wrapper_abstraction {
...
@@ -161,21 +175,28 @@ class database_wrapper_abstraction {
* Update an item from the DB for SDMSubscription
* Update an item from the DB for SDMSubscription
* @param [const std::string&] ue_id: UE Identity
* @param [const std::string&] ue_id: UE Identity
* @param [const std::string&] subs_id: subscription ID
* @param [const std::string&] subs_id: subscription ID
* @param [oai::udr::model::SdmSubscription&] sdmSubscription: Subscription
* information
* @param [nlohmann::json&] json_data: Data in Json format
* @param [nlohmann::json&] json_data: Data in Json format
* @return true if successful, otherwise return false
* @return true if successful, otherwise return false
*/
*/
virtual
bool
update_sdm_subscription
(
virtual
bool
update_sdm_subscription
(
const
std
::
string
&
ue_id
,
const
std
::
string
&
subs_id
,
const
std
::
string
&
ue_id
,
const
std
::
string
&
subs_id
,
oai
::
udr
::
model
::
SdmSubscription
&
sdmSubscription
,
nlohmann
::
json
&
json_data
)
=
0
;
nlohmann
::
json
&
json_data
)
=
0
;
/*
/*
* Insert a new item into the DB for SDMSubscriptions
* Insert a new item into the DB for SDMSubscriptions
* @param [const std::string&] ue_id: UE Identity
* @param [const std::string&] ue_id: UE Identity
* @param [nlohmann::json&] json_data: Data in Json format
* @param [nlohmann::json&] json_data: Data in Json format
* @param [oai::udr::model::SdmSubscription&] sdmSubscription: Subscription
* information
* @return true if successful, otherwise return false
* @return true if successful, otherwise return false
*/
*/
virtual
bool
create_sdm_subscriptions
(
virtual
bool
create_sdm_subscriptions
(
const
std
::
string
&
ue_id
,
nlohmann
::
json
&
json_data
)
=
0
;
const
std
::
string
&
ue_id
,
oai
::
udr
::
model
::
SdmSubscription
&
sdmSubscription
,
nlohmann
::
json
&
json_data
)
=
0
;
/*
/*
* Query an item from the DB for SDMSubscriptions
* Query an item from the DB for SDMSubscriptions
...
@@ -191,22 +212,27 @@ class database_wrapper_abstraction {
...
@@ -191,22 +212,27 @@ class database_wrapper_abstraction {
* @param [const std::string&] ue_id: UE Identity
* @param [const std::string&] ue_id: UE Identity
* @param [const std::string&] serving_plmn_id: Serving PLMN ID
* @param [const std::string&] serving_plmn_id: Serving PLMN ID
* @param [nlohmann::json&] json_data: Data in Json format
* @param [nlohmann::json&] json_data: Data in Json format
* @param [const oai::udr::model::Snssai&] snssai: SNSSAI
* @param [const std::string&] dnn: DNN
* @return true if successful, otherwise return false
* @return true if successful, otherwise return false
*/
*/
virtual
bool
query_sm_data
(
virtual
bool
query_sm_data
(
const
std
::
string
&
ue_id
,
const
std
::
string
&
serving_plmn_id
,
const
std
::
string
&
ue_id
,
const
std
::
string
&
serving_plmn_id
,
nlohmann
::
json
&
json_data
,
oai
::
udr
::
model
::
Snssai
snssai
=
{},
nlohmann
::
json
&
json_data
,
const
oai
::
udr
::
model
::
Snssai
&
snssai
=
{},
std
::
string
dnn
=
{})
=
0
;
const
std
::
string
&
dnn
=
{})
=
0
;
/*
/*
* Insert an item into the DB for SMFRegistration
* Insert an item into the DB for SMFRegistration
* @param [const std::string&] ue_id: UE Identity
* @param [const std::string&] ue_id: UE Identity
* @param [const int32_t&] pdu_session_id: PDU Session ID
* @param [const int32_t&] pdu_session_id: PDU Session ID
* @param [const oai::udr::model::SmfRegistration&] smfRegistration: SMF
* Registration data
* @param [nlohmann::json&] json_data: Data in Json format
* @param [nlohmann::json&] json_data: Data in Json format
* @return true if successful, otherwise return false
* @return true if successful, otherwise return false
*/
*/
virtual
bool
insert_smf_context_non_3gpp
(
virtual
bool
insert_smf_context_non_3gpp
(
const
std
::
string
&
ue_id
,
const
int32_t
&
pdu_session_id
,
const
std
::
string
&
ue_id
,
const
int32_t
&
pdu_session_id
,
const
oai
::
udr
::
model
::
SmfRegistration
&
smfRegistration
,
nlohmann
::
json
&
json_data
)
=
0
;
nlohmann
::
json
&
json_data
)
=
0
;
/*
/*
...
@@ -230,8 +256,7 @@ class database_wrapper_abstraction {
...
@@ -230,8 +256,7 @@ class database_wrapper_abstraction {
nlohmann
::
json
&
json_data
)
=
0
;
nlohmann
::
json
&
json_data
)
=
0
;
/*
/*
* Query an item from the DB for a request to retrieve
* Query an item from the DB for SMFRegistrationsCollection
* SMFRegistrationsCollection (SMFRegistrationsCollectionApiImpl)
* @param [const std::string&] ue_id: UE Identity
* @param [const std::string&] ue_id: UE Identity
* @param [nlohmann::json&] json_data: Data in Json format
* @param [nlohmann::json&] json_data: Data in Json format
* @return true if successful, otherwise return false
* @return true if successful, otherwise return false
...
...
src/udr_app/mysql_db.cpp
View file @
749f63c1
This diff is collapsed.
Click to expand it.
src/udr_app/mysql_db.hpp
View file @
749f63c1
...
@@ -23,6 +23,7 @@
...
@@ -23,6 +23,7 @@
#define MYSQL_DB_HPP
#define MYSQL_DB_HPP
#include "database_wrapper.hpp"
#include "database_wrapper.hpp"
#include "Amf3GppAccessRegistration.h"
#include <mysql/mysql.h>
#include <mysql/mysql.h>
namespace
oai
::
udr
::
app
{
namespace
oai
::
udr
::
app
{
...
@@ -41,7 +42,9 @@ class mysql_db : public database_wrapper<mysql_db> {
...
@@ -41,7 +42,9 @@ class mysql_db : public database_wrapper<mysql_db> {
bool
query_authentication_subscription
(
bool
query_authentication_subscription
(
const
std
::
string
&
id
,
nlohmann
::
json
&
json_data
);
const
std
::
string
&
id
,
nlohmann
::
json
&
json_data
);
bool
update_authentication_subscription
(
bool
update_authentication_subscription
(
const
std
::
string
&
id
,
const
nlohmann
::
json
&
json_data
);
const
std
::
string
&
id
,
const
std
::
vector
<
oai
::
udr
::
model
::
PatchItem
>&
patchItem
,
nlohmann
::
json
&
json_data
);
bool
delete_authentication_subscription
(
const
std
::
string
&
id
);
bool
delete_authentication_subscription
(
const
std
::
string
&
id
);
bool
query_am_data
(
bool
query_am_data
(
...
@@ -49,13 +52,15 @@ class mysql_db : public database_wrapper<mysql_db> {
...
@@ -49,13 +52,15 @@ class mysql_db : public database_wrapper<mysql_db> {
nlohmann
::
json
&
json_data
);
nlohmann
::
json
&
json_data
);
bool
create_amf_context_3gpp
(
bool
create_amf_context_3gpp
(
const
std
::
string
&
ue_id
,
const
nlohmann
::
json
&
json_data
);
const
std
::
string
&
ue_id
,
oai
::
udr
::
model
::
Amf3GppAccessRegistration
&
amf3GppAccessRegistration
);
bool
query_amf_context_3gpp
(
bool
query_amf_context_3gpp
(
const
std
::
string
&
ue_id
,
nlohmann
::
json
&
json_data
);
const
std
::
string
&
ue_id
,
nlohmann
::
json
&
json_data
);
bool
insert_authentication_status
(
bool
insert_authentication_status
(
const
std
::
string
&
ue_id
,
const
nlohmann
::
json
&
json_data
);
const
std
::
string
&
ue_id
,
const
oai
::
udr
::
model
::
AuthEvent
&
authEvent
,
nlohmann
::
json
&
json_data
);
bool
delete_authentication_status
(
const
std
::
string
&
ue_id
);
bool
delete_authentication_status
(
const
std
::
string
&
ue_id
);
...
@@ -71,21 +76,25 @@ class mysql_db : public database_wrapper<mysql_db> {
...
@@ -71,21 +76,25 @@ class mysql_db : public database_wrapper<mysql_db> {
bool
update_sdm_subscription
(
bool
update_sdm_subscription
(
const
std
::
string
&
ue_id
,
const
std
::
string
&
subs_id
,
const
std
::
string
&
ue_id
,
const
std
::
string
&
subs_id
,
oai
::
udr
::
model
::
SdmSubscription
&
sdmSubscription
,
nlohmann
::
json
&
json_data
);
nlohmann
::
json
&
json_data
);
bool
create_sdm_subscriptions
(
bool
create_sdm_subscriptions
(
const
std
::
string
&
ue_id
,
nlohmann
::
json
&
json_data
);
const
std
::
string
&
ue_id
,
oai
::
udr
::
model
::
SdmSubscription
&
sdmSubscription
,
nlohmann
::
json
&
json_data
);
bool
query_sdm_subscriptions
(
bool
query_sdm_subscriptions
(
const
std
::
string
&
ue_id
,
nlohmann
::
json
&
json_data
);
const
std
::
string
&
ue_id
,
nlohmann
::
json
&
json_data
);
bool
query_sm_data
(
bool
query_sm_data
(
const
std
::
string
&
ue_id
,
const
std
::
string
&
serving_plmn_id
,
const
std
::
string
&
ue_id
,
const
std
::
string
&
serving_plmn_id
,
nlohmann
::
json
&
json_data
,
oai
::
udr
::
model
::
Snssai
snssai
=
{},
nlohmann
::
json
&
json_data
,
const
oai
::
udr
::
model
::
Snssai
&
snssai
=
{},
std
::
string
dnn
=
{});
const
std
::
string
dnn
=
{});
bool
insert_smf_context_non_3gpp
(
bool
insert_smf_context_non_3gpp
(
const
std
::
string
&
ue_id
,
const
int32_t
&
pdu_session_id
,
const
std
::
string
&
ue_id
,
const
int32_t
&
pdu_session_id
,
const
oai
::
udr
::
model
::
SmfRegistration
&
smfRegistration
,
nlohmann
::
json
&
json_data
);
nlohmann
::
json
&
json_data
);
bool
delete_smf_context
(
bool
delete_smf_context
(
...
...
src/udr_app/udr_app.cpp
View file @
749f63c1
This diff is collapsed.
Click to expand it.
src/udr_app/udr_app.hpp
View file @
749f63c1
...
@@ -243,13 +243,15 @@ class udr_app {
...
@@ -243,13 +243,15 @@ class udr_app {
* @param [const std::string&] ue_id: UE Identity
* @param [const std::string&] ue_id: UE Identity
* @param [const std::string&] serving_plmn_id: Serving PLMN ID
* @param [const std::string&] serving_plmn_id: Serving PLMN ID
* @param [nlohmann::json&] response_data: Response in Json format
* @param [nlohmann::json&] response_data: Response in Json format
* @param [const oai::udr::model::Snssai&] snssai: SNSSAI
* @param [const std::string&] dnn: DNN
* @param [long code] code: HTTP response code
* @param [long code] code: HTTP response code
* @return void
* @return void
*/
*/
void
handle_query_sm_data
(
void
handle_query_sm_data
(
const
std
::
string
&
ue_id
,
const
std
::
string
&
serving_plmn_id
,
const
std
::
string
&
ue_id
,
const
std
::
string
&
serving_plmn_id
,
nlohmann
::
json
&
response_data
,
long
&
code
,
nlohmann
::
json
&
response_data
,
long
&
code
,
oai
::
udr
::
model
::
Snssai
snssai
=
{},
std
::
string
dnn
=
{});
const
oai
::
udr
::
model
::
Snssai
&
snssai
=
{},
const
std
::
string
&
dnn
=
{});
/*
/*
* Handle a request to create SMFRegistration (SMFRegistrationDocumentApiImpl)
* Handle a request to create SMFRegistration (SMFRegistrationDocumentApiImpl)
...
...
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