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
a58a543b
Commit
a58a543b
authored
May 31, 2022
by
Tien-Thinh Nguyen
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add API for delete AuthenticationSubscription data
parent
4ad715ee
Changes
12
Hide whitespace changes
Inline
Side-by-side
Showing
12 changed files
with
124 additions
and
28 deletions
+124
-28
src/api_server/api/AuthenticationDataDocumentApi.cpp
src/api_server/api/AuthenticationDataDocumentApi.cpp
+29
-0
src/api_server/api/AuthenticationDataDocumentApi.h
src/api_server/api/AuthenticationDataDocumentApi.h
+13
-0
src/api_server/impl/AuthenticationDataDocumentApiImpl.cpp
src/api_server/impl/AuthenticationDataDocumentApiImpl.cpp
+12
-1
src/api_server/impl/AuthenticationDataDocumentApiImpl.h
src/api_server/impl/AuthenticationDataDocumentApiImpl.h
+2
-0
src/udr_app/cassandra_db.cpp
src/udr_app/cassandra_db.cpp
+5
-5
src/udr_app/cassandra_db.hpp
src/udr_app/cassandra_db.hpp
+2
-2
src/udr_app/database_wrapper.hpp
src/udr_app/database_wrapper.hpp
+4
-4
src/udr_app/database_wrapper_abstraction.hpp
src/udr_app/database_wrapper_abstraction.hpp
+8
-7
src/udr_app/mysql_db.cpp
src/udr_app/mysql_db.cpp
+20
-5
src/udr_app/mysql_db.hpp
src/udr_app/mysql_db.hpp
+2
-2
src/udr_app/udr_app.cpp
src/udr_app/udr_app.cpp
+16
-1
src/udr_app/udr_app.hpp
src/udr_app/udr_app.hpp
+11
-1
No files found.
src/api_server/api/AuthenticationDataDocumentApi.cpp
View file @
a58a543b
...
...
@@ -64,6 +64,14 @@ void AuthenticationDataDocumentApi::setupRoutes() {
Routes
::
bind
(
&
AuthenticationDataDocumentApi
::
create_auth_subs_data_handler
,
this
));
Routes
::
Delete
(
*
router
,
base
+
udr_cfg
.
nudr
.
api_version
+
"/subscription-data/:ueId/authentication-data/"
"authentication-subscription"
,
Routes
::
bind
(
&
AuthenticationDataDocumentApi
::
delete_auth_subs_data_handler
,
this
));
// Default handler, called when a route is not found
router
->
addCustomHandler
(
Routes
::
bind
(
&
AuthenticationDataDocumentApi
::
...
...
@@ -128,6 +136,27 @@ void AuthenticationDataDocumentApi::create_auth_subs_data_handler(
}
}
void
AuthenticationDataDocumentApi
::
delete_auth_subs_data_handler
(
const
Pistache
::
Rest
::
Request
&
request
,
Pistache
::
Http
::
ResponseWriter
response
)
{
try
{
// Getting the path params
auto
ueId
=
request
.
param
(
":ueId"
).
as
<
std
::
string
>
();
try
{
this
->
delete_auth_subs_data
(
ueId
,
response
);
}
catch
(
std
::
exception
&
e
)
{
const
std
::
pair
<
Pistache
::
Http
::
Code
,
std
::
string
>
errorInfo
=
this
->
handleOperationException
(
e
);
response
.
send
(
errorInfo
.
first
,
errorInfo
.
second
);
return
;
}
}
catch
(
std
::
exception
&
e
)
{
response
.
send
(
Pistache
::
Http
::
Code
::
Internal_Server_Error
,
e
.
what
());
}
}
void
AuthenticationDataDocumentApi
::
authentication_data_document_api_default_handler
(
const
Pistache
::
Rest
::
Request
&
,
...
...
src/api_server/api/AuthenticationDataDocumentApi.h
View file @
a58a543b
...
...
@@ -68,6 +68,9 @@ class AuthenticationDataDocumentApi {
void
create_auth_subs_data_handler
(
const
Pistache
::
Rest
::
Request
&
request
,
Pistache
::
Http
::
ResponseWriter
response
);
void
delete_auth_subs_data_handler
(
const
Pistache
::
Rest
::
Request
&
request
,
Pistache
::
Http
::
ResponseWriter
response
);
void
authentication_data_document_api_default_handler
(
const
Pistache
::
Rest
::
Request
&
request
,
Pistache
::
Http
::
ResponseWriter
response
);
...
...
@@ -105,6 +108,16 @@ class AuthenticationDataDocumentApi {
const
oai
::
udr
::
model
::
AuthenticationSubscription
&
authenticationSubscription
,
Pistache
::
Http
::
ResponseWriter
&
response
)
=
0
;
/// <summary>
/// To remove the Authentication subscription data of a UE
/// </summary>
/// <remarks>
///
/// </remarks>
/// <param name="ueId">UE id</param>
virtual
void
delete_auth_subs_data
(
const
std
::
string
&
ueId
,
Pistache
::
Http
::
ResponseWriter
&
response
)
=
0
;
};
}
// namespace oai::udr::api
...
...
src/api_server/impl/AuthenticationDataDocumentApiImpl.cpp
View file @
a58a543b
...
...
@@ -63,8 +63,19 @@ void AuthenticationDataDocumentApiImpl::create_auth_subs_data(
code
=
static_cast
<
Pistache
::
Http
::
Code
>
(
httpCode
);
Logger
::
udr_server
().
debug
(
"HTTP Response code %d.
\n
"
,
code
);
response
.
send
(
code
,
responseData
.
dump
().
c_str
());
}
void
AuthenticationDataDocumentApiImpl
::
delete_auth_subs_data
(
const
std
::
string
&
ueId
,
Pistache
::
Http
::
ResponseWriter
&
response
)
{
nlohmann
::
json
responseData
=
{};
Pistache
::
Http
::
Code
code
=
{};
long
httpCode
=
0
;
response
.
send
(
Pistache
::
Http
::
Code
::
Ok
,
"Do some magic
\n
"
);
m_udr_app
->
handle_delete_authentication_data
(
ueId
,
responseData
,
httpCode
);
code
=
static_cast
<
Pistache
::
Http
::
Code
>
(
httpCode
);
Logger
::
udr_server
().
debug
(
"HTTP Response code %d.
\n
"
,
code
);
response
.
send
(
code
,
responseData
.
dump
().
c_str
());
}
}
// namespace api
...
...
src/api_server/impl/AuthenticationDataDocumentApiImpl.h
View file @
a58a543b
...
...
@@ -75,6 +75,8 @@ class AuthenticationDataDocumentApiImpl
const
std
::
string
&
ueId
,
const
AuthenticationSubscription
&
authenticationSubscription
,
Pistache
::
Http
::
ResponseWriter
&
response
);
void
delete_auth_subs_data
(
const
std
::
string
&
ueId
,
Pistache
::
Http
::
ResponseWriter
&
response
);
};
}
// namespace oai::udr::api
...
...
src/udr_app/cassandra_db.cpp
View file @
a58a543b
...
...
@@ -57,6 +57,11 @@ bool cassandra_db::insert_authentication_subscription(
return
true
;
}
//------------------------------------------------------------------------------
bool
cassandra_db
::
delete_authentication_subscription
(
const
std
::
string
&
id
)
{
return
true
;
}
//------------------------------------------------------------------------------
bool
cassandra_db
::
query_authentication_subscription
(
const
std
::
string
&
id
,
nlohmann
::
json
&
json_data
)
{
...
...
@@ -70,11 +75,6 @@ bool cassandra_db::update_authentication_subscription(
return
true
;
}
//------------------------------------------------------------------------------
bool
cassandra_db
::
delete_authentication_subscription
(
const
std
::
string
&
id
)
{
return
true
;
}
//------------------------------------------------------------------------------
bool
cassandra_db
::
query_am_data
(
const
std
::
string
&
ue_id
,
const
std
::
string
&
serving_plmn_id
,
...
...
src/udr_app/cassandra_db.hpp
View file @
a58a543b
...
...
@@ -41,14 +41,14 @@ class cassandra_db : public database_wrapper<cassandra_db> {
authentication_subscription
,
nlohmann
::
json
&
json_data
);
bool
delete_authentication_subscription
(
const
std
::
string
&
id
);
bool
query_authentication_subscription
(
const
std
::
string
&
id
,
nlohmann
::
json
&
json_data
);
bool
update_authentication_subscription
(
const
std
::
string
&
id
,
const
nlohmann
::
json
&
json_data
);
bool
delete_authentication_subscription
(
const
std
::
string
&
id
);
bool
query_am_data
(
const
std
::
string
&
ue_id
,
const
std
::
string
&
serving_plmn_id
,
nlohmann
::
json
&
json_data
);
...
...
src/udr_app/database_wrapper.hpp
View file @
a58a543b
...
...
@@ -64,6 +64,10 @@ class database_wrapper : public database_wrapper_abstraction {
return
true
;
}
bool
delete_authentication_subscription
(
const
std
::
string
&
id
)
override
{
return
true
;
}
bool
query_authentication_subscription
(
const
std
::
string
&
id
,
nlohmann
::
json
&
json_data
)
override
{
return
true
;
...
...
@@ -76,10 +80,6 @@ class database_wrapper : public database_wrapper_abstraction {
return
true
;
}
bool
delete_authentication_subscription
(
const
std
::
string
&
id
)
override
{
return
true
;
}
bool
query_am_data
(
const
std
::
string
&
ue_id
,
const
std
::
string
&
serving_plmn_id
,
nlohmann
::
json
&
json_data
)
override
{
...
...
src/udr_app/database_wrapper_abstraction.hpp
View file @
a58a543b
...
...
@@ -69,6 +69,14 @@ class database_wrapper_abstraction {
const
oai
::
udr
::
model
::
AuthenticationSubscription
&
authentication_subscription
,
nlohmann
::
json
&
json_data
)
=
0
;
/*
* Delete an item from the DB for the Authentication Subscription
* @param [const std::string&] id: UE Identity
* @return true if successful, otherwise return false
*/
virtual
bool
delete_authentication_subscription
(
const
std
::
string
&
id
)
=
0
;
/*
* Query an item from the DB for the Authentication Subscription
* @param [const std::string&] id: UE Identity
...
...
@@ -91,13 +99,6 @@ class database_wrapper_abstraction {
const
std
::
vector
<
oai
::
udr
::
model
::
PatchItem
>&
patchItem
,
nlohmann
::
json
&
json_data
)
=
0
;
/*
* Delete an item from the DB for the Authentication Subscription
* @param [const std::string&] id: UE Identity
* @return true if successful, otherwise return false
*/
virtual
bool
delete_authentication_subscription
(
const
std
::
string
&
id
)
=
0
;
/*
* Query an item from the DB for AccessandMobilitySubscriptionData
* @param [const std::string&] ue_id: UE Identity
...
...
src/udr_app/mysql_db.cpp
View file @
a58a543b
...
...
@@ -159,6 +159,26 @@ bool mysql_db::insert_authentication_subscription(
return
true
;
}
//------------------------------------------------------------------------------
bool
mysql_db
::
delete_authentication_subscription
(
const
std
::
string
&
id
)
{
const
std
::
string
query
=
"DELETE FROM AuthenticationSubscription WHERE ueid='"
+
id
+
"'"
;
Logger
::
udr_mysql
().
debug
(
"MySQL Query %s: "
,
query
.
c_str
());
if
(
mysql_real_query
(
&
mysql_connector
,
query
.
c_str
(),
(
unsigned
long
)
query
.
size
()))
{
Logger
::
udr_mysql
().
error
(
"mysql_real_query failure! SQL Query %s"
,
query
.
c_str
());
return
false
;
}
Logger
::
udr_mysql
().
debug
(
"Deleted AuthenticationSubscription (with UE ID %s) successfully"
,
id
.
c_str
());
return
true
;
}
//------------------------------------------------------------------------------
bool
mysql_db
::
query_authentication_subscription
(
const
std
::
string
&
id
,
nlohmann
::
json
&
json_data
)
{
...
...
@@ -321,11 +341,6 @@ bool mysql_db::update_authentication_subscription(
return
true
;
}
//------------------------------------------------------------------------------
bool
mysql_db
::
delete_authentication_subscription
(
const
std
::
string
&
id
)
{
return
true
;
}
//------------------------------------------------------------------------------
bool
mysql_db
::
query_am_data
(
const
std
::
string
&
ue_id
,
const
std
::
string
&
serving_plmn_id
,
...
...
src/udr_app/mysql_db.hpp
View file @
a58a543b
...
...
@@ -43,6 +43,8 @@ class mysql_db : public database_wrapper<mysql_db> {
authentication_subscription
,
nlohmann
::
json
&
json_data
);
bool
delete_authentication_subscription
(
const
std
::
string
&
id
);
bool
query_authentication_subscription
(
const
std
::
string
&
id
,
nlohmann
::
json
&
json_data
);
...
...
@@ -51,8 +53,6 @@ class mysql_db : public database_wrapper<mysql_db> {
const
std
::
vector
<
oai
::
udr
::
model
::
PatchItem
>&
patchItem
,
nlohmann
::
json
&
json_data
);
bool
delete_authentication_subscription
(
const
std
::
string
&
id
);
bool
query_am_data
(
const
std
::
string
&
ue_id
,
const
std
::
string
&
serving_plmn_id
,
nlohmann
::
json
&
json_data
);
...
...
src/udr_app/udr_app.cpp
View file @
a58a543b
...
...
@@ -187,7 +187,7 @@ void udr_app::handle_create_authentication_data(
const
std
::
string
&
ue_id
,
const
AuthenticationSubscription
&
authentication_subscription
,
nlohmann
::
json
&
response_data
,
long
&
code
)
{
Logger
::
udr_app
().
info
(
"Crate an authentication subscription data of a UE"
);
Logger
::
udr_app
().
info
(
"Cr
e
ate an authentication subscription data of a UE"
);
if
(
db_connector
->
insert_authentication_subscription
(
ue_id
,
authentication_subscription
,
response_data
))
{
...
...
@@ -200,6 +200,21 @@ void udr_app::handle_create_authentication_data(
return
;
}
//------------------------------------------------------------------------------
void
udr_app
::
handle_delete_authentication_data
(
const
std
::
string
&
ue_id
,
nlohmann
::
json
&
response_data
,
long
&
code
)
{
Logger
::
udr_app
().
info
(
"Delete an authentication subscription data of a UE"
);
if
(
db_connector
->
delete_authentication_subscription
(
ue_id
))
{
code
=
HTTP_STATUS_CODE_204_NO_CONTENT
;
Logger
::
udr_app
().
info
(
"Successful removed the authentication subscription data of a UE"
);
}
else
{
code
=
HTTP_STATUS_CODE_500_INTERNAL_SERVER_ERROR
;
// TODO
}
return
;
}
//------------------------------------------------------------------------------
void
udr_app
::
handle_modify_authentication_subscription
(
const
std
::
string
&
ue_id
,
const
std
::
vector
<
PatchItem
>&
patchItem
,
...
...
src/udr_app/udr_app.hpp
View file @
a58a543b
...
...
@@ -144,12 +144,22 @@ class udr_app {
* @param [long code] http_code: HTTP response code
* @return void
*/
void
handle_create_authentication_data
(
const
std
::
string
&
ue_id
,
const
AuthenticationSubscription
&
authentication_subscription
,
nlohmann
::
json
&
response_data
,
long
&
code
);
/*
* Handle a request to remove the AuthenticationSubscription
* (AuthenticationDataDocumentApiImpl)
* @param [const std::string&] ue_id: UE Identity
* @param [nlohmann::json&] response_data: Response in Json format
* @param [long code] code: HTTP response code
* @return void
*/
void
handle_delete_authentication_data
(
const
std
::
string
&
ue_id
,
nlohmann
::
json
&
response_data
,
long
&
code
);
/*
* Handle a request to modify AuthenticationSubscription
* (AuthenticationSubscriptionDocumentApiImpl)
...
...
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