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
ff113be0
Commit
ff113be0
authored
Jan 19, 2021
by
yangjian
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Update SDMSubscription and SMFRegistration: add fields
parent
2506ceab
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
89 additions
and
36 deletions
+89
-36
impl/SDMSubscriptionDocumentApiImpl.cpp
impl/SDMSubscriptionDocumentApiImpl.cpp
+45
-23
impl/SMFRegistrationDocumentApiImpl.cpp
impl/SMFRegistrationDocumentApiImpl.cpp
+44
-13
No files found.
impl/SDMSubscriptionDocumentApiImpl.cpp
View file @
ff113be0
...
...
@@ -77,15 +77,21 @@ void SDMSubscriptionDocumentApiImpl::querysdm_subscription(const std::string &ue
}
else
if
(
!
strcmp
(
"amfServiceName"
,
field
->
name
)
&&
row
[
i
]
!=
NULL
)
{
// SdmSubscriptions.setAmfServiceName(row[i]);
ServiceName
amfservicename
;
nlohmann
::
json
::
parse
(
row
[
i
]).
get_to
(
amfservicename
);
SdmSubscriptions
.
setAmfServiceName
(
amfservicename
);
}
else
if
(
!
strcmp
(
"monitoredResourceUris"
,
field
->
name
))
{
// SdmSubscriptions.setMonitoredResourceUris(row[i]);
std
::
vector
<
std
::
string
>
monitoredresourceuris
;
nlohmann
::
json
::
parse
(
row
[
i
]).
get_to
(
monitoredresourceuris
);
SdmSubscriptions
.
setMonitoredResourceUris
(
monitoredresourceuris
);
}
else
if
(
!
strcmp
(
"singleNssai"
,
field
->
name
)
&&
row
[
i
]
!=
NULL
)
{
// SdmSubscriptions.setSingleNssai(row[i]);
Snssai
singlenssai
;
nlohmann
::
json
::
parse
(
row
[
i
]).
get_to
(
singlenssai
);
SdmSubscriptions
.
setSingleNssai
(
singlenssai
);
}
else
if
(
!
strcmp
(
"dnn"
,
field
->
name
)
&&
row
[
i
]
!=
NULL
)
{
...
...
@@ -97,7 +103,9 @@ void SDMSubscriptionDocumentApiImpl::querysdm_subscription(const std::string &ue
}
else
if
(
!
strcmp
(
"plmnId"
,
field
->
name
)
&&
row
[
i
]
!=
NULL
)
{
// SdmSubscriptions.setPlmnId(row[i]);
PlmnId
plmnid
;
nlohmann
::
json
::
parse
(
row
[
i
]).
get_to
(
plmnid
);
SdmSubscriptions
.
setPlmnId
(
plmnid
);
}
else
if
(
!
strcmp
(
"immediateReport"
,
field
->
name
)
&&
row
[
i
]
!=
NULL
)
{
...
...
@@ -108,7 +116,9 @@ void SDMSubscriptionDocumentApiImpl::querysdm_subscription(const std::string &ue
}
else
if
(
!
strcmp
(
"report"
,
field
->
name
)
&&
row
[
i
]
!=
NULL
)
{
// SdmSubscriptions.setReport(row[i]);
SubscriptionDataSets
report
;
nlohmann
::
json
::
parse
(
row
[
i
]).
get_to
(
report
);
SdmSubscriptions
.
setReport
(
report
);
}
else
if
(
!
strcmp
(
"supportedFeatures"
,
field
->
name
)
&&
row
[
i
]
!=
NULL
)
{
...
...
@@ -116,7 +126,9 @@ void SDMSubscriptionDocumentApiImpl::querysdm_subscription(const std::string &ue
}
else
if
(
!
strcmp
(
"contextInfo"
,
field
->
name
)
&&
row
[
i
]
!=
NULL
)
{
// SdmSubscriptions.setContextInfo(a);
ContextInfo
contextinfo
;
nlohmann
::
json
::
parse
(
row
[
i
]).
get_to
(
contextinfo
);
SdmSubscriptions
.
setContextInfo
(
contextinfo
);
}
}
to_json
(
j
,
SdmSubscriptions
);
...
...
@@ -202,26 +214,36 @@ void SDMSubscriptionDocumentApiImpl::updatesdmsubscriptions(const std::string &u
(
sdmSubscription
.
implicitUnsubscribeIsSet
()
?
(
sdmSubscription
.
isImplicitUnsubscribe
()
?
"implicitUnsubscribe=1,"
:
"implicitUnsubscribe=0,"
)
:
""
)
+
\
(
sdmSubscription
.
expiresIsSet
()
?
"expires='"
+
sdmSubscription
.
getExpires
()
+
"',"
:
""
)
+
\
"callbackReference='"
+
sdmSubscription
.
getCallbackReference
()
+
"',"
+
\
// amfServiceName
// singleNssai
(
sdmSubscription
.
dnnIsSet
()
?
"dnn='"
+
sdmSubscription
.
getDnn
()
+
"',"
:
""
)
+
\
(
sdmSubscription
.
subscriptionIdIsSet
()
?
"subscriptionId='"
+
sdmSubscription
.
getSubscriptionId
()
+
"',"
:
""
)
+
\
// plmnId
(
sdmSubscription
.
immediateReportIsSet
()
?
(
sdmSubscription
.
isImmediateReport
()
?
"immediateReport=1,"
:
"immediateReport=0,"
)
:
""
)
+
\
// report
(
sdmSubscription
.
supportedFeaturesIsSet
()
?
"supportedFeatures='"
+
sdmSubscription
.
getSupportedFeatures
()
+
"',"
:
""
)
+
\
//contextInfo
//query += "monitoredResourceUris='[";
// std::vector<std::string> monitoredresourceuris_list = sdmSubscription.getMonitoredResourceUris();
// for(int i=0;i<monitoredresourceuris_list.size();i++)
// {
// if(i==monitoredresourceuris_list.size()-1)
// query += "\"" +monitoredresourceuris_list[i]+"\"";
// else
// query += "\"" +monitoredresourceuris_list[i]+"\",";
// }
//query += "]',";
//j[0]=sdmSubscription.getMonitoredResourceUris();
(
sdmSubscription
.
supportedFeaturesIsSet
()
?
"supportedFeatures='"
+
sdmSubscription
.
getSupportedFeatures
()
+
"',"
:
""
);
if
(
sdmSubscription
.
amfServiceNameIsSet
())
{
to_json
(
j
,
sdmSubscription
.
getAmfServiceName
());
query
+=
"amfServiceName='"
+
j
.
dump
()
+
"',"
;
}
if
(
sdmSubscription
.
singleNssaiIsSet
())
{
to_json
(
j
,
sdmSubscription
.
getSingleNssai
());
query
+=
"singleNssai='"
+
j
.
dump
()
+
"',"
;
}
if
(
sdmSubscription
.
plmnIdIsSet
())
{
to_json
(
j
,
sdmSubscription
.
getPlmnId
());
query
+=
"plmnId='"
+
j
.
dump
()
+
"',"
;
}
if
(
sdmSubscription
.
reportIsSet
())
{
to_json
(
j
,
sdmSubscription
.
getReport
());
query
+=
"report='"
+
j
.
dump
()
+
"',"
;
}
if
(
sdmSubscription
.
contextInfoIsSet
())
{
to_json
(
j
,
sdmSubscription
.
getContextInfo
());
query
+=
"contextInfo='"
+
j
.
dump
()
+
"',"
;
}
query
+=
"monitoredResourceUris='"
+
MonitoredResourceUris_json
.
dump
()
+
"'"
;
...
...
impl/SMFRegistrationDocumentApiImpl.cpp
View file @
ff113be0
...
...
@@ -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 pduSessionId="
+
std
::
to_string
(
pduSessionId
);
const
std
::
string
select_SmfRegistration
=
"SELECT * from SmfRegistrations WHERE ueid="
+
ueId
+
" AND
sub
pduSessionId="
+
std
::
to_string
(
pduSessionId
);
std
::
string
query
;
nlohmann
::
json
j
;
...
...
@@ -47,6 +47,7 @@ void SMFRegistrationDocumentApiImpl::create_smf_context_non3gpp(const std::strin
if
(
mysql_num_rows
(
res
))
{
query
=
"update SmfRegistrations set smfInstanceId='"
+
smfRegistration
.
getSmfInstanceId
()
+
"',"
+
\
"pduSessionId="
+
std
::
to_string
(
smfRegistration
.
getPduSessionId
())
+
"',"
+
\
(
smfRegistration
.
smfSetIdIsSet
()
?
"smfSetId='"
+
smfRegistration
.
getSmfSetId
()
+
"',"
:
""
)
+
\
(
smfRegistration
.
supportedFeaturesIsSet
()
?
"supportedFeatures='"
+
smfRegistration
.
getSupportedFeatures
()
+
"',"
:
""
)
+
\
(
smfRegistration
.
dnnIsSet
()
?
"dnn='"
+
smfRegistration
.
getDnn
()
+
"',"
:
""
)
+
\
...
...
@@ -55,19 +56,30 @@ void SMFRegistrationDocumentApiImpl::create_smf_context_non3gpp(const std::strin
(
smfRegistration
.
pgwFqdnIsSet
()
?
"pgwFqdn='"
+
smfRegistration
.
getPgwFqdn
()
+
"',"
:
""
)
+
\
(
smfRegistration
.
epdgIndIsSet
()
?
(
smfRegistration
.
isEpdgInd
()
?
"epdgInd=1,"
:
"epdgInd=0,"
)
:
""
)
+
\
(
smfRegistration
.
deregCallbackUriIsSet
()
?
"deregCallbackUri='"
+
smfRegistration
.
getDeregCallbackUri
()
+
"',"
:
""
)
+
\
//registrationReason
(
smfRegistration
.
registrationTimeIsSet
()
?
"registrationTime='"
+
smfRegistration
.
getRegistrationTime
()
+
"',"
:
""
);
//contextInfo
if
(
smfRegistration
.
registrationReasonIsSet
())
{
to_json
(
j
,
smfRegistration
.
getRegistrationReason
());
query
+=
"registrationReason='"
+
j
.
dump
()
+
"',"
;
}
if
(
smfRegistration
.
contextInfoIsSet
())
{
to_json
(
j
,
smfRegistration
.
getContextInfo
());
query
+=
"contextInfo='"
+
j
.
dump
()
+
"',"
;
}
to_json
(
j
,
smfRegistration
.
getSingleNssai
());
query
+=
"singleNssai='"
+
j
.
dump
()
+
"',"
;
to_json
(
j
,
smfRegistration
.
getPlmnId
());
query
+=
"plmnId='"
+
j
.
dump
()
+
"'"
;
query
+=
" where ueid="
+
ueId
+
" AND pduSessionId="
+
std
::
to_string
(
pduSessionId
);
query
+=
" where ueid="
+
ueId
+
" AND
sub
pduSessionId="
+
std
::
to_string
(
pduSessionId
);
}
else
{
query
=
"insert into SmfRegistrations set ueid="
+
ueId
+
","
+
\
"pduSessionId="
+
std
::
to_string
(
pduSessionId
)
+
","
+
\
"subpduSessionId="
+
std
::
to_string
(
pduSessionId
)
+
","
+
\
"pduSessionId="
+
std
::
to_string
(
smfRegistration
.
getPduSessionId
())
+
"',"
+
\
"smfInstanceId='"
+
smfRegistration
.
getSmfInstanceId
()
+
"',"
+
\
(
smfRegistration
.
smfSetIdIsSet
()
?
"smfSetId='"
+
smfRegistration
.
getSmfSetId
()
+
"',"
:
""
)
+
\
(
smfRegistration
.
supportedFeaturesIsSet
()
?
"supportedFeatures='"
+
smfRegistration
.
getSupportedFeatures
()
+
"',"
:
""
)
+
\
...
...
@@ -77,9 +89,20 @@ void SMFRegistrationDocumentApiImpl::create_smf_context_non3gpp(const std::strin
(
smfRegistration
.
pgwFqdnIsSet
()
?
"pgwFqdn='"
+
smfRegistration
.
getPgwFqdn
()
+
"',"
:
""
)
+
\
(
smfRegistration
.
epdgIndIsSet
()
?
(
smfRegistration
.
isEpdgInd
()
?
"epdgInd=1,"
:
"epdgInd=0,"
)
:
""
)
+
\
(
smfRegistration
.
deregCallbackUriIsSet
()
?
"deregCallbackUri='"
+
smfRegistration
.
getDeregCallbackUri
()
+
"',"
:
""
)
+
\
//registrationReason
(
smfRegistration
.
deregCallbackUriIsSet
()
?
"deregCallbackUri='"
+
smfRegistration
.
getDeregCallbackUri
()
+
"',"
:
""
)
+
\
(
smfRegistration
.
registrationTimeIsSet
()
?
"registrationTime='"
+
smfRegistration
.
getRegistrationTime
()
+
"',"
:
""
);
//contextInfo
if
(
smfRegistration
.
registrationReasonIsSet
())
{
to_json
(
j
,
smfRegistration
.
getRegistrationReason
());
query
+=
"registrationReason='"
+
j
.
dump
()
+
"',"
;
}
if
(
smfRegistration
.
contextInfoIsSet
())
{
to_json
(
j
,
smfRegistration
.
getContextInfo
());
query
+=
"contextInfo='"
+
j
.
dump
()
+
"',"
;
}
to_json
(
j
,
smfRegistration
.
getSingleNssai
());
query
+=
"singleNssai='"
+
j
.
dump
()
+
"',"
;
to_json
(
j
,
smfRegistration
.
getPlmnId
());
...
...
@@ -98,7 +121,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 pduSessionId="
+
std
::
to_string
(
pduSessionId
);
const
std
::
string
query
=
"DELETE from SmfRegistrations WHERE ueid="
+
ueId
+
" AND
sub
pduSessionId="
+
std
::
to_string
(
pduSessionId
);
if
(
mysql_real_query
(
mysql_WitcommUDRDB
,
query
.
c_str
(),
(
unsigned
long
)
query
.
size
()))
{
...
...
@@ -116,7 +139,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 pduSessionId="
+
std
::
to_string
(
pduSessionId
);
const
std
::
string
query
=
"SELECT * from SmfRegistrations WHERE ueid="
+
ueId
+
" AND
sub
pduSessionId="
+
std
::
to_string
(
pduSessionId
);
if
(
mysql_real_query
(
mysql_WitcommUDRDB
,
query
.
c_str
(),
(
unsigned
long
)
query
.
size
()))
{
...
...
@@ -159,7 +182,9 @@ void SMFRegistrationDocumentApiImpl::query_smf_registration(const std::string &u
}
else
if
(
!
strcmp
(
"singleNssai"
,
field
->
name
))
{
// smfregistration.set(row[i]);
Snssai
singlenssai
;
nlohmann
::
json
::
parse
(
row
[
i
]).
get_to
(
singlenssai
);
smfregistration
.
setSingleNssai
(
singlenssai
);
}
else
if
(
!
strcmp
(
"dnn"
,
field
->
name
)
&&
row
[
i
]
!=
NULL
)
{
...
...
@@ -178,7 +203,9 @@ void SMFRegistrationDocumentApiImpl::query_smf_registration(const std::string &u
}
else
if
(
!
strcmp
(
"plmnId"
,
field
->
name
))
{
// smfregistration.set(row[i]);
PlmnId
plmnid
;
nlohmann
::
json
::
parse
(
row
[
i
]).
get_to
(
plmnid
);
smfregistration
.
setPlmnId
(
plmnid
);
}
else
if
(
!
strcmp
(
"pgwFqdn"
,
field
->
name
)
&&
row
[
i
]
!=
NULL
)
{
...
...
@@ -197,7 +224,9 @@ void SMFRegistrationDocumentApiImpl::query_smf_registration(const std::string &u
}
else
if
(
!
strcmp
(
"registrationReason"
,
field
->
name
)
&&
row
[
i
]
!=
NULL
)
{
// smfregistration.setRegistrationReason(row[i]);
RegistrationReason
registrationreason
;
nlohmann
::
json
::
parse
(
row
[
i
]).
get_to
(
registrationreason
);
smfregistration
.
setRegistrationReason
(
registrationreason
);
}
else
if
(
!
strcmp
(
"registrationTime"
,
field
->
name
)
&&
row
[
i
]
!=
NULL
)
{
...
...
@@ -205,7 +234,9 @@ void SMFRegistrationDocumentApiImpl::query_smf_registration(const std::string &u
}
else
if
(
!
strcmp
(
"contextInfo"
,
field
->
name
)
&&
row
[
i
]
!=
NULL
)
{
// smfregistration.setContextInfo(row[i]);
ContextInfo
contextinfo
;
nlohmann
::
json
::
parse
(
row
[
i
]).
get_to
(
contextinfo
);
smfregistration
.
setContextInfo
(
contextinfo
);
}
}
...
...
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