Commit 35351305 authored by Tien-Thinh Nguyen's avatar Tien-Thinh Nguyen

Update configuration file

parent a58a543b
...@@ -6,10 +6,10 @@ UDR = ...@@ -6,10 +6,10 @@ UDR =
SUPPORT_FEATURES:{ SUPPORT_FEATURES:{
# STRING, {"yes", "no"},
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
} }
INTERFACES: INTERFACES:
......
...@@ -78,4 +78,7 @@ typedef enum db_type_s { ...@@ -78,4 +78,7 @@ typedef enum db_type_s {
DB_TYPE_CASSANDRA = 2 DB_TYPE_CASSANDRA = 2
} db_type_t; } db_type_t;
static const std::vector<std::string> db_type_e2str = {"Unknown", "MySQL",
"Cassandra"};
#endif #endif
...@@ -19,11 +19,19 @@ ...@@ -19,11 +19,19 @@
* contact@openairinterface.org * contact@openairinterface.org
*/ */
/*! \file cassandra_db.cpp
\brief
\author Tien-Thinh NGUYEN
\company Eurecom
\date 2022
\email: Tien-Thinh.Nguyen@eurecom.fr
*/
#include "cassandra_db.hpp" #include "cassandra_db.hpp"
#include "udr_config.hpp"
#include "AuthenticationSubscription.h" #include "AuthenticationSubscription.h"
#include "logger.hpp" #include "logger.hpp"
#include "udr_config.hpp"
using namespace oai::udr::app; using namespace oai::udr::app;
using namespace oai::udr::model; using namespace oai::udr::model;
......
...@@ -19,6 +19,14 @@ ...@@ -19,6 +19,14 @@
* contact@openairinterface.org * contact@openairinterface.org
*/ */
/*! \file cassandra_db.hpp
\brief
\author Tien-Thinh NGUYEN
\company Eurecom
\date 2022
\email: Tien-Thinh.Nguyen@eurecom.fr
*/
#ifndef CASSANDRA_DB_HPP #ifndef CASSANDRA_DB_HPP
#define CASSANDRA_DB_HPP #define CASSANDRA_DB_HPP
......
...@@ -19,15 +19,23 @@ ...@@ -19,15 +19,23 @@
* contact@openairinterface.org * contact@openairinterface.org
*/ */
/*! \file databse_wrapper.hpp
\brief
\author Tien-Thinh NGUYEN
\company Eurecom
\date 2022
\email: Tien-Thinh.Nguyen@eurecom.fr
*/
#ifndef DATABASE_WRAPPER_HPP #ifndef DATABASE_WRAPPER_HPP
#define DATABASE_WRAPPER_HPP #define DATABASE_WRAPPER_HPP
#include "database_wrapper_abstraction.hpp" #include <nlohmann/json.hpp>
#include "udr.h"
#include "Snssai.h" #include "Snssai.h"
#include "database_wrapper_abstraction.hpp"
#include "logger.hpp" #include "logger.hpp"
#include "udr.h"
#include <nlohmann/json.hpp>
namespace oai::udr::app { namespace oai::udr::app {
......
...@@ -19,20 +19,28 @@ ...@@ -19,20 +19,28 @@
* contact@openairinterface.org * contact@openairinterface.org
*/ */
/*! \file databse_wrapper_abstraction.hpp
\brief
\author Tien-Thinh NGUYEN
\company Eurecom
\date 2022
\email: Tien-Thinh.Nguyen@eurecom.fr
*/
#ifndef DATABASE_WRAPPER_ABSTRACTION_HPP #ifndef DATABASE_WRAPPER_ABSTRACTION_HPP
#define DATABASE_WRAPPER_ABSTRACTION_HPP #define DATABASE_WRAPPER_ABSTRACTION_HPP
#include "udr.h"
#include "Snssai.h" #include <nlohmann/json.hpp>
#include "logger.hpp"
#include "Amf3GppAccessRegistration.h" #include "Amf3GppAccessRegistration.h"
#include "AuthEvent.h" #include "AuthEvent.h"
#include "AuthenticationSubscription.h"
#include "PatchItem.h" #include "PatchItem.h"
#include "SdmSubscription.h" #include "SdmSubscription.h"
#include "SmfRegistration.h" #include "SmfRegistration.h"
#include "AuthenticationSubscription.h" #include "Snssai.h"
#include "logger.hpp"
#include <nlohmann/json.hpp> #include "udr.h"
namespace oai::udr::app { namespace oai::udr::app {
......
...@@ -19,14 +19,22 @@ ...@@ -19,14 +19,22 @@
* contact@openairinterface.org * contact@openairinterface.org
*/ */
/*! \file mysql_db.cpp
\brief
\author Tien-Thinh NGUYEN
\company Eurecom
\date 2022
\email: Tien-Thinh.Nguyen@eurecom.fr
*/
#include "mysql_db.hpp" #include "mysql_db.hpp"
#include "udr_config.hpp"
#include "AuthenticationSubscription.h"
#include "AccessAndMobilitySubscriptionData.h" #include "AccessAndMobilitySubscriptionData.h"
#include "SdmSubscription.h" #include "AuthenticationSubscription.h"
#include "ProblemDetails.h" #include "ProblemDetails.h"
#include "SdmSubscription.h"
#include "logger.hpp" #include "logger.hpp"
#include "udr_config.hpp"
using namespace oai::udr::app; using namespace oai::udr::app;
using namespace oai::udr::model; using namespace oai::udr::model;
......
...@@ -19,13 +19,22 @@ ...@@ -19,13 +19,22 @@
* contact@openairinterface.org * contact@openairinterface.org
*/ */
/*! \file mysql_db.hpp
\brief
\author Tien-Thinh NGUYEN
\company Eurecom
\date 2022
\email: Tien-Thinh.Nguyen@eurecom.fr
*/
#ifndef MYSQL_DB_HPP #ifndef MYSQL_DB_HPP
#define MYSQL_DB_HPP #define MYSQL_DB_HPP
#include "database_wrapper.hpp"
#include "Amf3GppAccessRegistration.h"
#include <mysql/mysql.h> #include <mysql/mysql.h>
#include "Amf3GppAccessRegistration.h"
#include "database_wrapper.hpp"
namespace oai::udr::app { namespace oai::udr::app {
class mysql_db : public database_wrapper<mysql_db> { class mysql_db : public database_wrapper<mysql_db> {
......
...@@ -29,9 +29,10 @@ ...@@ -29,9 +29,10 @@
#include "task_manager.hpp" #include "task_manager.hpp"
#include <unistd.h>
#include <iostream> #include <iostream>
#include <thread> #include <thread>
#include <unistd.h>
#include "logger.hpp" #include "logger.hpp"
......
...@@ -24,17 +24,17 @@ ...@@ -24,17 +24,17 @@
\author \author
\company Eurecom \company Eurecom
\date 2020 \date 2020
\email: Tien-Thinh.Nguyen@eurecom.fr \email:
*/ */
#ifndef TASK_MANAGER_H_ #ifndef TASK_MANAGER_H_
#define TASK_MANAGER_H_ #define TASK_MANAGER_H_
#include "udr_event.hpp"
#include <linux/types.h> #include <linux/types.h>
#include <sys/timerfd.h> #include <sys/timerfd.h>
#include "udr_event.hpp"
namespace oai { namespace oai {
namespace udr { namespace udr {
namespace app { namespace app {
......
...@@ -32,11 +32,11 @@ ...@@ -32,11 +32,11 @@
#include "3gpp_29.500.h" #include "3gpp_29.500.h"
#include "AccessAndMobilitySubscriptionData.h" #include "AccessAndMobilitySubscriptionData.h"
#include "AuthenticationSubscription.h" #include "AuthenticationSubscription.h"
#include "cassandra_db.hpp"
#include "logger.hpp" #include "logger.hpp"
#include "mysql_db.hpp"
#include "udr_config.hpp" #include "udr_config.hpp"
#include "udr_nrf.hpp" #include "udr_nrf.hpp"
#include "mysql_db.hpp"
#include "cassandra_db.hpp"
using namespace oai::udr::app; using namespace oai::udr::app;
using namespace oai::udr::model; using namespace oai::udr::model;
......
...@@ -30,21 +30,20 @@ ...@@ -30,21 +30,20 @@
#ifndef FILE_UDR_APP_HPP_SEEN #ifndef FILE_UDR_APP_HPP_SEEN
#define FILE_UDR_APP_HPP_SEEN #define FILE_UDR_APP_HPP_SEEN
#include "database_wrapper.hpp"
#include <mysql/mysql.h> #include <mysql/mysql.h>
#include <pistache/http.h> #include <pistache/http.h>
#include "udr_event.hpp"
#include <nlohmann/json.hpp> #include <nlohmann/json.hpp>
#include <string> #include <string>
#include "Amf3GppAccessRegistration.h" #include "Amf3GppAccessRegistration.h"
#include "AuthEvent.h" #include "AuthEvent.h"
#include "AuthenticationSubscription.h"
#include "PatchItem.h" #include "PatchItem.h"
#include "SdmSubscription.h" #include "SdmSubscription.h"
#include "SmfRegistration.h" #include "SmfRegistration.h"
#include "AuthenticationSubscription.h" #include "database_wrapper.hpp"
#include "udr_event.hpp"
using namespace oai::udr::model; using namespace oai::udr::model;
......
...@@ -28,14 +28,15 @@ ...@@ -28,14 +28,15 @@
*/ */
#include "udr_client.hpp" #include "udr_client.hpp"
#include "3gpp_29.500.h"
#include <curl/curl.h> #include <curl/curl.h>
#include <nlohmann/json.hpp>
#include <pistache/http.h> #include <pistache/http.h>
#include <pistache/mime.h> #include <pistache/mime.h>
#include <nlohmann/json.hpp>
#include <stdexcept> #include <stdexcept>
#include "3gpp_29.500.h"
#include "logger.hpp" #include "logger.hpp"
#include "udr.h" #include "udr.h"
......
...@@ -29,11 +29,11 @@ ...@@ -29,11 +29,11 @@
#ifndef FILE_UDR_CLIENT_HPP_SEEN #ifndef FILE_UDR_CLIENT_HPP_SEEN
#define FILE_UDR_CLIENT_HPP_SEEN #define FILE_UDR_CLIENT_HPP_SEEN
#include <curl/curl.h>
#include <map> #include <map>
#include <thread> #include <thread>
#include <curl/curl.h>
#include "logger.hpp" #include "logger.hpp"
#include "udr_config.hpp" #include "udr_config.hpp"
......
...@@ -21,12 +21,11 @@ ...@@ -21,12 +21,11 @@
#include "udr_config.hpp" #include "udr_config.hpp"
#include <iostream>
#include <libconfig.h++>
#include <boost/algorithm/string.hpp> #include <boost/algorithm/string.hpp>
#include <boost/algorithm/string/classification.hpp> #include <boost/algorithm/string/classification.hpp>
#include <boost/algorithm/string/split.hpp> #include <boost/algorithm/string/split.hpp>
#include <iostream>
#include <libconfig.h++>
#include "common_defs.h" #include "common_defs.h"
#include "fqdn.hpp" #include "fqdn.hpp"
...@@ -142,6 +141,17 @@ int udr_config::load(const std ::string& config_file) { ...@@ -142,6 +141,17 @@ int udr_config::load(const std ::string& config_file) {
} else { } else {
use_http2 = false; use_http2 = false;
} }
support_features.lookupValue(UDR_CONFIG_STRING_DATABASE_TYPE, opt);
if (boost::iequals(opt, "cassandra")) {
db_type = DB_TYPE_CASSANDRA;
} else if (boost::iequals(opt, "mysql")) {
db_type = DB_TYPE_MYSQL;
} else {
db_type = DB_TYPE_MYSQL; // Default for now
}
} 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());
...@@ -281,20 +291,19 @@ void udr_config::display() { ...@@ -281,20 +291,19 @@ void udr_config::display() {
Logger::config().info( Logger::config().info(
"====================== UDR ====================="); "====================== UDR =====================");
Logger::config().info("Configuration UDR:"); Logger::config().info("Configuration UDR:");
Logger::config().info( Logger::config().info("- Instance ................: %d", instance);
"- Instance ...........................................: %d", instance); Logger::config().info("- PID dir .................: %s", pid_dir.c_str());
Logger::config().info( Logger::config().info("- UDR Name ................: %s", udr_name.c_str());
"- PID dir ............................................: %s",
pid_dir.c_str());
Logger::config().info("- UDR Name ..............: %s", udr_name.c_str());
Logger::config().info("- Nudr Networking:"); Logger::config().info("- Nudr Networking:");
Logger::config().info(" Interface name ......: %s", nudr.if_name.c_str());
Logger::config().info(" IPv4 Addr ...........: %s", inet_ntoa(nudr.addr4));
Logger::config().info(" HTTP1 Port ..........: %d", nudr.port);
Logger::config().info(" HTTP2 port ..........: %d", nudr_http2_port);
Logger::config().info( Logger::config().info(
" API version..........: %s", nudr.api_version.c_str()); " Interface name ........: %s", nudr.if_name.c_str());
Logger::config().info(
" IPv4 Addr .............: %s", inet_ntoa(nudr.addr4));
Logger::config().info(" HTTP1 Port ............: %d", nudr.port);
Logger::config().info(" HTTP2 port ............: %d", nudr_http2_port);
Logger::config().info(
" API version ...........: %s", nudr.api_version.c_str());
Logger::config().info("- Supported Features:"); Logger::config().info("- Supported Features:");
Logger::config().info( Logger::config().info(
" Register NRF ..........: %s", register_nrf ? "Yes" : "No"); " Register NRF ..........: %s", register_nrf ? "Yes" : "No");
...@@ -302,28 +311,37 @@ void udr_config::display() { ...@@ -302,28 +311,37 @@ void udr_config::display() {
" Use FQDN ..............: %s", use_fqdn_dns ? "Yes" : "No"); " Use FQDN ..............: %s", use_fqdn_dns ? "Yes" : "No");
Logger::config().info( Logger::config().info(
" Use HTTP2 .............: %s", use_http2 ? "Yes" : "No"); " Use HTTP2 .............: %s", use_http2 ? "Yes" : "No");
Logger::config().info("- NRF:");
Logger::config().info(
" IPv4 Addr ............: %s",
inet_ntoa(*((struct in_addr*) &nrf_addr.ipv4_addr)));
Logger::config().info(" Port .................: %lu ", nrf_addr.port);
Logger::config().info( Logger::config().info(
" API version ..........: %s", nrf_addr.api_version.c_str()); " Database ..............: %s", db_type_e2str[db_type].c_str());
if (use_fqdn_dns) if (register_nrf) {
Logger::config().info("- NRF:");
Logger::config().info( Logger::config().info(
" FQDN .................: %s", nrf_addr.fqdn.c_str()); " IPv4 Addr .............: %s",
Logger::config().info( inet_ntoa(*((struct in_addr*) &nrf_addr.ipv4_addr)));
"- MYSQL Server Addr...................................: %s", Logger::config().info(" Port ..................: %lu ", nrf_addr.port);
mysql.mysql_server.c_str()); Logger::config().info(
Logger::config().info( " API version ...........: %s", nrf_addr.api_version.c_str());
"- MYSQL user .........................................: %s", if (use_fqdn_dns)
mysql.mysql_user.c_str()); Logger::config().info(
Logger::config().info( " FQDN ..................: %s", nrf_addr.fqdn.c_str());
"- MYSQL pass .........................................: %s", }
mysql.mysql_pass.c_str());
Logger::config().info( if (db_type == DB_TYPE_MYSQL) {
"- MYSQL db ...........................................: %s", Logger::config().info("- MySQL:");
mysql.mysql_db.c_str()); Logger::config().info(
" Server Addr ...........: %s", mysql.mysql_server.c_str());
Logger::config().info(
" Username ..............: %s", mysql.mysql_user.c_str());
Logger::config().info(
" Password ..............: %s", mysql.mysql_pass.c_str());
Logger::config().info(
" Database ..............: %s", mysql.mysql_db.c_str());
} else if (db_type == DB_TYPE_CASSANDRA) {
Logger::config().info("- Cassandra:");
Logger::config().info(
" Cassandra DB ..........: not "
"supported!");
}
} }
} // namespace oai::udr::config } // namespace oai::udr::config
...@@ -22,13 +22,14 @@ ...@@ -22,13 +22,14 @@
#ifndef _UDR_CONFIG_H_ #ifndef _UDR_CONFIG_H_
#define _UDR_CONFIG_H_ #define _UDR_CONFIG_H_
#include "udr.h"
#include <arpa/inet.h> #include <arpa/inet.h>
#include <libconfig.h++>
#include <netinet/in.h> #include <netinet/in.h>
#include <libconfig.h++>
#include <string> #include <string>
#include "udr.h"
#define UDR_CONFIG_STRING_UDR_CONFIG "UDR" #define UDR_CONFIG_STRING_UDR_CONFIG "UDR"
#define UDR_CONFIG_STRING_INSTANCE_ID "INSTANCE_ID" #define UDR_CONFIG_STRING_INSTANCE_ID "INSTANCE_ID"
#define UDR_CONFIG_STRING_UDR_NAME "UDR_NAME" #define UDR_CONFIG_STRING_UDR_NAME "UDR_NAME"
...@@ -51,6 +52,7 @@ ...@@ -51,6 +52,7 @@
#define UDM_CONFIG_STRING_SUPPORT_FEATURES_USE_HTTP2 "USE_HTTP2" #define UDM_CONFIG_STRING_SUPPORT_FEATURES_USE_HTTP2 "USE_HTTP2"
#define UDR_CONFIG_STRING_FQDN_DNS "FQDN" #define UDR_CONFIG_STRING_FQDN_DNS "FQDN"
#define UDR_CONFIG_STRING_DATABASE_TYPE "DATABASE"
#define UDR_CONFIG_STRING_MYSQL "MYSQL" #define UDR_CONFIG_STRING_MYSQL "MYSQL"
#define UDR_CONFIG_STRING_MYSQL_SERVER "MYSQL_SERVER" #define UDR_CONFIG_STRING_MYSQL_SERVER "MYSQL_SERVER"
#define UDR_CONFIG_STRING_MYSQL_USER "MYSQL_USER" #define UDR_CONFIG_STRING_MYSQL_USER "MYSQL_USER"
......
...@@ -28,20 +28,21 @@ ...@@ -28,20 +28,21 @@
*/ */
#include "udr_nrf.hpp" #include "udr_nrf.hpp"
#include "udr_app.hpp"
#include "udr_client.hpp"
#include "udr_profile.hpp"
#include <boost/uuid/random_generator.hpp>
#include <boost/uuid/uuid_io.hpp>
#include <curl/curl.h> #include <curl/curl.h>
#include <nlohmann/json.hpp>
#include <pistache/http.h> #include <pistache/http.h>
#include <pistache/mime.h> #include <pistache/mime.h>
#include <boost/uuid/random_generator.hpp>
#include <boost/uuid/uuid_io.hpp>
#include <nlohmann/json.hpp>
#include <stdexcept> #include <stdexcept>
#include "logger.hpp" #include "logger.hpp"
#include "udr.h" #include "udr.h"
#include "udr_app.hpp"
#include "udr_client.hpp"
#include "udr_profile.hpp"
using namespace oai::udr::config; using namespace oai::udr::config;
// using namespace udr; // using namespace udr;
......
...@@ -29,11 +29,11 @@ ...@@ -29,11 +29,11 @@
#ifndef FILE_UDR_NRF_SEEN #ifndef FILE_UDR_NRF_SEEN
#define FILE_UDR_NRF_SEEN #define FILE_UDR_NRF_SEEN
#include <curl/curl.h>
#include <map> #include <map>
#include <thread> #include <thread>
#include <curl/curl.h>
#include "logger.hpp" #include "logger.hpp"
#include "udr_config.hpp" #include "udr_config.hpp"
#include "udr_event.hpp" #include "udr_event.hpp"
......
...@@ -27,13 +27,14 @@ ...@@ -27,13 +27,14 @@
\email: Tien-Thinh.Nguyen@eurecom.fr \email: Tien-Thinh.Nguyen@eurecom.fr
*/ */
#include "udr_profile.hpp"
#include <boost/algorithm/string/classification.hpp> #include <boost/algorithm/string/classification.hpp>
#include <boost/algorithm/string/split.hpp> #include <boost/algorithm/string/split.hpp>
#include "fqdn.hpp" #include "fqdn.hpp"
#include "logger.hpp" #include "logger.hpp"
#include "string.hpp" #include "string.hpp"
#include "udr_profile.hpp"
// using namespace udr; // using namespace udr;
using namespace oai::udr::app; using namespace oai::udr::app;
......
...@@ -32,6 +32,7 @@ ...@@ -32,6 +32,7 @@
#include <arpa/inet.h> #include <arpa/inet.h>
#include <netinet/in.h> #include <netinet/in.h>
#include <nlohmann/json.hpp> #include <nlohmann/json.hpp>
#include <shared_mutex> #include <shared_mutex>
#include <vector> #include <vector>
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment