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
291b70ac
Commit
291b70ac
authored
Jun 22, 2022
by
Tien Thinh NGUYEN
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Apply Clang-format
parent
9943bed1
Changes
28
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
28 changed files
with
1171 additions
and
1213 deletions
+1171
-1213
src/api_server/udr-api-server.h
src/api_server/udr-api-server.h
+1
-2
src/api_server/udr-http2-server.cpp
src/api_server/udr-http2-server.cpp
+2
-1
src/api_server/udr-http2-server.h
src/api_server/udr-http2-server.h
+2
-1
src/common/fqdn.cpp
src/common/fqdn.cpp
+3
-1
src/common/if.cpp
src/common/if.cpp
+4
-2
src/common/logger.cpp
src/common/logger.cpp
+2
-1
src/common/string.cpp
src/common/string.cpp
+4
-2
src/common/string.hpp
src/common/string.hpp
+1
-0
src/udr_app/cassandra_db.cpp
src/udr_app/cassandra_db.cpp
+28
-31
src/udr_app/cassandra_db.hpp
src/udr_app/cassandra_db.hpp
+36
-35
src/udr_app/database_wrapper.hpp
src/udr_app/database_wrapper.hpp
+48
-48
src/udr_app/database_wrapper_abstraction.hpp
src/udr_app/database_wrapper_abstraction.hpp
+33
-32
src/udr_app/mysql_db.cpp
src/udr_app/mysql_db.cpp
+621
-653
src/udr_app/mysql_db.hpp
src/udr_app/mysql_db.hpp
+34
-33
src/udr_app/task_manager.cpp
src/udr_app/task_manager.cpp
+5
-7
src/udr_app/task_manager.hpp
src/udr_app/task_manager.hpp
+1
-1
src/udr_app/udr_app.cpp
src/udr_app/udr_app.cpp
+89
-76
src/udr_app/udr_app.hpp
src/udr_app/udr_app.hpp
+58
-48
src/udr_app/udr_client.cpp
src/udr_app/udr_client.cpp
+16
-17
src/udr_app/udr_client.hpp
src/udr_app/udr_client.hpp
+4
-5
src/udr_app/udr_config.cpp
src/udr_app/udr_config.cpp
+83
-89
src/udr_app/udr_event.cpp
src/udr_app/udr_event.cpp
+2
-2
src/udr_app/udr_event.hpp
src/udr_app/udr_event.hpp
+4
-3
src/udr_app/udr_event_sig.hpp
src/udr_app/udr_event_sig.hpp
+3
-3
src/udr_app/udr_nrf.cpp
src/udr_app/udr_nrf.cpp
+20
-20
src/udr_app/udr_nrf.hpp
src/udr_app/udr_nrf.hpp
+4
-4
src/udr_app/udr_profile.cpp
src/udr_app/udr_profile.cpp
+49
-82
src/udr_app/udr_profile.hpp
src/udr_app/udr_profile.hpp
+14
-14
No files found.
src/api_server/udr-api-server.h
View file @
291b70ac
...
...
@@ -46,16 +46,15 @@
#include "AMF3GPPAccessRegistrationDocumentApiImpl.h"
#include "AccessAndMobilitySubscriptionDataDocumentApiImpl.h"
#include "AuthenticationDataDocumentApiImpl.h"
#include "AuthenticationStatusDocumentApiImpl.h"
#include "AuthenticationSubscriptionDocumentApiImpl.h"
#include "AuthenticationDataDocumentApiImpl.h"
#include "SDMSubscriptionDocumentApiImpl.h"
#include "SDMSubscriptionsCollectionApiImpl.h"
#include "SMFRegistrationDocumentApiImpl.h"
#include "SMFRegistrationsCollectionApiImpl.h"
#include "SMFSelectionSubscriptionDataDocumentApiImpl.h"
#include "SessionManagementSubscriptionDataApiImpl.h"
#include "udr_app.hpp"
using
namespace
oai
::
udr
::
app
;
...
...
src/api_server/udr-http2-server.cpp
View file @
291b70ac
...
...
@@ -28,7 +28,7 @@
*/
#include "udr-http2-server.h"
#include "string.hpp"
#include <boost/algorithm/string.hpp>
#include <boost/thread.hpp>
#include <boost/thread/future.hpp>
...
...
@@ -38,6 +38,7 @@
#include "3gpp_29.500.h"
#include "logger.hpp"
#include "string.hpp"
#include "udr.h"
#include "udr_config.hpp"
...
...
src/api_server/udr-http2-server.h
View file @
291b70ac
...
...
@@ -30,13 +30,14 @@
#ifndef FILE_UDR_HTTP2_SERVER_SEEN
#define FILE_UDR_HTTP2_SERVER_SEEN
#include <nghttp2/asio_http2_server.h>
#include "Amf3GppAccessRegistration.h"
#include "AuthEvent.h"
#include "PatchItem.h"
#include "SdmSubscription.h"
#include "SmfRegistration.h"
#include "udr_app.hpp"
#include <nghttp2/asio_http2_server.h>
using
namespace
nghttp2
::
asio_http2
;
using
namespace
nghttp2
::
asio_http2
::
server
;
...
...
src/common/fqdn.cpp
View file @
291b70ac
...
...
@@ -20,10 +20,12 @@
*/
#include "fqdn.hpp"
#include "logger.hpp"
#include <boost/asio.hpp>
#include <iostream>
#include "logger.hpp"
bool
fqdn
::
resolve
(
const
std
::
string
&
host_name
,
std
::
string
&
address
,
uint32_t
&
port
,
uint8_t
&
addr_type
,
const
std
::
string
&
protocol
)
{
...
...
src/common/if.cpp
View file @
291b70ac
...
...
@@ -14,8 +14,7 @@
*/
#include "if.hpp"
#include "common_defs.h"
#include "logger.hpp"
#include <arpa/inet.h>
#include <errno.h>
#include <linux/netlink.h>
...
...
@@ -28,6 +27,9 @@
#include <sys/socket.h>
#include <unistd.h>
#include "common_defs.h"
#include "logger.hpp"
#define BUFFER_SIZE 4096
//------------------------------------------------------------------------------
...
...
src/common/logger.cpp
View file @
291b70ac
...
...
@@ -26,13 +26,14 @@
*/
#include "logger.hpp"
#include "spdlog/sinks/syslog_sink.h"
#include <iostream>
#include <memory>
#include <sstream>
#include <string>
#include "spdlog/sinks/syslog_sink.h"
Logger
*
Logger
::
m_singleton
=
NULL
;
//------------------------------------------------------------------------------
...
...
src/common/string.cpp
View file @
291b70ac
...
...
@@ -19,14 +19,16 @@
* contact@openairinterface.org
*/
#include "string.hpp"
#include "logger.hpp"
#include <stdarg.h>
#include <algorithm>
#include <cctype>
#include <functional>
#include <locale>
#include <regex>
#include <stdarg.h>
#include "logger.hpp"
template
<
class
T
>
class
Buffer
{
...
...
src/common/string.hpp
View file @
291b70ac
...
...
@@ -29,6 +29,7 @@
#define FILE_STRING_HPP_FILE_SEEN
#include <arpa/inet.h>
#include <string>
namespace
util
{
...
...
src/udr_app/cassandra_db.cpp
View file @
291b70ac
...
...
@@ -21,10 +21,10 @@
/*! \file cassandra_db.cpp
\brief
\author
Tien-Thinh NGUYEN
\author
\company Eurecom
\date 2022
\email:
Tien-Thinh.Nguyen@eurecom.fr
\email:
contact@openairinterface.org
*/
#include "cassandra_db.hpp"
...
...
@@ -52,14 +52,10 @@ bool cassandra_db::initialize() {
}
//------------------------------------------------------------------------------
bool
cassandra_db
::
connect
(
uint32_t
num_retries
)
{
return
true
;
}
bool
cassandra_db
::
connect
(
uint32_t
num_retries
)
{
return
true
;
}
//------------------------------------------------------------------------------
bool
cassandra_db
::
close_connection
()
{
return
true
;
}
bool
cassandra_db
::
close_connection
()
{
return
true
;
}
//------------------------------------------------------------------------------
bool
cassandra_db
::
insert_authentication_subscription
(
...
...
@@ -91,21 +87,21 @@ bool cassandra_db::update_authentication_subscription(
}
//------------------------------------------------------------------------------
bool
cassandra_db
::
query_am_data
(
const
std
::
string
&
ue_id
,
const
std
::
string
&
serving_plmn_id
,
nlohmann
::
json
&
json_data
)
{
bool
cassandra_db
::
query_am_data
(
const
std
::
string
&
ue_id
,
const
std
::
string
&
serving_plmn_id
,
nlohmann
::
json
&
json_data
)
{
return
true
;
}
//------------------------------------------------------------------------------
bool
cassandra_db
::
create_amf_context_3gpp
(
const
std
::
string
&
ue_id
,
const
nlohmann
::
json
&
json_data
)
{
bool
cassandra_db
::
create_amf_context_3gpp
(
const
std
::
string
&
ue_id
,
const
nlohmann
::
json
&
json_data
)
{
return
true
;
}
//------------------------------------------------------------------------------
bool
cassandra_db
::
query_amf_context_3gpp
(
const
std
::
string
&
ue_id
,
nlohmann
::
json
&
json_data
)
{
bool
cassandra_db
::
query_amf_context_3gpp
(
const
std
::
string
&
ue_id
,
nlohmann
::
json
&
json_data
)
{
return
true
;
}
...
...
@@ -157,16 +153,17 @@ bool cassandra_db::create_sdm_subscriptions(
}
//------------------------------------------------------------------------------
bool
cassandra_db
::
query_sdm_subscriptions
(
const
std
::
string
&
ue_id
,
nlohmann
::
json
&
json_data
)
{
bool
cassandra_db
::
query_sdm_subscriptions
(
const
std
::
string
&
ue_id
,
nlohmann
::
json
&
json_data
)
{
return
true
;
}
//------------------------------------------------------------------------------
bool
cassandra_db
::
query_sm_data
(
const
std
::
string
&
ue_id
,
const
std
::
string
&
serving_plmn_id
,
nlohmann
::
json
&
json_data
,
const
oai
::
udr
::
model
::
Snssai
&
,
const
std
::
string
&
dnn
)
{
bool
cassandra_db
::
query_sm_data
(
const
std
::
string
&
ue_id
,
const
std
::
string
&
serving_plmn_id
,
nlohmann
::
json
&
json_data
,
const
oai
::
udr
::
model
::
Snssai
&
,
const
std
::
string
&
dnn
)
{
return
true
;
}
...
...
@@ -179,27 +176,27 @@ bool cassandra_db::insert_smf_context_non_3gpp(
}
//------------------------------------------------------------------------------
bool
cassandra_db
::
delete_smf_context
(
const
std
::
string
&
ue_id
,
const
int32_t
&
pdu_session_id
)
{
bool
cassandra_db
::
delete_smf_context
(
const
std
::
string
&
ue_id
,
const
int32_t
&
pdu_session_id
)
{
return
true
;
}
//------------------------------------------------------------------------------
bool
cassandra_db
::
query_smf_registration
(
const
std
::
string
&
ue_id
,
const
int32_t
&
pdu_session_id
,
nlohmann
::
json
&
json_data
)
{
bool
cassandra_db
::
query_smf_registration
(
const
std
::
string
&
ue_id
,
const
int32_t
&
pdu_session_id
,
nlohmann
::
json
&
json_data
)
{
return
true
;
}
//------------------------------------------------------------------------------
bool
cassandra_db
::
query_smf_reg_list
(
const
std
::
string
&
ue_id
,
nlohmann
::
json
&
json_data
)
{
bool
cassandra_db
::
query_smf_reg_list
(
const
std
::
string
&
ue_id
,
nlohmann
::
json
&
json_data
)
{
return
true
;
}
//------------------------------------------------------------------------------
bool
cassandra_db
::
query_smf_select_data
(
const
std
::
string
&
ue_id
,
const
std
::
string
&
serving_plmn_id
,
nlohmann
::
json
&
json_data
)
{
bool
cassandra_db
::
query_smf_select_data
(
const
std
::
string
&
ue_id
,
const
std
::
string
&
serving_plmn_id
,
nlohmann
::
json
&
json_data
)
{
return
true
;
}
src/udr_app/cassandra_db.hpp
View file @
291b70ac
...
...
@@ -21,10 +21,10 @@
/*! \file cassandra_db.hpp
\brief
\author
Tien-Thinh NGUYEN
\author
\company Eurecom
\date 2022
\email:
Tien-Thinh.Nguyen@eurecom.fr
\email:
contact@openairinterface.org
*/
#ifndef CASSANDRA_DB_HPP
...
...
@@ -51,39 +51,39 @@ class cassandra_db : public database_wrapper<cassandra_db> {
bool
delete_authentication_subscription
(
const
std
::
string
&
id
);
bool
query_authentication_subscription
(
const
std
::
string
&
id
,
nlohmann
::
json
&
json_data
);
bool
query_authentication_subscription
(
const
std
::
string
&
id
,
nlohmann
::
json
&
json_data
);
bool
update_authentication_subscription
(
const
std
::
string
&
id
,
const
std
::
vector
<
oai
::
udr
::
model
::
PatchItem
>&
patchItem
,
nlohmann
::
json
&
json_data
);
bool
query_am_data
(
const
std
::
string
&
ue_id
,
const
std
::
string
&
serving_plmn_id
,
nlohmann
::
json
&
json_data
);
bool
query_am_data
(
const
std
::
string
&
ue_id
,
const
std
::
string
&
serving_plmn_id
,
nlohmann
::
json
&
json_data
);
bool
create_amf_context_3gpp
(
const
std
::
string
&
ue_id
,
const
nlohmann
::
json
&
json_data
);
bool
create_amf_context_3gpp
(
const
std
::
string
&
ue_id
,
const
nlohmann
::
json
&
json_data
);
bool
query_amf_context_3gpp
(
const
std
::
string
&
ue_id
,
nlohmann
::
json
&
json_data
);
bool
query_amf_context_3gpp
(
const
std
::
string
&
ue_id
,
nlohmann
::
json
&
json_data
);
bool
insert_authentication_status
(
const
std
::
string
&
ue_id
,
const
oai
::
udr
::
model
::
AuthEvent
&
authEvent
,
nlohmann
::
json
&
json_data
);
bool
insert_authentication_status
(
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
query_authentication_status
(
const
std
::
string
&
ue_id
,
nlohmann
::
json
&
json_data
);
bool
query_authentication_status
(
const
std
::
string
&
ue_id
,
nlohmann
::
json
&
json_data
);
bool
query_sdm_subscription
(
const
std
::
string
&
ue_id
,
const
std
::
string
&
subs_id
,
nlohmann
::
json
&
json_data
);
bool
query_sdm_subscription
(
const
std
::
string
&
ue_id
,
const
std
::
string
&
subs_id
,
nlohmann
::
json
&
json_data
);
bool
delete_sdm_subscription
(
const
std
::
string
&
ue_id
,
const
std
::
string
&
subs_id
);
bool
delete_sdm_subscription
(
const
std
::
string
&
ue_id
,
const
std
::
string
&
subs_id
);
bool
update_sdm_subscription
(
const
std
::
string
&
ue_id
,
const
std
::
string
&
subs_id
,
...
...
@@ -95,31 +95,32 @@ class cassandra_db : public database_wrapper<cassandra_db> {
oai
::
udr
::
model
::
SdmSubscription
&
sdmSubscription
,
nlohmann
::
json
&
json_data
);
bool
query_sdm_subscriptions
(
const
std
::
string
&
ue_id
,
nlohmann
::
json
&
json_data
);
bool
query_sdm_subscriptions
(
const
std
::
string
&
ue_id
,
nlohmann
::
json
&
json_data
);
bool
query_sm_data
(
const
std
::
string
&
ue_id
,
const
std
::
string
&
serving_plmn_id
,
nlohmann
::
json
&
json_data
,
const
oai
::
udr
::
model
::
Snssai
&
snssai
=
{},
const
std
::
string
&
dnn
=
{});
bool
query_sm_data
(
const
std
::
string
&
ue_id
,
const
std
::
string
&
serving_plmn_id
,
nlohmann
::
json
&
json_data
,
const
oai
::
udr
::
model
::
Snssai
&
snssai
=
{},
const
std
::
string
&
dnn
=
{});
bool
insert_smf_context_non_3gpp
(
const
std
::
string
&
ue_id
,
const
int32_t
&
pdu_session_id
,
const
oai
::
udr
::
model
::
SmfRegistration
&
smfRegistration
,
nlohmann
::
json
&
json_data
);
bool
delete_smf_context
(
const
std
::
string
&
ue_id
,
const
int32_t
&
pdu_session_id
);
bool
delete_smf_context
(
const
std
::
string
&
ue_id
,
const
int32_t
&
pdu_session_id
);
bool
query_smf_registration
(
const
std
::
string
&
ue_id
,
const
int32_t
&
pdu_session_id
,
nlohmann
::
json
&
json_data
);
bool
query_smf_registration
(
const
std
::
string
&
ue_id
,
const
int32_t
&
pdu_session_id
,
nlohmann
::
json
&
json_data
);
bool
query_smf_reg_list
(
const
std
::
string
&
ue_id
,
nlohmann
::
json
&
json_data
);
bool
query_smf_select_data
(
const
std
::
string
&
ue_id
,
const
std
::
string
&
serving_plmn_id
,
nlohmann
::
json
&
json_data
);
bool
query_smf_select_data
(
const
std
::
string
&
ue_id
,
const
std
::
string
&
serving_plmn_id
,
nlohmann
::
json
&
json_data
);
private:
// cassandra_connector;
...
...
src/udr_app/database_wrapper.hpp
View file @
291b70ac
...
...
@@ -21,10 +21,10 @@
/*! \file databse_wrapper.hpp
\brief
\author
Tien-Thinh NGUYEN
\author
\company Eurecom
\date 2022
\email:
Tien-Thinh.Nguyen@eurecom.fr
\email:
contact@openairinterface.org
*/
#ifndef DATABASE_WRAPPER_HPP
...
...
@@ -39,7 +39,7 @@
namespace
oai
::
udr
::
app
{
template
<
class
DerivedT
>
template
<
class
DerivedT
>
class
database_wrapper
:
public
database_wrapper_abstraction
{
public:
database_wrapper
(){};
...
...
@@ -94,8 +94,8 @@ class database_wrapper : public database_wrapper_abstraction {
return
derived
->
delete_authentication_subscription
(
id
);
}
bool
query_authentication_subscription
(
const
std
::
string
&
id
,
nlohmann
::
json
&
json_data
)
override
{
bool
query_authentication_subscription
(
const
std
::
string
&
id
,
nlohmann
::
json
&
json_data
)
override
{
auto
derived
=
static_cast
<
DerivedT
*>
(
this
);
return
derived
->
query_authentication_subscription
(
id
,
json_data
);
}
...
...
@@ -105,34 +105,33 @@ class database_wrapper : public database_wrapper_abstraction {
const
std
::
vector
<
oai
::
udr
::
model
::
PatchItem
>&
patchItem
,
nlohmann
::
json
&
json_data
)
override
{
auto
derived
=
static_cast
<
DerivedT
*>
(
this
);
return
derived
->
update_authentication_subscription
(
id
,
patchItem
,
json_data
);
return
derived
->
update_authentication_subscription
(
id
,
patchItem
,
json_data
);
}
bool
query_am_data
(
const
std
::
string
&
ue_id
,
const
std
::
string
&
serving_plmn_id
,
nlohmann
::
json
&
json_data
)
override
{
bool
query_am_data
(
const
std
::
string
&
ue_id
,
const
std
::
string
&
serving_plmn_id
,
nlohmann
::
json
&
json_data
)
override
{
auto
derived
=
static_cast
<
DerivedT
*>
(
this
);
return
derived
->
query_am_data
(
ue_id
,
serving_plmn_id
,
json_data
);
}
bool
create_amf_context_3gpp
(
const
std
::
string
&
ue_id
,
oai
::
udr
::
model
::
Amf3GppAccessRegistration
&
amf3GppAccessRegistration
)
override
{
bool
create_amf_context_3gpp
(
const
std
::
string
&
ue_id
,
oai
::
udr
::
model
::
Amf3GppAccessRegistration
&
amf3GppAccessRegistration
)
override
{
auto
derived
=
static_cast
<
DerivedT
*>
(
this
);
return
derived
->
create_amf_context_3gpp
(
ue_id
,
amf3GppAccessRegistration
);
}
bool
query_amf_context_3gpp
(
const
std
::
string
&
ue_id
,
nlohmann
::
json
&
json_data
)
override
{
bool
query_amf_context_3gpp
(
const
std
::
string
&
ue_id
,
nlohmann
::
json
&
json_data
)
override
{
auto
derived
=
static_cast
<
DerivedT
*>
(
this
);
return
derived
->
query_amf_context_3gpp
(
ue_id
,
json_data
);
}
bool
insert_authentication_status
(
const
std
::
string
&
ue_id
,
const
oai
::
udr
::
model
::
AuthEvent
&
authEvent
,
nlohmann
::
json
&
json_data
)
override
{
bool
insert_authentication_status
(
const
std
::
string
&
ue_id
,
const
oai
::
udr
::
model
::
AuthEvent
&
authEvent
,
nlohmann
::
json
&
json_data
)
override
{
auto
derived
=
static_cast
<
DerivedT
*>
(
this
);
return
derived
->
insert_authentication_status
(
ue_id
,
authEvent
,
json_data
);
}
...
...
@@ -142,21 +141,21 @@ class database_wrapper : public database_wrapper_abstraction {
return
derived
->
delete_authentication_status
(
ue_id
);
}
bool
query_authentication_status
(
const
std
::
string
&
ue_id
,
nlohmann
::
json
&
json_data
)
override
{
bool
query_authentication_status
(
const
std
::
string
&
ue_id
,
nlohmann
::
json
&
json_data
)
override
{
auto
derived
=
static_cast
<
DerivedT
*>
(
this
);
return
derived
->
query_authentication_status
(
ue_id
,
json_data
);
}
bool
query_sdm_subscription
(
const
std
::
string
&
ue_id
,
const
std
::
string
&
subs_id
,
nlohmann
::
json
&
json_data
)
override
{
bool
query_sdm_subscription
(
const
std
::
string
&
ue_id
,
const
std
::
string
&
subs_id
,
nlohmann
::
json
&
json_data
)
override
{
auto
derived
=
static_cast
<
DerivedT
*>
(
this
);
return
derived
->
query_sdm_subscription
(
ue_id
,
subs_id
,
json_data
);
}
bool
delete_sdm_subscription
(
const
std
::
string
&
ue_id
,
const
std
::
string
&
subs_id
)
override
{
bool
delete_sdm_subscription
(
const
std
::
string
&
ue_id
,
const
std
::
string
&
subs_id
)
override
{
auto
derived
=
static_cast
<
DerivedT
*>
(
this
);
return
derived
->
delete_sdm_subscription
(
ue_id
,
subs_id
);
}
...
...
@@ -166,8 +165,8 @@ class database_wrapper : public database_wrapper_abstraction {
oai
::
udr
::
model
::
SdmSubscription
&
sdmSubscription
,
nlohmann
::
json
&
json_data
)
override
{
auto
derived
=
static_cast
<
DerivedT
*>
(
this
);
return
derived
->
update_sdm_subscription
(
ue_id
,
subs_id
,
sdmSubscription
,
json_data
);
return
derived
->
update_sdm_subscription
(
ue_id
,
subs_id
,
sdmSubscription
,
json_data
);
}
bool
create_sdm_subscriptions
(
...
...
@@ -178,19 +177,20 @@ class database_wrapper : public database_wrapper_abstraction {
return
derived
->
create_sdm_subscriptions
(
ue_id
,
sdmSubscription
,
json_data
);
}
bool
query_sdm_subscriptions
(
const
std
::
string
&
ue_id
,
nlohmann
::
json
&
json_data
)
override
{
bool
query_sdm_subscriptions
(
const
std
::
string
&
ue_id
,
nlohmann
::
json
&
json_data
)
override
{
auto
derived
=
static_cast
<
DerivedT
*>
(
this
);
return
derived
->
query_sdm_subscriptions
(
ue_id
,
json_data
);
}
bool
query_sm_data
(
const
std
::
string
&
ue_id
,
const
std
::
string
&
serving_plmn_id
,
nlohmann
::
json
&
json_data
,
const
oai
::
udr
::
model
::
Snssai
&
snssai
=
{},
const
std
::
string
&
dnn
=
{})
override
{
bool
query_sm_data
(
const
std
::
string
&
ue_id
,
const
std
::
string
&
serving_plmn_id
,
nlohmann
::
json
&
json_data
,
const
oai
::
udr
::
model
::
Snssai
&
snssai
=
{},
const
std
::
string
&
dnn
=
{})
override
{
auto
derived
=
static_cast
<
DerivedT
*>
(
this
);
return
derived
->
query_sm_data
(
ue_id
,
serving_plmn_id
,
json_data
,
snssai
,
dnn
);
return
derived
->
query_sm_data
(
ue_id
,
serving_plmn_id
,
json_data
,
snssai
,
dnn
);
}
bool
insert_smf_context_non_3gpp
(
...
...
@@ -198,32 +198,32 @@ class database_wrapper : public database_wrapper_abstraction {
const
oai
::
udr
::
model
::
SmfRegistration
&
smfRegistration
,
nlohmann
::
json
&
json_data
)
override
{
auto
derived
=
static_cast
<
DerivedT
*>
(
this
);
return
derived
->
insert_smf_context_non_3gpp
(
ue_id
,
pdu_session_id
,
smfRegistration
,
json_data
);
return
derived
->
insert_smf_context_non_3gpp
(
ue_id
,
pdu_session_id
,
smfRegistration
,
json_data
);
}
bool
delete_smf_context
(
const
std
::
string
&
ue_id
,
const
int32_t
&
pdu_session_id
)
override
{
bool
delete_smf_context
(
const
std
::
string
&
ue_id
,
const
int32_t
&
pdu_session_id
)
override
{
auto
derived
=
static_cast
<
DerivedT
*>
(
this
);
return
derived
->
delete_smf_context
(
ue_id
,
pdu_session_id
);
}
bool
query_smf_registration
(
const
std
::
string
&
ue_id
,
const
int32_t
&
pdu_session_id
,
nlohmann
::
json
&
json_data
)
override
{
bool
query_smf_registration
(
const
std
::
string
&
ue_id
,
const
int32_t
&
pdu_session_id
,
nlohmann
::
json
&
json_data
)
override
{
auto
derived
=
static_cast
<
DerivedT
*>
(
this
);
return
derived
->
query_smf_registration
(
ue_id
,
pdu_session_id
,
json_data
);
}
bool
query_smf_reg_list
(
const
std
::
string
&
ue_id
,
nlohmann
::
json
&
json_data
)
override
{
bool
query_smf_reg_list
(
const
std
::
string
&
ue_id
,
nlohmann
::
json
&
json_data
)
override
{
auto
derived
=
static_cast
<
DerivedT
*>
(
this
);
return
derived
->
query_smf_reg_list
(
ue_id
,
json_data
);
}
bool
query_smf_select_data
(
const
std
::
string
&
ue_id
,
const
std
::
string
&
serving_plmn_id
,
nlohmann
::
json
&
json_data
)
override
{
bool
query_smf_select_data
(
const
std
::
string
&
ue_id
,
const
std
::
string
&
serving_plmn_id
,
nlohmann
::
json
&
json_data
)
override
{
auto
derived
=
static_cast
<
DerivedT
*>
(
this
);
return
derived
->
query_smf_select_data
(
ue_id
,
serving_plmn_id
,
json_data
);
}
...
...
src/udr_app/database_wrapper_abstraction.hpp
View file @
291b70ac
...
...
@@ -21,10 +21,10 @@
/*! \file databse_wrapper_abstraction.hpp
\brief
\author
Tien-Thinh NGUYEN
\author
\company Eurecom
\date 2022
\email:
Tien-Thinh.Nguyen@eurecom.fr
\email:
contact@openairinterface.org
*/
#ifndef DATABASE_WRAPPER_ABSTRACTION_HPP
...
...
@@ -112,8 +112,8 @@ class database_wrapper_abstraction {
* @param [nlohmann::json&] json_data: Data in Json format
* @return true if successful, otherwise return false
*/
virtual
bool
query_authentication_subscription
(
const
std
::
string
&
id
,
nlohmann
::
json
&
json_data
)
=
0
;
virtual
bool
query_authentication_subscription
(
const
std
::
string
&
id
,
nlohmann
::
json
&
json_data
)
=
0
;
/*
* Update an item from the DB for the Authentication Subscription
...
...
@@ -135,9 +135,9 @@ class database_wrapper_abstraction {
* @param [nlohmann::json&] json_data: Data in Json format
* @return true if successful, otherwise return false
*/
virtual
bool
query_am_data
(
const
std
::
string
&
ue_id
,
const
std
::
string
&
serving_plmn_id
,
nlohmann
::
json
&
json_data
)
=
0
;
virtual
bool
query_am_data
(
const
std
::
string
&
ue_id
,
const
std
::
string
&
serving_plmn_id
,
nlohmann
::
json
&
json_data
)
=
0
;
/*
* Insert an item into DB for AMF3GPPAccessRegistration Context
...
...
@@ -157,8 +157,8 @@ class database_wrapper_abstraction {
* @param [long code] code: HTTP response code
* @return true if successful, otherwise return false
*/
virtual
bool
query_amf_context_3gpp
(
const
std
::
string
&
ue_id
,
nlohmann
::
json
&
json_data
)
=
0
;
virtual
bool
query_amf_context_3gpp
(
const
std
::
string
&
ue_id
,
nlohmann
::
json
&
json_data
)
=
0
;
/*
* Insert a new item into the DB for AuthenticationStatus
...
...
@@ -184,8 +184,8 @@ class database_wrapper_abstraction {
* @param [nlohmann::json&] json_data: Data in Json format
* @return true if successful, otherwise return false
*/
virtual
bool
query_authentication_status
(
const
std
::
string
&
ue_id
,
nlohmann
::
json
&
json_data
)
=
0
;
virtual
bool
query_authentication_status
(
const
std
::
string
&
ue_id
,
nlohmann
::
json
&
json_data
)
=
0
;
/*
* Query an item from the DB for SDMSubscription
...
...
@@ -194,9 +194,9 @@ class database_wrapper_abstraction {
* @param [nlohmann::json&] json_data: Data in Json format
* @return true if successful, otherwise return false
*/
virtual
bool
query_sdm_subscription
(
const
std
::
string
&
ue_id
,
const
std
::
string
&
subs_id
,
nlohmann
::
json
&
json_data
)
=
0
;
virtual
bool
query_sdm_subscription
(
const
std
::
string
&
ue_id
,
const
std
::
string
&
subs_id
,
nlohmann
::
json
&
json_data
)
=
0
;
/*
* Delete an item from the DB for SDMSubscription
...
...
@@ -204,8 +204,8 @@ class database_wrapper_abstraction {
* @param [const std::string&] subs_id: subscription ID
* @return true if successful, otherwise return false
*/
virtual
bool
delete_sdm_subscription
(
const
std
::
string
&
ue_id
,
const
std
::
string
&
subs_id
)
=
0
;
virtual
bool
delete_sdm_subscription
(
const
std
::
string
&
ue_id
,
const
std
::
string
&
subs_id
)
=
0
;
/*
* Update an item from the DB for SDMSubscription
...
...
@@ -240,8 +240,8 @@ class database_wrapper_abstraction {
* @param [nlohmann::json&] json_data: Data in Json format
* @return true if successful, otherwise return false
*/
virtual
bool
query_sdm_subscriptions
(
const
std
::
string
&
ue_id
,
nlohmann
::
json
&
json_data
)
=
0
;
virtual
bool
query_sdm_subscriptions
(
const
std
::
string
&
ue_id
,
nlohmann
::
json
&
json_data
)
=
0
;
/*
* Query an item from the DB for SessionManagementSubscription
...
...
@@ -252,10 +252,11 @@ class database_wrapper_abstraction {
* @param [const std::string&] dnn: DNN
* @return true if successful, otherwise return false
*/
virtual
bool
query_sm_data
(
const
std
::
string
&
ue_id
,
const
std
::
string
&
serving_plmn_id
,
nlohmann
::
json
&
json_data
,
const
oai
::
udr
::
model
::
Snssai
&
snssai
=
{},
const
std
::
string
&
dnn
=
{})
=
0
;
virtual
bool
query_sm_data
(
const
std
::
string
&
ue_id
,
const
std
::
string
&
serving_plmn_id
,
nlohmann
::
json
&
json_data
,
const
oai
::
udr
::
model
::
Snssai
&
snssai
=
{},
const
std
::
string
&
dnn
=
{})
=
0
;
/*
* Insert an item into the DB for SMFRegistration
...
...
@@ -277,8 +278,8 @@ class database_wrapper_abstraction {
* @param [const int32_t&] pdu_session_id: PDU Session ID
* @return true if successful, otherwise return false
*/
virtual
bool
delete_smf_context
(
const
std
::
string
&
ue_id
,
const
int32_t
&
pdu_session_id
)
=
0
;
virtual
bool
delete_smf_context
(
const
std
::
string
&
ue_id
,
const
int32_t
&
pdu_session_id
)
=
0
;
/*
* Query an item from the DB SMFRegistration
...
...
@@ -287,9 +288,9 @@ class database_wrapper_abstraction {
* @param [nlohmann::json&] json_data: Data in Json format
* @return true if successful, otherwise return false
*/
virtual
bool
query_smf_registration
(
const
std
::
string
&
ue_id
,
const
int32_t
&
pdu_session_id
,
nlohmann
::
json
&
json_data
)
=
0
;
virtual
bool
query_smf_registration
(
const
std
::
string
&
ue_id
,
const
int32_t
&
pdu_session_id
,
nlohmann
::
json
&
json_data
)
=
0
;
/*
* Query an item from the DB for SMFRegistrationsCollection
...
...
@@ -297,8 +298,8 @@ class database_wrapper_abstraction {
* @param [nlohmann::json&] json_data: Data in Json format
* @return true if successful, otherwise return false
*/
virtual
bool
query_smf_reg_list
(
const
std
::
string
&
ue_id
,
nlohmann
::
json
&
json_data
)
=
0
;
virtual
bool
query_smf_reg_list
(
const
std
::
string
&
ue_id
,
nlohmann
::
json
&
json_data
)
=
0
;
/*
* Query an item from the DB for SMFSelectionSubscription
...
...
@@ -307,9 +308,9 @@ class database_wrapper_abstraction {
* @param [nlohmann::json&] json_data: Data in Json format
* @return true if successful, otherwise return false
*/
virtual
bool
query_smf_select_data
(
const
std
::
string
&
ue_id
,
const
std
::
string
&
serving_plmn_id
,
nlohmann
::
json
&
json_data
)
=
0
;
virtual
bool
query_smf_select_data
(
const
std
::
string
&
ue_id
,
const
std
::
string
&
serving_plmn_id
,
nlohmann
::
json
&
json_data
)
=
0
;
};
}
// namespace oai::udr::app
...
...
src/udr_app/mysql_db.cpp
View file @
291b70ac
This diff is collapsed.
Click to expand it.
src/udr_app/mysql_db.hpp
View file @
291b70ac
...
...
@@ -21,10 +21,10 @@
/*! \file mysql_db.hpp
\brief
\author
Tien-Thinh NGUYEN
\author
\company Eurecom
\date 2022
\email:
Tien-Thinh.Nguyen@eurecom.fr
\email:
contact@openairinterface.org
*/
#ifndef MYSQL_DB_HPP
...
...
@@ -58,40 +58,40 @@ class mysql_db : public database_wrapper<mysql_db> {
bool
delete_authentication_subscription
(
const
std
::
string
&
id
);
bool
query_authentication_subscription
(
const
std
::
string
&
id
,
nlohmann
::
json
&
json_data
);
bool
query_authentication_subscription
(
const
std
::
string
&
id
,
nlohmann
::
json
&
json_data
);
bool
update_authentication_subscription
(
const
std
::
string
&
id
,
const
std
::
vector
<
oai
::
udr
::
model
::
PatchItem
>&
patchItem
,
nlohmann
::
json
&
json_data
);
bool
query_am_data
(
const
std
::
string
&
ue_id
,
const
std
::
string
&
serving_plmn_id
,
nlohmann
::
json
&
json_data
);
bool
query_am_data
(
const
std
::
string
&
ue_id
,
const
std
::
string
&
serving_plmn_id
,
nlohmann
::
json
&
json_data
);
bool
create_amf_context_3gpp
(
const
std
::
string
&
ue_id
,
oai
::
udr
::
model
::
Amf3GppAccessRegistration
&
amf3GppAccessRegistration
);
bool
query_amf_context_3gpp
(
const
std
::
string
&
ue_id
,
nlohmann
::
json
&
json_data
);
bool
query_amf_context_3gpp
(
const
std
::
string
&
ue_id
,
nlohmann
::
json
&
json_data
);
bool
insert_authentication_status
(
const
std
::
string
&
ue_id
,
const
oai
::
udr
::
model
::
AuthEvent
&
authEvent
,
nlohmann
::
json
&
json_data
);
bool
insert_authentication_status
(
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
query_authentication_status
(
const
std
::
string
&
ue_id
,
nlohmann
::
json
&
json_data
);
bool
query_authentication_status
(
const
std
::
string
&
ue_id
,
nlohmann
::
json
&
json_data
);
bool
query_sdm_subscription
(
const
std
::
string
&
ue_id
,
const
std
::
string
&
subs_id
,
nlohmann
::
json
&
json_data
);
bool
query_sdm_subscription
(
const
std
::
string
&
ue_id
,
const
std
::
string
&
subs_id
,
nlohmann
::
json
&
json_data
);
bool
delete_sdm_subscription
(
const
std
::
string
&
ue_id
,
const
std
::
string
&
subs_id
);
bool
delete_sdm_subscription
(
const
std
::
string
&
ue_id
,
const
std
::
string
&
subs_id
);
bool
update_sdm_subscription
(
const
std
::
string
&
ue_id
,
const
std
::
string
&
subs_id
,
...
...
@@ -103,31 +103,32 @@ class mysql_db : public database_wrapper<mysql_db> {
oai
::
udr
::
model
::
SdmSubscription
&
sdmSubscription
,
nlohmann
::
json
&
json_data
);
bool
query_sdm_subscriptions
(
const
std
::
string
&
ue_id
,
nlohmann
::
json
&
json_data
);
bool
query_sdm_subscriptions
(
const
std
::
string
&
ue_id
,
nlohmann
::
json
&
json_data
);
bool
query_sm_data
(
const
std
::
string
&
ue_id
,
const
std
::
string
&
serving_plmn_id
,
nlohmann
::
json
&
json_data
,
const
oai
::
udr
::
model
::
Snssai
&
snssai
=
{},
const
std
::
string
dnn
=
{});
bool
query_sm_data
(
const
std
::
string
&
ue_id
,
const
std
::
string
&
serving_plmn_id
,
nlohmann
::
json
&
json_data
,
const
oai
::
udr
::
model
::
Snssai
&
snssai
=
{},
const
std
::
string
dnn
=
{});
bool
insert_smf_context_non_3gpp
(
const
std
::
string
&
ue_id
,
const
int32_t
&
pdu_session_id
,
const
oai
::
udr
::
model
::
SmfRegistration
&
smfRegistration
,
nlohmann
::
json
&
json_data
);
bool
delete_smf_context
(
const
std
::
string
&
ue_id
,
const
int32_t
&
pdu_session_id
);
bool
delete_smf_context
(
const
std
::
string
&
ue_id
,
const
int32_t
&
pdu_session_id
);
bool
query_smf_registration
(
const
std
::
string
&
ue_id
,
const
int32_t
&
pdu_session_id
,
nlohmann
::
json
&
json_data
);
bool
query_smf_registration
(
const
std
::
string
&
ue_id
,
const
int32_t
&
pdu_session_id
,
nlohmann
::
json
&
json_data
);
bool
query_smf_reg_list
(
const
std
::
string
&
ue_id
,
nlohmann
::
json
&
json_data
);
bool
query_smf_select_data
(
const
std
::
string
&
ue_id
,
const
std
::
string
&
serving_plmn_id
,
nlohmann
::
json
&
json_data
);
bool
query_smf_select_data
(
const
std
::
string
&
ue_id
,
const
std
::
string
&
serving_plmn_id
,
nlohmann
::
json
&
json_data
);
private:
MYSQL
mysql_connector
;
...
...
src/udr_app/task_manager.cpp
View file @
291b70ac
...
...
@@ -24,7 +24,7 @@
\author
\company Eurecom
\date 2020
\email:
Tien-Thinh.Nguyen@eurecom.fr
\email:
contact@openairinterface.org
*/
#include "task_manager.hpp"
...
...
@@ -45,9 +45,9 @@ task_manager::task_manager(udr_event& ev) : event_sub_(ev) {
sfd
=
timerfd_create
(
CLOCK_MONOTONIC
,
0
);
/* Start the timer */
its
.
it_value
.
tv_sec
=
0
;
its
.
it_value
.
tv_nsec
=
1000
*
1000
;
its
.
it_interval
.
tv_sec
=
its
.
it_value
.
tv_sec
;
its
.
it_value
.
tv_sec
=
0
;
its
.
it_value
.
tv_nsec
=
1000
*
1000
;
its
.
it_interval
.
tv_sec
=
its
.
it_value
.
tv_sec
;
its
.
it_interval
.
tv_nsec
=
its
.
it_value
.
tv_nsec
;
if
(
timerfd_settime
(
sfd
,
TFD_TIMER_ABSTIME
,
&
its
,
NULL
)
==
-
1
)
{
...
...
@@ -56,9 +56,7 @@ task_manager::task_manager(udr_event& ev) : event_sub_(ev) {
}
//------------------------------------------------------------------------------
void
task_manager
::
run
()
{
manage_tasks
();
}
void
task_manager
::
run
()
{
manage_tasks
();
}
//------------------------------------------------------------------------------
void
task_manager
::
manage_tasks
()
{
...
...
src/udr_app/task_manager.hpp
View file @
291b70ac
...
...
@@ -24,7 +24,7 @@
\author
\company Eurecom
\date 2020
\email:
\email:
contact@openairinterface.org
*/
#ifndef TASK_MANAGER_H_
...
...
src/udr_app/udr_app.cpp
View file @
291b70ac
This diff is collapsed.
Click to expand it.
src/udr_app/udr_app.hpp
View file @
291b70ac
...
...
@@ -21,10 +21,10 @@
/*! \file udr_app.hpp
\brief
\author
Tien-Thinh NGUYEN
\author
\company Eurecom
\date 2020
\email:
Tien-Thinh.Nguyen@eurecom.fr
\email:
contact@openairinterface.org
*/
#ifndef FILE_UDR_APP_HPP_SEEN
...
...
@@ -68,9 +68,9 @@ class udr_app {
* @param [long code] code: HTTP response code
* @return void
*/
void
handle_query_am_data
(
const
std
::
string
&
ue_id
,
const
std
::
string
&
serving_plmn_id
,
nlohmann
::
json
&
response_data
,
long
&
code
);
void
handle_query_am_data
(
const
std
::
string
&
ue_id
,
const
std
::
string
&
serving_plmn_id
,
nlohmann
::
json
&
response_data
,
long
&
code
);
/*
* Handle a request to create AMF3GPPAccessRegistration Context
...
...
@@ -95,8 +95,8 @@ class udr_app {
* @param [long code] code: HTTP response code
* @return void
*/
void
handle_query_amf_context_3gpp
(
const
std
::
string
&
ue_id
,
nlohmann
::
json
&
response_data
,
long
&
code
);
void
handle_query_amf_context_3gpp
(
const
std
::
string
&
ue_id
,
nlohmann
::
json
&
response_data
,
long
&
code
);
/*
* Handle a request to create AuthenticationStatus
...
...
@@ -107,9 +107,10 @@ class udr_app {
* @param [long code] code: HTTP response code
* @return void
*/
void
handle_create_authentication_status
(
const
std
::
string
&
ue_id
,
const
AuthEvent
&
authEvent
,
nlohmann
::
json
&
response_data
,
long
&
code
);
void
handle_create_authentication_status
(
const
std
::
string
&
ue_id
,
const
AuthEvent
&
authEvent
,
nlohmann
::
json
&
response_data
,
long
&
code
);
/*
* Handle a request to delete AuthenticationStatus
...
...
@@ -119,8 +120,9 @@ class udr_app {
* @param [long code] code: HTTP response code
* @return void
*/
void
handle_delete_authentication_status
(
const
std
::
string
&
ue_id
,
nlohmann
::
json
&
response_data
,
long
&
code
);
void
handle_delete_authentication_status
(
const
std
::
string
&
ue_id
,
nlohmann
::
json
&
response_data
,
long
&
code
);
/*
* Handle a request to retrieve AuthenticationStatus
...
...
@@ -130,8 +132,9 @@ class udr_app {
* @param [long code] code: HTTP response code
* @return void
*/
void
handle_query_authentication_status
(
const
std
::
string
&
ue_id
,
nlohmann
::
json
&
response_data
,
long
&
code
);
void
handle_query_authentication_status
(
const
std
::
string
&
ue_id
,
nlohmann
::
json
&
response_data
,
long
&
code
);
/*
* Handle a request to Create an Authentication Subscription
...
...
@@ -156,8 +159,9 @@ class udr_app {
* @param [long code] code: HTTP response code
* @return void
*/
void
handle_delete_authentication_data
(
const
std
::
string
&
ue_id
,
nlohmann
::
json
&
response_data
,
long
&
code
);
void
handle_delete_authentication_data
(
const
std
::
string
&
ue_id
,
nlohmann
::
json
&
response_data
,
long
&
code
);
/*
* Handle a request to modify AuthenticationSubscription
...
...
@@ -180,8 +184,9 @@ class udr_app {
* @param [long code] code: HTTP response code
* @return void
*/
void
handle_read_authentication_subscription
(
const
std
::
string
&
ue_id
,
nlohmann
::
json
&
response_data
,
long
&
code
);
void
handle_read_authentication_subscription
(
const
std
::
string
&
ue_id
,
nlohmann
::
json
&
response_data
,
long
&
code
);
/*
* Handle a request to retrieve SDMSubscription
...
...
@@ -192,9 +197,9 @@ class udr_app {
* @param [long code] code: HTTP response code
* @return void
*/
void
handle_query_sdm_subscription
(
const
std
::
string
&
ue_id
,
const
std
::
string
&
subs_id
,
nlohmann
::
json
&
response_data
,
long
&
code
);
void
handle_query_sdm_subscription
(
const
std
::
string
&
ue_id
,
const
std
::
string
&
subs_id
,
nlohmann
::
json
&
response_data
,
long
&
code
);
/*
* Handle a request to remove SDMSubscription (SDMSubscriptionDocumentApiImpl)
...
...
@@ -204,9 +209,10 @@ class udr_app {
* @param [long code] code: HTTP response code
* @return void
*/
void
handle_remove_sdm_subscription
(
const
std
::
string
&
ue_id
,
const
std
::
string
&
subs_id
,
nlohmann
::
json
&
response_data
,
long
&
code
);
void
handle_remove_sdm_subscription
(
const
std
::
string
&
ue_id
,
const
std
::
string
&
subs_id
,
nlohmann
::
json
&
response_data
,
long
&
code
);
/*
* Handle a request to update SDMSubscription (SDMSubscriptionDocumentApiImpl)
...
...
@@ -217,10 +223,11 @@ class udr_app {
* @param [long code] code: HTTP response code
* @return void
*/
void
handle_update_sdm_subscription
(
const
std
::
string
&
ue_id
,
const
std
::
string
&
subs_id
,
SdmSubscription
&
sdmSubscription
,
nlohmann
::
json
&
response_data
,
long
&
code
);
void
handle_update_sdm_subscription
(
const
std
::
string
&
ue_id
,
const
std
::
string
&
subs_id
,
SdmSubscription
&
sdmSubscription
,
nlohmann
::
json
&
response_data
,
long
&
code
);
/*
* Handle a request to create SDMSubscriptions
...
...
@@ -231,9 +238,10 @@ class udr_app {
* @param [long code] code: HTTP response code
* @return void
*/
void
handle_create_sdm_subscriptions
(
const
std
::
string
&
ue_id
,
SdmSubscription
&
sdmSubscription
,
nlohmann
::
json
&
response_data
,
long
&
code
);
void
handle_create_sdm_subscriptions
(
const
std
::
string
&
ue_id
,
SdmSubscription
&
sdmSubscription
,
nlohmann
::
json
&
response_data
,
long
&
code
);
/*
* Handle a request to retrieve SDMSubscriptions
...
...
@@ -243,8 +251,9 @@ class udr_app {
* @param [long code] code: HTTP response code
* @return void
*/
void
handle_query_sdm_subscriptions
(
const
std
::
string
&
ue_id
,
nlohmann
::
json
&
response_data
,
long
&
code
);
void
handle_query_sdm_subscriptions
(
const
std
::
string
&
ue_id
,
nlohmann
::
json
&
response_data
,
long
&
code
);
/*
* Handle a request to retrieve SessionManagementSubscription
...
...
@@ -257,10 +266,11 @@ class udr_app {
* @param [long code] code: HTTP response code
* @return void
*/
void
handle_query_sm_data
(
const
std
::
string
&
ue_id
,
const
std
::
string
&
serving_plmn_id
,
nlohmann
::
json
&
response_data
,
long
&
code
,
const
oai
::
udr
::
model
::
Snssai
&
snssai
=
{},
const
std
::
string
&
dnn
=
{});
void
handle_query_sm_data
(
const
std
::
string
&
ue_id
,
const
std
::
string
&
serving_plmn_id
,
nlohmann
::
json
&
response_data
,
long
&
code
,
const
oai
::
udr
::
model
::
Snssai
&
snssai
=
{},
const
std
::
string
&
dnn
=
{});
/*
* Handle a request to create SMFRegistration (SMFRegistrationDocumentApiImpl)
...
...
@@ -284,9 +294,9 @@ class udr_app {
* @param [long code] code: HTTP response code
* @return void
*/
void
handle_delete_smf_context
(
const
std
::
string
&
ue_id
,
const
int32_t
&
pdu_session_id
,
nlohmann
::
json
&
response_data
,
long
&
code
);
void
handle_delete_smf_context
(
const
std
::
string
&
ue_id
,
const
int32_t
&
pdu_session_id
,
nlohmann
::
json
&
response_data
,
long
&
code
);
/*
* Handle a request to retrieve SMFRegistration
...
...
@@ -297,9 +307,9 @@ class udr_app {
* @param [long code] code: HTTP response code
* @return void
*/
void
handle_query_smf_registration
(
const
std
::
string
&
ue_id
,
const
int32_t
&
pdu_session_id
,
nlohmann
::
json
&
response_data
,
long
&
code
);
void
handle_query_smf_registration
(
const
std
::
string
&
ue_id
,
const
int32_t
&
pdu_session_id
,
nlohmann
::
json
&
response_data
,
long
&
code
);
/*
* Handle a request to retrieve SMFRegistrationsCollection
...
...
@@ -309,8 +319,8 @@ class udr_app {
* @param [long code] code: HTTP response code
* @return void
*/
void
handle_query_smf_reg_list
(
const
std
::
string
&
ue_id
,
nlohmann
::
json
&
response_data
,
long
&
code
);
void
handle_query_smf_reg_list
(
const
std
::
string
&
ue_id
,
nlohmann
::
json
&
response_data
,
long
&
code
);
/*
* Handle a request to retrieve SMFSelectionSubscription
...
...
@@ -321,9 +331,9 @@ class udr_app {
* @param [long code] code: HTTP response code
* @return void
*/
void
handle_query_smf_select_data
(
const
std
::
string
&
ue_id
,
const
std
::
string
&
serving_plmn_id
,
nlohmann
::
json
&
response_data
,
long
&
code
);
void
handle_query_smf_select_data
(
const
std
::
string
&
ue_id
,
const
std
::
string
&
serving_plmn_id
,
nlohmann
::
json
&
response_data
,
long
&
code
);
private:
MYSQL
mysql
;
...
...
src/udr_app/udr_client.cpp
View file @
291b70ac
...
...
@@ -21,10 +21,10 @@
/*! \file udr_client.cpp
\brief
\author
Jian Yang, Fengjiao He, Hongxin Wang, Tien-Thinh NGUYEN
\author
\company Eurecom
\date 2020
\email:
\email:
contact@openairinterface.org
*/
#include "udr_client.hpp"
...
...
@@ -51,8 +51,8 @@ extern udr_config udr_cfg;
//------------------------------------------------------------------------------
// To read content of the response from NF
static
std
::
size_t
callback
(
const
char
*
in
,
std
::
size_t
size
,
std
::
size_t
num
,
std
::
string
*
out
)
{
static
std
::
size_t
callback
(
const
char
*
in
,
std
::
size_t
size
,
std
::
size_t
num
,
std
::
string
*
out
)
{
const
std
::
size_t
totalBytes
(
size
*
num
);
out
->
append
(
in
,
totalBytes
);
return
totalBytes
;
...
...
@@ -67,15 +67,14 @@ udr_client::~udr_client() {
}
//------------------------------------------------------------------------------
void
udr_client
::
curl_http_client
(
std
::
string
remoteUri
,
std
::
string
method
,
std
::
string
msgBody
,
std
::
string
&
response
)
{
void
udr_client
::
curl_http_client
(
std
::
string
remoteUri
,
std
::
string
method
,
std
::
string
msgBody
,
std
::
string
&
response
)
{
Logger
::
udr_app
().
info
(
"Send HTTP message with body %s"
,
msgBody
.
c_str
());
uint32_t
str_len
=
msgBody
.
length
();
char
*
body_data
=
(
char
*
)
malloc
(
str_len
+
1
);
char
*
body_data
=
(
char
*
)
malloc
(
str_len
+
1
);
memset
(
body_data
,
0
,
str_len
+
1
);
memcpy
((
void
*
)
body_data
,
(
void
*
)
msgBody
.
c_str
(),
str_len
);
memcpy
((
void
*
)
body_data
,
(
void
*
)
msgBody
.
c_str
(),
str_len
);
curl_global_init
(
CURL_GLOBAL_ALL
);
CURL
*
curl
=
curl_easy_init
();
...
...
@@ -84,7 +83,7 @@ void udr_client::curl_http_client(
if
(
udr_cfg
.
use_http2
)
http_version
=
2
;
if
(
curl
)
{
CURLcode
res
=
{};
CURLcode
res
=
{};
struct
curl_slist
*
headers
=
nullptr
;
if
((
method
.
compare
(
"POST"
)
==
0
)
or
(
method
.
compare
(
"PUT"
)
==
0
)
or
(
method
.
compare
(
"PATCH"
)
==
0
))
{
...
...
@@ -114,8 +113,8 @@ void udr_client::curl_http_client(
// we use a self-signed test server, skip verification during debugging
curl_easy_setopt
(
curl
,
CURLOPT_SSL_VERIFYPEER
,
0L
);
curl_easy_setopt
(
curl
,
CURLOPT_SSL_VERIFYHOST
,
0L
);
curl_easy_setopt
(
curl
,
CURLOPT_HTTP_VERSION
,
CURL_HTTP_VERSION_2_PRIOR_KNOWLEDGE
);
curl_easy_setopt
(
curl
,
CURLOPT_HTTP_VERSION
,
CURL_HTTP_VERSION_2_PRIOR_KNOWLEDGE
);
}
// Response information.
...
...
@@ -137,13 +136,13 @@ void udr_client::curl_http_client(
curl_easy_getinfo
(
curl
,
CURLINFO_RESPONSE_CODE
,
&
httpCode
);
// Process the response
response
=
*
httpData
.
get
();
response
=
*
httpData
.
get
();
bool
is_response_ok
=
true
;
Logger
::
udr_app
().
info
(
"Get response with HTTP code (%d)"
,
httpCode
);
if
(
httpCode
==
0
)
{
Logger
::
udr_app
().
info
(
"Cannot get response when calling %s"
,
remoteUri
.
c_str
());
Logger
::
udr_app
().
info
(
"Cannot get response when calling %s"
,
remoteUri
.
c_str
());
// free curl before returning
curl_slist_free_all
(
headers
);
curl_easy_cleanup
(
curl
);
...
...
@@ -174,8 +173,8 @@ void udr_client::curl_http_client(
response_data
[
"error"
][
"cause"
]
=
"504 Gateway Timeout"
;
}
Logger
::
udr_app
().
info
(
"Get response with jsonData: %s"
,
response
.
c_str
());
Logger
::
udr_app
().
info
(
"Get response with jsonData: %s"
,
response
.
c_str
());
std
::
string
cause
=
response_data
[
"error"
][
"cause"
];
Logger
::
udr_app
().
info
(
"Call Network Function services failure"
);
...
...
src/udr_app/udr_client.hpp
View file @
291b70ac
...
...
@@ -20,10 +20,10 @@
*/
/*! \file udr_client.hpp
\author
Tien-Thinh NGUYEN
\author
\company Eurecom
\date 2020
\email:
\email:
contact@openairinterface.org
*/
#ifndef FILE_UDR_CLIENT_HPP_SEEN
...
...
@@ -49,9 +49,8 @@ class udr_client {
udr_client
(
udr_client
const
&
)
=
delete
;
void
curl_http_client
(
std
::
string
remoteUri
,
std
::
string
method
,
std
::
string
msgBody
,
std
::
string
&
response
);
void
curl_http_client
(
std
::
string
remoteUri
,
std
::
string
method
,
std
::
string
msgBody
,
std
::
string
&
response
);
};
}
// namespace app
}
// namespace udr
...
...
src/udr_app/udr_config.cpp
View file @
291b70ac
This diff is collapsed.
Click to expand it.
src/udr_app/udr_event.cpp
View file @
291b70ac
...
...
@@ -21,8 +21,8 @@
/*! \file udr_event.cpp
\brief
\author
Tien-Thinh NGUYEN (EURECOM)
\company
\author
\company
: eurecom
\date 2022
\email: contact@openairinterface.org
*/
...
...
src/udr_app/udr_event.hpp
View file @
291b70ac
...
...
@@ -21,7 +21,7 @@
/*! \file udr_event.hpp
\brief
\author
Tien-Thinh NGUYEN (EURECOM)
\author
\company
\date 2022
\email: contact@openairinterface.org
...
...
@@ -63,8 +63,9 @@ class udr_event {
* @param [uint64_t] start:
* @return void
*/
bs2
::
connection
subscribe_task_nf_heartbeat
(
const
task_sig_t
::
slot_type
&
sig
,
uint64_t
period
,
uint64_t
start
=
0
);
bs2
::
connection
subscribe_task_nf_heartbeat
(
const
task_sig_t
::
slot_type
&
sig
,
uint64_t
period
,
uint64_t
start
=
0
);
/*
* Subscribe to the task db connection reset event
...
...
src/udr_app/udr_event_sig.hpp
View file @
291b70ac
...
...
@@ -21,7 +21,7 @@
/*! \file udr_event_sig.hpp
\brief
\author
Tien-Thinh NGUYEN (EURECOM)
\author
\company
\date 2022
\email: contact@openairinterface.org
...
...
@@ -39,8 +39,8 @@ namespace bs2 = boost::signals2;
namespace
oai
::
udr
::
app
{
typedef
bs2
::
signal_type
<
void
(
uint64_t
),
bs2
::
keywords
::
mutex_type
<
bs2
::
dummy_mutex
>>::
type
typedef
bs2
::
signal_type
<
void
(
uint64_t
),
bs2
::
keywords
::
mutex_type
<
bs2
::
dummy_mutex
>>::
type
task_sig_t
;
// typedef bs2::signal_type<
...
...
src/udr_app/udr_nrf.cpp
View file @
291b70ac
...
...
@@ -21,10 +21,10 @@
/*! \file udr_nrf.cpp
\brief
\author
Jian Yang, Fengjiao He, Hongxin Wang, Tien-Thinh NGUYEN
\author
\company Eurecom
\date 2020
\email:
\email:
contact@openairinterface.org
*/
#include "udr_nrf.hpp"
...
...
@@ -59,14 +59,14 @@ udr_nrf::udr_nrf(udr_event& ev) : m_event_sub(ev) {}
//---------------------------------------------------------------------------------------------
void
udr_nrf
::
get_udr_api_root
(
std
::
string
&
api_root
)
{
api_root
=
std
::
string
(
inet_ntoa
(
*
((
struct
in_addr
*
)
&
udr_cfg
.
nrf_addr
.
ipv4_addr
)))
+
std
::
string
(
inet_ntoa
(
*
((
struct
in_addr
*
)
&
udr_cfg
.
nrf_addr
.
ipv4_addr
)))
+
":"
+
std
::
to_string
(
udr_cfg
.
nrf_addr
.
port
)
+
NNRF_NFM_BASE
+
udr_cfg
.
nrf_addr
.
api_version
;
}
//---------------------------------------------------------------------------------------------
void
udr_nrf
::
generate_udr_profile
(
udr_profile
&
udr_nf_profile
,
std
::
string
&
udr_instance_id
)
{
void
udr_nrf
::
generate_udr_profile
(
udr_profile
&
udr_nf_profile
,
std
::
string
&
udr_instance_id
)
{
// TODO: remove hardcoded values
udr_nf_profile
.
set_nf_instance_id
(
udr_instance_id
);
udr_nf_profile
.
set_nf_instance_name
(
"OAI-UDR"
);
...
...
@@ -90,14 +90,14 @@ void udr_nrf::generate_udr_profile(
udr_info_item
.
groupid
=
"oai-udr-testgroupid"
;
udr_info_item
.
data_set_id
.
push_back
(
"0210"
);
udr_info_item
.
data_set_id
.
push_back
(
"9876"
);
supi_ranges
.
supi_range
.
start
=
"208950000000031"
;
supi_ranges
.
supi_range
.
start
=
"208950000000031"
;
supi_ranges
.
supi_range
.
pattern
=
"^imsi-20895[31-131]{6}$"
;
supi_ranges
.
supi_range
.
start
=
"208950000000131"
;
supi_ranges
.
supi_range
.
start
=
"208950000000131"
;
udr_info_item
.
supi_ranges
.
push_back
(
supi_ranges
);
identity_range_udr_info_item_t
gpsi_ranges
;
gpsi_ranges
.
identity_range
.
start
=
"752740000"
;
gpsi_ranges
.
identity_range
.
start
=
"752740000"
;
gpsi_ranges
.
identity_range
.
pattern
=
"^gpsi-75274[0-9]{4}$"
;
gpsi_ranges
.
identity_range
.
end
=
"752749999"
;
gpsi_ranges
.
identity_range
.
end
=
"752749999"
;
udr_info_item
.
gpsi_ranges
.
push_back
(
gpsi_ranges
);
udr_nf_profile
.
set_udr_info
(
udr_info_item
);
// ToDo:- Add remaining fields
...
...
@@ -108,7 +108,7 @@ void udr_nrf::generate_udr_profile(
//---------------------------------------------------------------------------------------------
void
udr_nrf
::
register_to_nrf
()
{
// generate UUID
udr_instance_id
=
to_string
(
boost
::
uuids
::
random_generator
()());
udr_instance_id
=
to_string
(
boost
::
uuids
::
random_generator
()());
nlohmann
::
json
response_data
=
{};
// Generate NF Profile
...
...
@@ -117,16 +117,16 @@ void udr_nrf::register_to_nrf() {
// Send NF registeration request
std
::
string
udr_api_root
=
{};
std
::
string
response
=
{};
std
::
string
method
=
{
"PUT"
};
std
::
string
response
=
{};
std
::
string
method
=
{
"PUT"
};
get_udr_api_root
(
udr_api_root
);
std
::
string
remoteUri
=
udr_api_root
+
UDR_NF_REGISTER_URL
+
udr_instance_id
;
nlohmann
::
json
json_data
=
{};
udr_nf_profile
.
to_json
(
json_data
);
Logger
::
udr_nrf
().
info
(
"Sending NF registeration request"
);
udr_client_instance
->
curl_http_client
(
remoteUri
,
method
,
json_data
.
dump
().
c_str
(),
response
);
udr_client_instance
->
curl_http_client
(
remoteUri
,
method
,
json_data
.
dump
().
c_str
(),
response
);
try
{
response_data
=
nlohmann
::
json
::
parse
(
response
);
...
...
@@ -144,8 +144,8 @@ void udr_nrf::start_event_nf_heartbeat(std::string& remoteURI) {
std
::
chrono
::
system_clock
::
now
().
time_since_epoch
())
.
count
();
struct
itimerspec
its
;
its
.
it_value
.
tv_sec
=
HEART_BEAT_TIMER
;
// seconds
its
.
it_value
.
tv_nsec
=
0
;
// 100 * 1000 * 1000; //100ms
its
.
it_value
.
tv_sec
=
HEART_BEAT_TIMER
;
// seconds
its
.
it_value
.
tv_nsec
=
0
;
// 100 * 1000 * 1000; //100ms
const
uint64_t
interval
=
its
.
it_value
.
tv_sec
*
1000
+
its
.
it_value
.
tv_nsec
/
1000000
;
// convert sec, nsec to msec
...
...
@@ -166,8 +166,8 @@ void udr_nrf::trigger_nf_heartbeat_procedure(uint64_t ms) {
patch_items
.
push_back
(
patch_item
);
Logger
::
udr_nrf
().
info
(
"Sending NF heartbeat request"
);
std
::
string
response
=
{};
std
::
string
method
=
{
"PATCH"
};
std
::
string
response
=
{};
std
::
string
method
=
{
"PATCH"
};
nlohmann
::
json
json_data
=
nlohmann
::
json
::
array
();
for
(
auto
i
:
patch_items
)
{
nlohmann
::
json
item
=
{};
...
...
@@ -178,7 +178,7 @@ void udr_nrf::trigger_nf_heartbeat_procedure(uint64_t ms) {
std
::
string
udr_api_root
=
{};
get_udr_api_root
(
udr_api_root
);
std
::
string
remoteUri
=
udr_api_root
+
UDR_NF_REGISTER_URL
+
udr_instance_id
;
udr_client_instance
->
curl_http_client
(
remoteUri
,
method
,
json_data
.
dump
().
c_str
(),
response
);
udr_client_instance
->
curl_http_client
(
remoteUri
,
method
,
json_data
.
dump
().
c_str
(),
response
);
if
(
!
response
.
empty
())
task_connection
.
disconnect
();
}
\ No newline at end of file
src/udr_app/udr_nrf.hpp
View file @
291b70ac
...
...
@@ -20,10 +20,10 @@
*/
/*! \file udr_client.hpp
\author
Tien-Thinh NGUYEN
\author
\company Eurecom
\date 2020
\email:
\email:
contact@openairinterface.org
*/
#ifndef FILE_UDR_NRF_SEEN
...
...
@@ -74,8 +74,8 @@ class udr_nrf {
* @param [void]
* @return void
*/
void
generate_udr_profile
(
udr_profile
&
udr_nf_profile
,
std
::
string
&
udr_instance_id
);
void
generate_udr_profile
(
udr_profile
&
udr_nf_profile
,
std
::
string
&
udr_instance_id
);
/*
* Trigger NF instance registration to NRF
...
...
src/udr_app/udr_profile.cpp
View file @
291b70ac
This diff is collapsed.
Click to expand it.
src/udr_app/udr_profile.hpp
View file @
291b70ac
...
...
@@ -21,10 +21,10 @@
/*! \file udr_profile.hpp
\brief
\author
Tien-Thinh NGUYEN
\author
\company Eurecom
\date 2021
\email:
Tien-Thinh.Nguyen@eurecom.fr
\email:
contact@openairinterface.org
*/
#ifndef FILE_UDR_PROFILE_HPP_SEEN
...
...
@@ -56,7 +56,7 @@ class udr_profile : public std::enable_shared_from_this<udr_profile> {
priority
(
0
),
capacity
(
0
)
{
nf_instance_name
=
{};
nf_status
=
{};
nf_status
=
{};
}
udr_profile
(
const
std
::
string
&
id
)
...
...
@@ -69,21 +69,21 @@ class udr_profile : public std::enable_shared_from_this<udr_profile> {
capacity
(
0
),
nf_type
(
"NF_TYPE_UNKNOWN"
)
{
nf_instance_name
=
{};
nf_status
=
{};
nf_status
=
{};
}
udr_profile
&
operator
=
(
const
udr_profile
&
s
)
{
nf_instance_id
=
s
.
nf_instance_id
;
heartBeat_timer
=
s
.
heartBeat_timer
;
snssais
=
s
.
snssais
;
fqdn
=
s
.
fqdn
;
ipv4_addresses
=
s
.
ipv4_addresses
;
priority
=
s
.
priority
;
capacity
=
s
.
capacity
;
nf_type
=
s
.
nf_type
;
nf_instance_id
=
s
.
nf_instance_id
;
heartBeat_timer
=
s
.
heartBeat_timer
;
snssais
=
s
.
snssais
;
fqdn
=
s
.
fqdn
;
ipv4_addresses
=
s
.
ipv4_addresses
;
priority
=
s
.
priority
;
capacity
=
s
.
capacity
;
nf_type
=
s
.
nf_type
;
nf_instance_name
=
s
.
nf_instance_name
;
nf_status
=
s
.
nf_status
;
udr_info
=
s
.
udr_info
;
nf_status
=
s
.
nf_status
;
udr_info
=
s
.
udr_info
;
return
*
this
;
}
// udr_profile(udr_profile &b) = delete;
...
...
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