Commit 73eaf564 authored by yangjian's avatar yangjian
Browse files

update udr databases

parent 1a5c118a
./build/UDR/*
./etc/*
......@@ -49,15 +49,8 @@ void AMF3GPPAccessRegistrationDocumentApiImpl::create_amf_context3gpp(
MYSQL_RES *res = NULL;
MYSQL_ROW row;
std::string tmp_ueId = "";
if (ueId.size() == 15) {
tmp_ueId = "imsi-" + ueId;
} else {
tmp_ueId = ueId;
}
const std::string select_AMF3GPPAccessRegistration =
"select * from Amf3GppAccessRegistration WHERE ueid='" + tmp_ueId + "'";
"select * from Amf3GppAccessRegistration WHERE ueid='" + ueId + "'";
std::string query;
nlohmann::json j;
......@@ -171,10 +164,10 @@ void AMF3GPPAccessRegistrationDocumentApiImpl::create_amf_context3gpp(
query += ",guami='" + j.dump() + "'";
to_json(j, amf3GppAccessRegistration.getRatType());
query += ",ratType='" + j.dump() + "'";
query += " where ueid='" + tmp_ueId + "'";
query += " where ueid='" + ueId + "'";
} else {
query =
"insert into Amf3GppAccessRegistration set ueid='" + tmp_ueId + "'" +
"insert into Amf3GppAccessRegistration set ueid='" + ueId + "'" +
",amfInstanceId='" + amf3GppAccessRegistration.getAmfInstanceId() +
"'" +
(amf3GppAccessRegistration.supportedFeaturesIsSet()
......@@ -297,16 +290,9 @@ void AMF3GPPAccessRegistrationDocumentApiImpl::query_amf_context3gpp(
nlohmann::json j;
std::string tmp_ueId = "";
if (ueId.size() == 15) {
tmp_ueId = "imsi-" + ueId;
} else {
tmp_ueId = ueId;
}
Amf3GppAccessRegistration amf3gppaccessregistration;
const std::string query =
"select * from Amf3GppAccessRegistration WHERE ueid='" + tmp_ueId + "'";
"select * from Amf3GppAccessRegistration WHERE ueid='" + ueId + "'";
if (mysql_real_query(mysql_WitcommUDRDB, query.c_str(),
(unsigned long)query.size())) {
......
......@@ -41,17 +41,10 @@ void AccessAndMobilitySubscriptionDataDocumentApiImpl::query_am_data(
nlohmann::json j;
std::string tmp_ueId = "";
if (ueId.size() == 15) {
tmp_ueId = "imsi-" + ueId;
} else {
tmp_ueId = ueId;
}
AccessAndMobilitySubscriptionData accessandmobilitysubscriptiondata;
const std::string query =
"select * from AccessAndMobilitySubscriptionData WHERE ueid='" +
tmp_ueId + "' and servingPlmnid='" + servingPlmnId + "'";
ueId + "' and servingPlmnid='" + servingPlmnId + "'";
if (mysql_real_query(mysql_WitcommUDRDB, query.c_str(),
(unsigned long)query.size())) {
......
......@@ -33,15 +33,9 @@ void AuthenticationStatusDocumentApiImpl::create_authentication_status(
// response.send(Pistache::Http::Code::Ok, "create_authentication_status\n");
MYSQL_RES *res = NULL;
MYSQL_ROW row;
std::string tmp_ueId = "";
if (ueId.size() == 15) {
tmp_ueId = "imsi-" + ueId;
} else {
tmp_ueId = ueId;
}
const std::string select_AuthenticationStatus =
"select * from AuthenticationStatus WHERE ueid='" + tmp_ueId + "'";
"select * from AuthenticationStatus WHERE ueid='" + ueId + "'";
std::string query;
nlohmann::json j;
......@@ -71,9 +65,9 @@ void AuthenticationStatusDocumentApiImpl::create_authentication_status(
: "");
// to_json(j,authEvent.getAuthType());
// query += ",authType='"+j.dump()+"'";
query += " where ueid='" + tmp_ueId + "'";
query += " where ueid='" + ueId + "'";
} else {
query = "insert into AuthenticationStatus set ueid='" + tmp_ueId + "'" +
query = "insert into AuthenticationStatus set ueid='" + ueId + "'" +
",nfInstanceId='" + authEvent.getNfInstanceId() + "'" +
",success=" + (authEvent.isSuccess() ? "1" : "0") + ",timeStamp='" +
authEvent.getTimeStamp() + "'" + ",authType='" +
......@@ -103,15 +97,9 @@ void AuthenticationStatusDocumentApiImpl::create_authentication_status(
void AuthenticationStatusDocumentApiImpl::delete_authentication_status(
const std::string &ueId, Pistache::Http::ResponseWriter &response) {
std::string tmp_ueId = "";
if (ueId.size() == 15) {
tmp_ueId = "imsi-" + ueId;
} else {
tmp_ueId = ueId;
}
const std::string query =
"DELETE from AuthenticationStatus WHERE ueid='" + tmp_ueId + "'";
"DELETE from AuthenticationStatus WHERE ueid='" + ueId + "'";
if (mysql_real_query(mysql_WitcommUDRDB, query.c_str(),
(unsigned long)query.size())) {
......@@ -133,16 +121,10 @@ void AuthenticationStatusDocumentApiImpl::query_authentication_status(
MYSQL_FIELD *field = nullptr;
nlohmann::json j;
std::string tmp_ueId = "";
if (ueId.size() == 15) {
tmp_ueId = "imsi-" + ueId;
} else {
tmp_ueId = ueId;
}
AuthEvent authenticationstatus;
const std::string query =
"select * from AuthenticationStatus WHERE ueid='" + tmp_ueId + "'";
"select * from AuthenticationStatus WHERE ueid='" + ueId + "'";
if (mysql_real_query(mysql_WitcommUDRDB, query.c_str(),
(unsigned long)query.size())) {
......
......@@ -39,14 +39,9 @@ void AuthenticationSubscriptionDocumentApiImpl::
MYSQL_RES *res = NULL;
MYSQL_ROW row;
std::string tmp_ueId = "";
if (ueId.size() == 15) {
tmp_ueId = "imsi-" + ueId;
} else {
tmp_ueId = ueId;
}
const std::string select_Authenticationsubscription =
"select * from AuthenticationSubscription WHERE ueid='" + tmp_ueId + "'";
"select * from AuthenticationSubscription WHERE ueid='" + ueId + "'";
std::string query;
nlohmann::json j, tmp_j;
......@@ -78,7 +73,7 @@ void AuthenticationSubscriptionDocumentApiImpl::
to_json(sequencenumber_j, sequencenumber);
query += sequencenumber_j.dump() + "'";
query += " where ueid='" + tmp_ueId + "'";
query += " where ueid='" + ueId + "'";
} else {
Logger::udr_server().error(
"AuthenticationSubscription no data!SQL(%s)",
......@@ -118,16 +113,10 @@ void AuthenticationSubscriptionDocumentApiImpl::
MYSQL_FIELD *field = nullptr;
nlohmann::json j;
std::string tmp_ueId = "s";
if (ueId.size() == 15) {
tmp_ueId = "imsi-" + ueId;
} else {
tmp_ueId = ueId;
}
AuthenticationSubscription authenticationsubscription;
const std::string query =
"select * from AuthenticationSubscription WHERE ueid='" + tmp_ueId + "'";
"select * from AuthenticationSubscription WHERE ueid='" + ueId + "'";
if (mysql_real_query(mysql_WitcommUDRDB, query.c_str(),
(unsigned long)query.size())) {
......
......@@ -41,18 +41,11 @@ void SDMSubscriptionDocumentApiImpl::querysdm_subscription(
MYSQL_ROW row;
MYSQL_FIELD *field = nullptr;
std::string tmp_ueId = "";
if (ueId.size() == 15) {
tmp_ueId = "imsi-" + ueId;
} else {
tmp_ueId = ueId;
}
nlohmann::json j;
SdmSubscription SdmSubscriptions;
const std::string query = "SELECT * from SdmSubscriptions WHERE ueid='" +
tmp_ueId + "' AND subsId=" + subsId;
ueId + "' AND subsId=" + subsId;
if (mysql_real_query(mysql_WitcommUDRDB, query.c_str(),
(unsigned long)query.size())) {
......@@ -141,19 +134,12 @@ void SDMSubscriptionDocumentApiImpl::removesdm_subscriptions(
nlohmann::json j;
ProblemDetails problemdetails;
std::string tmp_ueId = "";
if (ueId.size() == 15) {
tmp_ueId = "imsi-" + ueId;
} else {
tmp_ueId = ueId;
}
const std::string select_query =
"SELECT * from SdmSubscriptions WHERE ueid='" + tmp_ueId +
"SELECT * from SdmSubscriptions WHERE ueid='" + ueId +
"' AND subsId=" + subsId;
const std::string query = "DELETE from SdmSubscriptions WHERE ueid='" +
tmp_ueId + "' AND subsId=" + subsId;
ueId + "' AND subsId=" + subsId;
if (mysql_real_query(mysql_WitcommUDRDB, select_query.c_str(),
(unsigned long)select_query.size())) {
......@@ -201,15 +187,8 @@ void SDMSubscriptionDocumentApiImpl::updatesdmsubscriptions(
MYSQL_RES *res = NULL;
MYSQL_ROW row;
std::string tmp_ueId = "";
if (ueId.size() == 15) {
tmp_ueId = "imsi-" + ueId;
} else {
tmp_ueId = ueId;
}
const std::string select_query =
"SELECT * from SdmSubscriptions WHERE ueid='" + tmp_ueId +
"SELECT * from SdmSubscriptions WHERE ueid='" + ueId +
"' AND subsId=" + subsId;
std::string query;
nlohmann::json j;
......@@ -282,7 +261,7 @@ void SDMSubscriptionDocumentApiImpl::updatesdmsubscriptions(
query +=
",monitoredResourceUris='" + MonitoredResourceUris_json.dump() + "'";
query += " where ueid='" + tmp_ueId + "' AND subsId=" + subsId;
query += " where ueid='" + ueId + "' AND subsId=" + subsId;
} else {
to_json(j, problemdetails);
response.send(Pistache::Http::Code::Not_Found, j.dump());
......
......@@ -34,17 +34,10 @@ void SDMSubscriptionsCollectionApiImpl::create_sdm_subscriptions(
MYSQL_ROW row;
nlohmann::json j;
std::string tmp_ueId = "";
if (ueId.size() == 15) {
tmp_ueId = "imsi-" + ueId;
} else {
tmp_ueId = ueId;
}
int32_t subsId = 0;
int32_t count = 0;
std::string query =
"SELECT subsId from SdmSubscriptions WHERE ueid='" + tmp_ueId + "'";
"SELECT subsId from SdmSubscriptions WHERE ueid='" + ueId + "'";
if (mysql_real_query(mysql_WitcommUDRDB, query.c_str(),
(unsigned long)query.size())) {
Logger::udr_server().error("mysql_real_query failure!SQL(%s)",
......@@ -70,7 +63,7 @@ void SDMSubscriptionsCollectionApiImpl::create_sdm_subscriptions(
//****** add query *******
query =
"insert into SdmSubscriptions set ueid='" + tmp_ueId + "'" +
"insert into SdmSubscriptions set ueid='" + ueId + "'" +
",nfInstanceId='" + sdmSubscription.getNfInstanceId() + "'" +
(sdmSubscription.implicitUnsubscribeIsSet()
? (sdmSubscription.isImplicitUnsubscribe()
......@@ -152,15 +145,8 @@ void SDMSubscriptionsCollectionApiImpl::querysdmsubscriptions(
nlohmann::json j, tmp;
std::string tmp_ueId = "";
if (ueId.size() == 15) {
tmp_ueId = "imsi-" + ueId;
} else {
tmp_ueId = ueId;
}
const std::string query =
"SELECT * from SdmSubscriptions WHERE ueid='" + tmp_ueId + "'";
"SELECT * from SdmSubscriptions WHERE ueid='" + ueId + "'";
if (mysql_real_query(mysql_WitcommUDRDB, query.c_str(),
(unsigned long)query.size())) {
......
......@@ -34,15 +34,8 @@ void SMFRegistrationDocumentApiImpl::create_smf_context_non3gpp(
MYSQL_RES *res = NULL;
MYSQL_ROW row;
std::string tmp_ueId = "";
if (ueId.size() == 15) {
tmp_ueId = "imsi-" + ueId;
} else {
tmp_ueId = ueId;
}
const std::string select_SmfRegistration =
"SELECT * from SmfRegistrations WHERE ueid='" + tmp_ueId +
"SELECT * from SmfRegistrations WHERE ueid='" + ueId +
"' AND subpduSessionId=" + std::to_string(pduSessionId);
std::string query;
nlohmann::json j;
......@@ -110,11 +103,11 @@ void SMFRegistrationDocumentApiImpl::create_smf_context_non3gpp(
query += ",singleNssai='" + j.dump() + "'";
to_json(j, smfRegistration.getPlmnId());
query += ",plmnId='" + j.dump() + "'";
query += " where ueid='" + tmp_ueId +
query += " where ueid='" + ueId +
"' AND subpduSessionId=" + std::to_string(pduSessionId);
} else {
query =
"insert into SmfRegistrations set ueid='" + tmp_ueId + "'" +
"insert into SmfRegistrations set ueid='" + ueId + "'" +
",subpduSessionId=" + std::to_string(pduSessionId) +
",pduSessionId=" + std::to_string(smfRegistration.getPduSessionId()) +
",smfInstanceId='" + smfRegistration.getSmfInstanceId() + "'" +
......@@ -184,15 +177,9 @@ void SMFRegistrationDocumentApiImpl::create_smf_context_non3gpp(
void SMFRegistrationDocumentApiImpl::delete_smf_context(
const std::string &ueId, const int32_t &pduSessionId,
Pistache::Http::ResponseWriter &response) {
std::string tmp_ueId = "";
if (ueId.size() == 15) {
tmp_ueId = "imsi-" + ueId;
} else {
tmp_ueId = ueId;
}
const std::string query =
"DELETE from SmfRegistrations WHERE ueid='" + tmp_ueId +
"DELETE from SmfRegistrations WHERE ueid='" + ueId +
"' AND subpduSessionId=" + std::to_string(pduSessionId);
if (mysql_real_query(mysql_WitcommUDRDB, query.c_str(),
......@@ -214,18 +201,11 @@ void SMFRegistrationDocumentApiImpl::query_smf_registration(
MYSQL_ROW row;
MYSQL_FIELD *field = nullptr;
std::string tmp_ueId = "";
if (ueId.size() == 15) {
tmp_ueId = "imsi-" + ueId;
} else {
tmp_ueId = ueId;
}
nlohmann::json j;
SmfRegistration smfregistration;
const std::string query =
"SELECT * from SmfRegistrations WHERE ueid='" + tmp_ueId +
"SELECT * from SmfRegistrations WHERE ueid='" + ueId +
"' AND subpduSessionId=" + std::to_string(pduSessionId);
if (mysql_real_query(mysql_WitcommUDRDB, query.c_str(),
......
......@@ -35,19 +35,12 @@ void SMFRegistrationsCollectionApiImpl::query_smf_reg_list(
MYSQL_ROW row;
MYSQL_FIELD *field = nullptr;
std::string tmp_ueId = "";
if (ueId.size() == 15) {
tmp_ueId = "imsi-" + ueId;
} else {
tmp_ueId = ueId;
}
std::vector<std::string> fields;
nlohmann::json j, tmp;
const std::string query =
"SELECT * from SmfRegistrations WHERE ueid='" + tmp_ueId + "'";
"SELECT * from SmfRegistrations WHERE ueid='" + ueId + "'";
if (mysql_real_query(mysql_WitcommUDRDB, query.c_str(),
(unsigned long)query.size())) {
......
......@@ -41,16 +41,9 @@ void SMFSelectionSubscriptionDataDocumentApiImpl::query_smf_select_data(
nlohmann::json j;
std::string tmp_ueId = "";
if (ueId.size() == 15) {
tmp_ueId = "imsi-" + ueId;
} else {
tmp_ueId = ueId;
}
SmfSelectionSubscriptionData smfselectionsubscriptiondata;
const std::string query =
"select * from SmfSelectionSubscriptionData WHERE ueid='" + tmp_ueId +
"select * from SmfSelectionSubscriptionData WHERE ueid='" + ueId +
"' and servingPlmnid='" + servingPlmnId + "'";
if (mysql_real_query(mysql_WitcommUDRDB, query.c_str(),
......
......@@ -45,17 +45,10 @@ void SessionManagementSubscriptionDataApiImpl::query_sm_data(
nlohmann::json j;
std::string tmp_ueId = "";
if (ueId.size() == 15) {
tmp_ueId = "imsi-" + ueId;
} else {
tmp_ueId = ueId;
}
SessionManagementSubscriptionData sessionmanagementsubscriptiondata;
const std::string query =
"select * from SessionManagementSubscriptionData WHERE ueid='" +
tmp_ueId + "' and servingPlmnid='" + servingPlmnId + "'";
ueId + "' and servingPlmnid='" + servingPlmnId + "'";
if (mysql_real_query(mysql_WitcommUDRDB, query.c_str(),
(unsigned long)query.size())) {
......
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