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
d00bb873
Commit
d00bb873
authored
Jun 21, 2022
by
Tien Thinh NGUYEN
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Get DB Connection timeout from Conf file
parent
c0a29766
Changes
5
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
31 additions
and
25 deletions
+31
-25
etc/udr.conf
etc/udr.conf
+14
-13
src/common/udr.h
src/common/udr.h
+2
-3
src/udr_app/mysql_db.cpp
src/udr_app/mysql_db.cpp
+2
-2
src/udr_app/udr_config.cpp
src/udr_app/udr_config.cpp
+11
-7
src/udr_app/udr_config.hpp
src/udr_app/udr_config.hpp
+2
-0
No files found.
etc/udr.conf
View file @
d00bb873
...
@@ -9,36 +9,37 @@ UDR =
...
@@ -9,36 +9,37 @@ UDR =
USE_FQDN_DNS
=
"@USE_FQDN_DNS@"
;
# Set to yes if UDR will relying on a DNS to resolve UDM's FQDN
USE_FQDN_DNS
=
"@USE_FQDN_DNS@"
;
# Set to yes if UDR will relying on a DNS to resolve UDM's FQDN
REGISTER_NRF
=
"@REGISTER_NRF@"
;
# Set to yes if UDR resgisters to an NRF
REGISTER_NRF
=
"@REGISTER_NRF@"
;
# Set to yes if UDR resgisters to an NRF
USE_HTTP2
=
"@USE_HTTP2@"
;
# Set to yes to enable HTTP2 for UDR server
USE_HTTP2
=
"@USE_HTTP2@"
;
# Set to yes to enable HTTP2 for UDR server
DATABASE
=
"MySQL"
;
# Set to 'MySQL'/'Cassandra' to use MySQL/Cass, enable HTTP2 for UDR server
DATABASE
=
"MySQL"
;
# Set to 'MySQL'/'Cassandra' to use MySQL/Cassandra
}
}
;
INTERFACES
:
INTERFACES
:
{
{
# NUDR Interface (SBI)
# NUDR Interface (SBI)
NUDR
:
NUDR
:
{
{
INTERFACE_NAME
=
"@UDR_INTERFACE_NAME_FOR_NUDR@"
;
# YOUR NETWORK CONFIG HERE
INTERFACE_NAME
=
"@UDR_INTERFACE_NAME_FOR_NUDR@"
;
IPV4_ADDRESS
=
"read"
;
IPV4_ADDRESS
=
"read"
;
PORT
= @
UDR_INTERFACE_PORT_FOR_NUDR
@;
#
YOUR NETWORK CONFIG HERE
PORT
= @
UDR_INTERFACE_PORT_FOR_NUDR
@;
#
Default value: 80
HTTP2_PORT
= @
UDR_INTERFACE_HTTP2_PORT_FOR_NUDR
@;
# YOUR NETWORK CONFIG HERE
HTTP2_PORT
= @
UDR_INTERFACE_HTTP2_PORT_FOR_NUDR
@;
API_VERSION
=
"@UDR_API_VERSION@"
;
# YOUR NUDR API VERSION CONFIG HERE
API_VERSION
=
"@UDR_API_VERSION@"
;
};
};
};
};
NRF
:
NRF
:
{
{
IPV4_ADDRESS
=
"@NRF_IPV4_ADDRESS@"
;
# YOUR NRF CONFIG HERE
IPV4_ADDRESS
=
"@NRF_IPV4_ADDRESS@"
;
PORT
= @
NRF_PORT
@;
#
YOUR NRF CONFIG HERE (default: 80)
PORT
= @
NRF_PORT
@;
#
Default value: 80
API_VERSION
=
"@NRF_API_VERSION@"
;
# YOUR NRF API VERSION HERE
API_VERSION
=
"@NRF_API_VERSION@"
;
FQDN
=
"@NRF_FQDN@"
;
FQDN
=
"@NRF_FQDN@"
;
};
};
MYSQL
:
MYSQL
:
{
{
# MySQL options
# MySQL options
MYSQL_SERVER
=
"@MYSQL_IPV4_ADDRESS@"
;
# YOUR MYSQL DB ADDRESS HERE
MYSQL_SERVER
=
"@MYSQL_IPV4_ADDRESS@"
;
MYSQL_USER
=
"@MYSQL_USER@"
;
# YOUR MYSQL USER HERE
MYSQL_USER
=
"@MYSQL_USER@"
;
MYSQL_PASS
=
"@MYSQL_PASS@"
;
# YOUR MYSQL PASSWORD HERE
MYSQL_PASS
=
"@MYSQL_PASS@"
;
MYSQL_DB
=
"@MYSQL_DB@"
;
# YOUR DATA BASE NAME HERE
MYSQL_DB
=
"@MYSQL_DB@"
;
DB_CONNECTION_TIMEOUT
=
10
;
# Reset the connection to the DB after expiring the timeout (in second)
};
};
};
};
src/common/udr.h
View file @
d00bb873
...
@@ -4,8 +4,8 @@
...
@@ -4,8 +4,8 @@
* this work for additional information regarding copyright ownership.
* this work for additional information regarding copyright ownership.
* The OpenAirInterface Software Alliance licenses this file to You under
* The OpenAirInterface Software Alliance licenses this file to You under
* the OAI Public License, Version 1.1 (the "License"); you may not use this
* the OAI Public License, Version 1.1 (the "License"); you may not use this
*file except in compliance with the License. You may obtain a copy of the
*
file except in compliance with the License. You may obtain a copy of the
*License at
*
License at
*
*
* http://www.openairinterface.org/?page_id=698
* http://www.openairinterface.org/?page_id=698
*
*
...
@@ -27,7 +27,6 @@
...
@@ -27,7 +27,6 @@
#define HEART_BEAT_TIMER 10
#define HEART_BEAT_TIMER 10
#define DB_CONNECTION_TIMER 1800 // 30 minutes
#define MAX_FIRST_CONNECTION_RETRY 100
#define MAX_FIRST_CONNECTION_RETRY 100
#define MAX_CONNECTION_RETRY 1
#define MAX_CONNECTION_RETRY 1
...
...
src/udr_app/mysql_db.cpp
View file @
d00bb873
...
@@ -110,7 +110,7 @@ void mysql_db::start_event_connection_handling() {
...
@@ -110,7 +110,7 @@ void mysql_db::start_event_connection_handling() {
std
::
chrono
::
system_clock
::
now
().
time_since_epoch
())
std
::
chrono
::
system_clock
::
now
().
time_since_epoch
())
.
count
();
.
count
();
struct
itimerspec
its
;
struct
itimerspec
its
;
its
.
it_value
.
tv_sec
=
DB_CONNECTION_TIMER
;
// seconds
its
.
it_value
.
tv_sec
=
udr_cfg
.
mysql
.
connection_timeout
;
// seconds
its
.
it_value
.
tv_nsec
=
0
;
// 100 * 1000 * 1000; //100ms
its
.
it_value
.
tv_nsec
=
0
;
// 100 * 1000 * 1000; //100ms
const
uint64_t
interval
=
const
uint64_t
interval
=
its
.
it_value
.
tv_sec
*
1000
+
its
.
it_value
.
tv_sec
*
1000
+
...
...
src/udr_app/udr_config.cpp
View file @
d00bb873
/*
/*
* Licensed to the OpenAirInterface (OAI) Software Alliance under one or more
* Licensed to the OpenAirInterface (OAI) Software Alliance mysql_conf_tunder
* contributor license agreements. See the NOTICE file distributed with
*one or more contributor license agreements. See the NOTICE file distributed
* this work for additional information regarding copyright ownership.
*with this work for additional information regarding copyright ownership. The
* The OpenAirInterface Software Alliance licenses this file to You under
*OpenAirInterface Software Alliance licenses this file to You under the OAI
* the OAI Public License, Version 1.1 (the "License"); you may not use this
*Public License, Version 1.1 (the "License"); you may not use this file except
* file except in compliance with the License. You may obtain a copy of the
*in compliance with the License. You may obtain a copy of the License at
* License at
*
*
* http://www.openairinterface.org/?page_id=698
* http://www.openairinterface.org/?page_id=698
*
*
...
@@ -223,6 +222,9 @@ int udr_config::load(const std ::string& config_file) {
...
@@ -223,6 +222,9 @@ int udr_config::load(const std ::string& config_file) {
mysql_cfg
.
lookupValue
(
UDR_CONFIG_STRING_MYSQL_USER
,
mysql
.
mysql_user
);
mysql_cfg
.
lookupValue
(
UDR_CONFIG_STRING_MYSQL_USER
,
mysql
.
mysql_user
);
mysql_cfg
.
lookupValue
(
UDR_CONFIG_STRING_MYSQL_PASS
,
mysql
.
mysql_pass
);
mysql_cfg
.
lookupValue
(
UDR_CONFIG_STRING_MYSQL_PASS
,
mysql
.
mysql_pass
);
mysql_cfg
.
lookupValue
(
UDR_CONFIG_STRING_MYSQL_DB
,
mysql
.
mysql_db
);
mysql_cfg
.
lookupValue
(
UDR_CONFIG_STRING_MYSQL_DB
,
mysql
.
mysql_db
);
mysql_cfg
.
lookupValue
(
UDR_CONFIG_STRING_MYSQL_DB_CONNECTION_TIMEOUT
,
mysql
.
connection_timeout
);
}
catch
(
const
SettingNotFoundException
&
nfex
)
{
}
catch
(
const
SettingNotFoundException
&
nfex
)
{
Logger
::
udr_app
().
error
(
Logger
::
udr_app
().
error
(
"%s : %s, using defaults"
,
nfex
.
what
(),
nfex
.
getPath
());
"%s : %s, using defaults"
,
nfex
.
what
(),
nfex
.
getPath
());
...
@@ -336,6 +338,8 @@ void udr_config::display() {
...
@@ -336,6 +338,8 @@ void udr_config::display() {
" Password ..............: %s"
,
mysql
.
mysql_pass
.
c_str
());
" Password ..............: %s"
,
mysql
.
mysql_pass
.
c_str
());
Logger
::
config
().
info
(
Logger
::
config
().
info
(
" Database ..............: %s"
,
mysql
.
mysql_db
.
c_str
());
" Database ..............: %s"
,
mysql
.
mysql_db
.
c_str
());
Logger
::
config
().
info
(
" DB Timeout ............: %d (seconds)"
,
mysql
.
connection_timeout
);
}
else
if
(
db_type
==
DB_TYPE_CASSANDRA
)
{
}
else
if
(
db_type
==
DB_TYPE_CASSANDRA
)
{
Logger
::
config
().
info
(
"- Cassandra:"
);
Logger
::
config
().
info
(
"- Cassandra:"
);
Logger
::
config
().
info
(
Logger
::
config
().
info
(
...
...
src/udr_app/udr_config.hpp
View file @
d00bb873
...
@@ -58,6 +58,7 @@
...
@@ -58,6 +58,7 @@
#define UDR_CONFIG_STRING_MYSQL_USER "MYSQL_USER"
#define UDR_CONFIG_STRING_MYSQL_USER "MYSQL_USER"
#define UDR_CONFIG_STRING_MYSQL_PASS "MYSQL_PASS"
#define UDR_CONFIG_STRING_MYSQL_PASS "MYSQL_PASS"
#define UDR_CONFIG_STRING_MYSQL_DB "MYSQL_DB"
#define UDR_CONFIG_STRING_MYSQL_DB "MYSQL_DB"
#define UDR_CONFIG_STRING_MYSQL_DB_CONNECTION_TIMEOUT "DB_CONNECTION_TIMEOUT"
using
namespace
libconfig
;
using
namespace
libconfig
;
...
@@ -68,6 +69,7 @@ typedef struct {
...
@@ -68,6 +69,7 @@ typedef struct {
std
::
string
mysql_user
;
std
::
string
mysql_user
;
std
::
string
mysql_pass
;
std
::
string
mysql_pass
;
std
::
string
mysql_db
;
std
::
string
mysql_db
;
uint32_t
connection_timeout
;
}
mysql_conf_t
;
}
mysql_conf_t
;
typedef
struct
interface_cfg_s
{
typedef
struct
interface_cfg_s
{
...
...
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