Commit 65afa139 authored by yangjian's avatar yangjian

update udr-ueid

parent a8b8701c
......@@ -6,7 +6,7 @@ export OPENXGUDR_DIR=${THIS_SCRIPT_PATH%/*}
#echo "${THIS_SCRIPT_PATH%/*}"
if [ ! -d "/myfolder" ]; then
if [ ! -d "$OPENXGUDR_DIR/build" ]; then
mkdir $OPENXGUDR_DIR/build
fi
......
......@@ -40,7 +40,7 @@ void AMF3GPPAccessRegistrationDocumentApiImpl::amf_context3gpp(const std::string
void AMF3GPPAccessRegistrationDocumentApiImpl::create_amf_context3gpp(const std::string &ueId, Amf3GppAccessRegistration &amf3GppAccessRegistration, Pistache::Http::ResponseWriter &response) {
MYSQL_RES *res = NULL;
MYSQL_ROW row;
const std::string select_AMF3GPPAccessRegistration = "select * from Amf3GppAccessRegistration WHERE ueid="+ueId;
const std::string select_AMF3GPPAccessRegistration = "select * from Amf3GppAccessRegistration WHERE ueid='"+ueId+"'";
std::string query;
nlohmann::json j;
......@@ -120,11 +120,11 @@ void AMF3GPPAccessRegistrationDocumentApiImpl::create_amf_context3gpp(const std:
query += ",guami='"+j.dump()+"'";
to_json(j,amf3GppAccessRegistration.getRatType());
query += ",ratType='"+j.dump()+"'";
query += " where ueid="+ueId;
query += " where ueid='"+ueId+"'";
}
else
{
query="insert into Amf3GppAccessRegistration set ueid="+ueId+ \
query="insert into Amf3GppAccessRegistration set ueid='"+ueId+"'"+ \
",amfInstanceId='"+amf3GppAccessRegistration.getAmfInstanceId()+"'"+ \
(amf3GppAccessRegistration.supportedFeaturesIsSet()?",supportedFeatures='"+amf3GppAccessRegistration.getSupportedFeatures()+"'":"")+ \
(amf3GppAccessRegistration.purgeFlagIsSet()?(amf3GppAccessRegistration.isPurgeFlag()?",purgeFlag=1":",purgeFlag=0"):"")+ \
......@@ -208,7 +208,7 @@ void AMF3GPPAccessRegistrationDocumentApiImpl::query_amf_context3gpp(const std::
nlohmann::json j;
Amf3GppAccessRegistration amf3gppaccessregistration;
const std::string query = "select * from Amf3GppAccessRegistration WHERE ueid="+ueId;
const std::string query = "select * from Amf3GppAccessRegistration WHERE ueid='"+ueId+"'";
if (mysql_real_query(mysql_WitcommUDRDB,query.c_str(), (unsigned long)query.size()))
{
......
......@@ -33,7 +33,7 @@ void AccessAndMobilitySubscriptionDataDocumentApiImpl::query_am_data(const std::
nlohmann::json j;
AccessAndMobilitySubscriptionData accessandmobilitysubscriptiondata;
const std::string query = "select * from AccessAndMobilitySubscriptionData WHERE ueid="+ueId;
const std::string query = "select * from AccessAndMobilitySubscriptionData WHERE ueid='"+ueId+"' and servingPlmnid='"+servingPlmnId+"'";
if (mysql_real_query(mysql_WitcommUDRDB,query.c_str(), (unsigned long)query.size()))
{
......
......@@ -29,7 +29,7 @@ void AuthenticationStatusDocumentApiImpl::create_authentication_status(const std
//response.send(Pistache::Http::Code::Ok, "create_authentication_status\n");
MYSQL_RES *res = NULL;
MYSQL_ROW row;
const std::string select_AuthenticationStatus = "select * from AuthenticationStatus WHERE ueid="+ueId;
const std::string select_AuthenticationStatus = "select * from AuthenticationStatus WHERE ueid='"+ueId+"'";
std::string query;
nlohmann::json j;
......@@ -54,11 +54,11 @@ void AuthenticationStatusDocumentApiImpl::create_authentication_status(const std
(authEvent.authRemovalIndIsSet()?(authEvent.isAuthRemovalInd()?",authRemovalInd=1":",authRemovalInd=0"):"");
to_json(j,authEvent.getAuthType());
query += ",authType='"+j.dump()+"'";
query += " where ueid="+ueId;
query += " where ueid='"+ueId+"'";
}
else
{
query="insert into AuthenticationStatus set ueid="+ueId+ \
query="insert into AuthenticationStatus set ueid='"+ueId+"'"+ \
",nfInstanceId='"+authEvent.getNfInstanceId()+"'"+ \
",success="+(authEvent.isSuccess()?"1":"0")+ \
",timeStamp='"+authEvent.getTimeStamp()+"'"+ \
......@@ -82,7 +82,7 @@ void AuthenticationStatusDocumentApiImpl::create_authentication_status(const std
void AuthenticationStatusDocumentApiImpl::delete_authentication_status(const std::string &ueId, Pistache::Http::ResponseWriter &response) {
//response.send(Pistache::Http::Code::Ok, "delete_authentication_status\n");
const std::string query = "DELETE from AuthenticationStatus WHERE ueid="+ueId;
const std::string query = "DELETE from AuthenticationStatus WHERE ueid='"+ueId+"'";
if (mysql_real_query(mysql_WitcommUDRDB,query.c_str(), (unsigned long)query.size()))
{
......@@ -100,7 +100,7 @@ void AuthenticationStatusDocumentApiImpl::query_authentication_status(const std:
nlohmann::json j;
AuthEvent authenticationstatus;
const std::string query = "select * from AuthenticationStatus WHERE ueid="+ueId;
const std::string query = "select * from AuthenticationStatus WHERE ueid='"+ueId+"'";
if (mysql_real_query(mysql_WitcommUDRDB,query.c_str(), (unsigned long)query.size()))
{
......
......@@ -28,7 +28,6 @@ AuthenticationSubscriptionDocumentApiImpl::AuthenticationSubscriptionDocumentApi
: AuthenticationSubscriptionDocumentApi(rtr)
{
mysql_WitcommUDRDB = mysql;
}
void AuthenticationSubscriptionDocumentApiImpl::modify_authentication_subscription(const std::string &ueId, const std::vector<PatchItem> &patchItem, const Pistache::Optional<std::string> &supportedFeatures, Pistache::Http::ResponseWriter &response) {
......@@ -60,7 +59,8 @@ void AuthenticationSubscriptionDocumentApiImpl::read_authentication_subscription
nlohmann::json j;
AuthenticationSubscription authenticationsubscription;
const std::string query = "select * from AuthenticationSubscription WHERE ueid="+ueId;
const std::string query = "select * from AuthenticationSubscription WHERE ueid='"+ueId+"'";
if (mysql_real_query(mysql_WitcommUDRDB,query.c_str(), (unsigned long)query.size()))
{
......@@ -83,9 +83,9 @@ void AuthenticationSubscriptionDocumentApiImpl::read_authentication_subscription
{
if(!strcmp("authenticationMethod", field->name))
{
AuthMethod authenticationmethod;
nlohmann::json::parse(row[i]).get_to(authenticationmethod);
authenticationsubscription.setAuthenticationMethod(authenticationmethod);
// AuthMethod authenticationmethod;
// nlohmann::json::parse(row[i]).get_to(authenticationmethod);
authenticationsubscription.setAuthenticationMethod(row[i]);
}
else if(!strcmp("encPermanentKey", field->name) && row[i] != NULL)
{
......@@ -127,9 +127,9 @@ void AuthenticationSubscriptionDocumentApiImpl::read_authentication_subscription
}
else if(!strcmp("n5gcAuthMethod", field->name) && row[i] != NULL)
{
AuthMethod n5gcauthmethod;
nlohmann::json::parse(row[i]).get_to(n5gcauthmethod);
authenticationsubscription.setN5gcAuthMethod(n5gcauthmethod);
// AuthMethod n5gcauthmethod;
// nlohmann::json::parse(row[i]).get_to(n5gcauthmethod);
authenticationsubscription.setN5gcAuthMethod(row[i]);
}
else if(!strcmp("rgAuthenticationInd", field->name) && row[i] != NULL)
{
......
......@@ -36,7 +36,7 @@ void SDMSubscriptionDocumentApiImpl::querysdm_subscription(const std::string &ue
nlohmann::json j;
SdmSubscription SdmSubscriptions;
const std::string query = "SELECT * from SdmSubscriptions WHERE ueid="+ueId+" AND subsId="+subsId;
const std::string query = "SELECT * from SdmSubscriptions WHERE ueid='"+ueId+"' AND subsId="+subsId;
if (mysql_real_query(mysql_WitcommUDRDB,query.c_str(), (unsigned long)query.size()))
{
......@@ -146,9 +146,9 @@ void SDMSubscriptionDocumentApiImpl::removesdm_subscriptions(const std::string &
nlohmann::json j;
ProblemDetails problemdetails;
const std::string select_query = "SELECT * from SdmSubscriptions WHERE ueid="+ueId+" AND subsId="+subsId;
const std::string select_query = "SELECT * from SdmSubscriptions WHERE ueid='"+ueId+"' AND subsId="+subsId;
const std::string query = "DELETE from SdmSubscriptions WHERE ueid="+ueId+" AND subsId="+subsId;
const std::string query = "DELETE from SdmSubscriptions WHERE ueid='"+ueId+"' AND subsId="+subsId;
if (mysql_real_query(mysql_WitcommUDRDB,select_query.c_str(), (unsigned long)select_query.size()))
{
......@@ -189,7 +189,7 @@ void SDMSubscriptionDocumentApiImpl::removesdm_subscriptions(const std::string &
void SDMSubscriptionDocumentApiImpl::updatesdmsubscriptions(const std::string &ueId, const std::string &subsId, SdmSubscription &sdmSubscription, Pistache::Http::ResponseWriter &response) {
MYSQL_RES *res = NULL;
MYSQL_ROW row;
const std::string select_query = "SELECT * from SdmSubscriptions WHERE ueid="+ueId+" AND subsId="+subsId;
const std::string select_query = "SELECT * from SdmSubscriptions WHERE ueid='"+ueId+"' AND subsId="+subsId;
std::string query;
nlohmann::json j;
ProblemDetails problemdetails;
......@@ -247,7 +247,7 @@ void SDMSubscriptionDocumentApiImpl::updatesdmsubscriptions(const std::string &u
query += ",monitoredResourceUris='"+MonitoredResourceUris_json.dump()+"'";
query += " where ueid="+ueId+" AND subsId="+subsId;
query += " where ueid='"+ueId+"' AND subsId="+subsId;
}
else
{
......
......@@ -32,7 +32,7 @@ void SDMSubscriptionsCollectionApiImpl::create_sdm_subscriptions(const std::stri
int32_t subsId = 0;
int32_t count = 0;
std::string query = "SELECT subsId from SdmSubscriptions WHERE ueid="+ueId;
std::string query = "SELECT subsId from SdmSubscriptions WHERE ueid='"+ueId+"'";
if (mysql_real_query(mysql_WitcommUDRDB,query.c_str(), (unsigned long)query.size()))
{
std::cout << "mysql_real_query failure!" << std::endl;
......@@ -58,7 +58,7 @@ void SDMSubscriptionsCollectionApiImpl::create_sdm_subscriptions(const std::stri
//****** add query *******
query="insert into SdmSubscriptions set ueid="+ueId+ \
query="insert into SdmSubscriptions set ueid='"+ueId+"'"+ \
",nfInstanceId='"+sdmSubscription.getNfInstanceId()+"'"+ \
(sdmSubscription.implicitUnsubscribeIsSet()?(sdmSubscription.isImplicitUnsubscribe()?",implicitUnsubscribe=1":",implicitUnsubscribe=0"):"")+ \
(sdmSubscription.expiresIsSet()?",expires='"+sdmSubscription.getExpires()+"'":"")+ \
......@@ -123,7 +123,7 @@ void SDMSubscriptionsCollectionApiImpl::querysdmsubscriptions(const std::string
nlohmann::json j,tmp;
const std::string query = "SELECT * from SdmSubscriptions WHERE ueid="+ueId;
const std::string query = "SELECT * from SdmSubscriptions WHERE ueid='"+ueId+"'";
if (mysql_real_query(mysql_WitcommUDRDB,query.c_str(), (unsigned long)query.size()))
{
......
......@@ -28,7 +28,7 @@ SMFRegistrationDocumentApiImpl::SMFRegistrationDocumentApiImpl(std::shared_ptr<P
void SMFRegistrationDocumentApiImpl::create_smf_context_non3gpp(const std::string &ueId, const int32_t &pduSessionId, const SmfRegistration &smfRegistration, Pistache::Http::ResponseWriter &response) {
MYSQL_RES *res = NULL;
MYSQL_ROW row;
const std::string select_SmfRegistration = "SELECT * from SmfRegistrations WHERE ueid="+ueId+" AND subpduSessionId="+std::to_string(pduSessionId);
const std::string select_SmfRegistration = "SELECT * from SmfRegistrations WHERE ueid='"+ueId+"' AND subpduSessionId="+std::to_string(pduSessionId);
std::string query;
nlohmann::json j;
......@@ -73,11 +73,11 @@ void SMFRegistrationDocumentApiImpl::create_smf_context_non3gpp(const std::strin
query += ",singleNssai='"+j.dump()+"'";
to_json(j,smfRegistration.getPlmnId());
query += ",plmnId='"+j.dump()+"'";
query += " where ueid="+ueId+" AND subpduSessionId="+std::to_string(pduSessionId);
query += " where ueid='"+ueId+"' AND subpduSessionId="+std::to_string(pduSessionId);
}
else
{
query="insert into SmfRegistrations set ueid="+ueId+ \
query="insert into SmfRegistrations set ueid='"+ueId+"'"+ \
",subpduSessionId="+std::to_string(pduSessionId)+ \
",pduSessionId="+std::to_string(smfRegistration.getPduSessionId())+ \
",smfInstanceId='"+smfRegistration.getSmfInstanceId()+"'"+ \
......@@ -120,7 +120,7 @@ void SMFRegistrationDocumentApiImpl::create_smf_context_non3gpp(const std::strin
response.send(Pistache::Http::Code::Created, j.dump());
}
void SMFRegistrationDocumentApiImpl::delete_smf_context(const std::string &ueId, const int32_t &pduSessionId, Pistache::Http::ResponseWriter &response) {
const std::string query = "DELETE from SmfRegistrations WHERE ueid="+ueId+" AND subpduSessionId="+std::to_string(pduSessionId);
const std::string query = "DELETE from SmfRegistrations WHERE ueid='"+ueId+"' AND subpduSessionId="+std::to_string(pduSessionId);
if (mysql_real_query(mysql_WitcommUDRDB,query.c_str(), (unsigned long)query.size()))
{
......@@ -138,7 +138,7 @@ void SMFRegistrationDocumentApiImpl::query_smf_registration(const std::string &u
nlohmann::json j;
SmfRegistration smfregistration;
const std::string query = "SELECT * from SmfRegistrations WHERE ueid="+ueId+" AND subpduSessionId="+std::to_string(pduSessionId);
const std::string query = "SELECT * from SmfRegistrations WHERE ueid='"+ueId+"' AND subpduSessionId="+std::to_string(pduSessionId);
if (mysql_real_query(mysql_WitcommUDRDB,query.c_str(), (unsigned long)query.size()))
{
......
......@@ -34,7 +34,7 @@ void SMFRegistrationsCollectionApiImpl::query_smf_reg_list(const std::string &ue
nlohmann::json j,tmp;
const std::string query = "SELECT * from SmfRegistrations WHERE ueid="+ueId;
const std::string query = "SELECT * from SmfRegistrations WHERE ueid='"+ueId+"'";
if (mysql_real_query(mysql_WitcommUDRDB,query.c_str(), (unsigned long)query.size()))
{
......
......@@ -33,7 +33,7 @@ void SMFSelectionSubscriptionDataDocumentApiImpl::query_smf_select_data(const st
nlohmann::json j;
SmfSelectionSubscriptionData smfselectionsubscriptiondata;
const std::string query = "select * from SmfSelectionSubscriptionData WHERE ueid="+ueId+" and servingPlmnid="+servingPlmnId;
const std::string query = "select * from SmfSelectionSubscriptionData WHERE ueid='"+ueId+"' and servingPlmnid='"+servingPlmnId+"'";
if (mysql_real_query(mysql_WitcommUDRDB,query.c_str(), (unsigned long)query.size()))
{
......
......@@ -35,7 +35,7 @@ void SessionManagementSubscriptionDataApiImpl::query_sm_data(const std::string &
nlohmann::json j;
SessionManagementSubscriptionData sessionmanagementsubscriptiondata;
const std::string query = "select * from SessionManagementSubscriptionData WHERE ueid="+ueId+" and servingPlmnid="+servingPlmnId;
const std::string query = "select * from SessionManagementSubscriptionData WHERE ueid='"+ueId+"' and servingPlmnid='"+servingPlmnId+"'";
if (mysql_real_query(mysql_WitcommUDRDB,query.c_str(), (unsigned long)query.size()))
{
......
......@@ -140,11 +140,11 @@ void from_json(const nlohmann::json& j, AuthenticationSubscription& o)
}
}
AuthMethod AuthenticationSubscription::getAuthenticationMethod() const
std::string AuthenticationSubscription::getAuthenticationMethod() const
{
return m_AuthenticationMethod;
}
void AuthenticationSubscription::setAuthenticationMethod(AuthMethod const& value)
void AuthenticationSubscription::setAuthenticationMethod(std::string const& value)
{
m_AuthenticationMethod = value;
}
......@@ -284,11 +284,11 @@ void AuthenticationSubscription::unsetVectorGenerationInHss()
{
m_VectorGenerationInHssIsSet = false;
}
AuthMethod AuthenticationSubscription::getN5gcAuthMethod() const
std::string AuthenticationSubscription::getN5gcAuthMethod() const
{
return m_N5gcAuthMethod;
}
void AuthenticationSubscription::setN5gcAuthMethod(AuthMethod const& value)
void AuthenticationSubscription::setN5gcAuthMethod(std::string const& value)
{
m_N5gcAuthMethod = value;
m_N5gcAuthMethodIsSet = true;
......
......@@ -46,8 +46,8 @@ public:
/// <summary>
///
/// </summary>
AuthMethod getAuthenticationMethod() const;
void setAuthenticationMethod(AuthMethod const& value);
std::string getAuthenticationMethod() const;
void setAuthenticationMethod(std::string const& value);
/// <summary>
///
/// </summary>
......@@ -107,8 +107,8 @@ public:
/// <summary>
///
/// </summary>
AuthMethod getN5gcAuthMethod() const;
void setN5gcAuthMethod(AuthMethod const& value);
std::string getN5gcAuthMethod() const;
void setN5gcAuthMethod(std::string const& value);
bool n5gcAuthMethodIsSet() const;
void unsetN5gcAuthMethod();
/// <summary>
......@@ -129,7 +129,7 @@ public:
friend void to_json(nlohmann::json& j, const AuthenticationSubscription& o);
friend void from_json(const nlohmann::json& j, AuthenticationSubscription& o);
protected:
AuthMethod m_AuthenticationMethod;
std::string m_AuthenticationMethod;
std::string m_EncPermanentKey;
bool m_EncPermanentKeyIsSet;
......@@ -147,7 +147,7 @@ protected:
bool m_EncTopcKeyIsSet;
bool m_VectorGenerationInHss;
bool m_VectorGenerationInHssIsSet;
AuthMethod m_N5gcAuthMethod;
std::string m_N5gcAuthMethod;
bool m_N5gcAuthMethodIsSet;
bool m_RgAuthenticationInd;
bool m_RgAuthenticationIndIsSet;
......
......@@ -24,6 +24,7 @@ PatchItem::PatchItem()
{
m_Path = "";
m_From = "";
m_Value = "";
m_FromIsSet = false;
m_ValueIsSet = false;
......@@ -45,13 +46,12 @@ void to_json(nlohmann::json& j, const PatchItem& o)
j["path"] = o.m_Path;
if(o.fromIsSet())
j["from"] = o.m_From;
// if(o.valueIsSet())
// j["value"] = o.m_Value;
if(o.valueIsSet())
j["value"] = o.m_Value;
}
void from_json(const nlohmann::json& j, PatchItem& o)
{
// cout<<"patchitem from_json "<<endl;
j.at("op").get_to(o.m_Op);
j.at("path").get_to(o.m_Path);
if(j.find("from") != j.end())
......@@ -61,8 +61,8 @@ void from_json(const nlohmann::json& j, PatchItem& o)
}
if(j.find("value") != j.end())
{
// j.at("value").get_to(o.m_Value);
// o.m_ValueIsSet = true;
j.at("value").get_to(o.m_Value);
o.m_ValueIsSet = true;
}
}
......@@ -99,15 +99,15 @@ void PatchItem::unsetFrom()
{
m_FromIsSet = false;
}
//AnyType PatchItem::getValue() const
//{
// return m_Value;
//}
//void PatchItem::setValue(AnyType const& value)
//{
// m_Value = value;
// m_ValueIsSet = true;
//}
std::string PatchItem::getValue() const
{
return m_Value;
}
void PatchItem::setValue(std::string const& value)
{
m_Value = value;
m_ValueIsSet = true;
}
bool PatchItem::valueIsSet() const
{
return m_ValueIsSet;
......
......@@ -63,8 +63,8 @@ public:
/// <summary>
///
/// </summary>
// AnyType getValue() const;
// void setValue(AnyType const& value);
std::string getValue() const;
void setValue(std::string const& value);
bool valueIsSet() const;
void unsetValue();
......@@ -77,7 +77,7 @@ protected:
std::string m_From;
bool m_FromIsSet;
// AnyType m_Value;
std::string m_Value;
bool m_ValueIsSet;
};
......
......@@ -20,7 +20,6 @@ namespace model {
PatchOperation::PatchOperation()
{
}
PatchOperation::~PatchOperation()
......
......@@ -40,7 +40,6 @@ public:
/////////////////////////////////////////////
/// PatchOperation members
friend void to_json(nlohmann::json& j, const PatchOperation& o);
friend void from_json(const nlohmann::json& j, PatchOperation& o);
protected:
......
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