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
483ac964
Commit
483ac964
authored
Jan 07, 2021
by
yangjian
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Complete AuthenticationSubscription and Test successful
parent
47205f6f
Changes
7
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
80 additions
and
7 deletions
+80
-7
api/AuthenticationSubscriptionDocumentApi.cpp
api/AuthenticationSubscriptionDocumentApi.cpp
+40
-0
api/AuthenticationSubscriptionDocumentApi.h
api/AuthenticationSubscriptionDocumentApi.h
+2
-0
impl/AccessAndMobilitySubscriptionDataDocumentApiImpl.cpp
impl/AccessAndMobilitySubscriptionDataDocumentApiImpl.cpp
+1
-0
impl/AuthenticationSubscriptionDocumentApiImpl.cpp
impl/AuthenticationSubscriptionDocumentApiImpl.cpp
+33
-1
impl/AuthenticationSubscriptionDocumentApiImpl.h
impl/AuthenticationSubscriptionDocumentApiImpl.h
+1
-0
main-api-server.cpp
main-api-server.cpp
+0
-6
model/PatchItem.cpp
model/PatchItem.cpp
+3
-0
No files found.
api/AuthenticationSubscriptionDocumentApi.cpp
View file @
483ac964
...
@@ -32,6 +32,7 @@ void AuthenticationSubscriptionDocumentApi::init() {
...
@@ -32,6 +32,7 @@ void AuthenticationSubscriptionDocumentApi::init() {
void
AuthenticationSubscriptionDocumentApi
::
setupRoutes
()
{
void
AuthenticationSubscriptionDocumentApi
::
setupRoutes
()
{
using
namespace
Pistache
::
Rest
;
using
namespace
Pistache
::
Rest
;
Routes
::
Get
(
*
router
,
base
+
"/subscription-data/:ueId/authentication-data/authentication-subscription"
,
Routes
::
bind
(
&
AuthenticationSubscriptionDocumentApi
::
read_authentication_subscription_handler
,
this
));
Routes
::
Patch
(
*
router
,
base
+
"/subscription-data/:ueId/authentication-data/authentication-subscription"
,
Routes
::
bind
(
&
AuthenticationSubscriptionDocumentApi
::
modify_authentication_subscription_handler
,
this
));
Routes
::
Patch
(
*
router
,
base
+
"/subscription-data/:ueId/authentication-data/authentication-subscription"
,
Routes
::
bind
(
&
AuthenticationSubscriptionDocumentApi
::
modify_authentication_subscription_handler
,
this
));
// Default handler, called when a route is not found
// Default handler, called when a route is not found
...
@@ -41,7 +42,10 @@ void AuthenticationSubscriptionDocumentApi::setupRoutes() {
...
@@ -41,7 +42,10 @@ void AuthenticationSubscriptionDocumentApi::setupRoutes() {
void
AuthenticationSubscriptionDocumentApi
::
modify_authentication_subscription_handler
(
const
Pistache
::
Rest
::
Request
&
request
,
Pistache
::
Http
::
ResponseWriter
response
)
{
void
AuthenticationSubscriptionDocumentApi
::
modify_authentication_subscription_handler
(
const
Pistache
::
Rest
::
Request
&
request
,
Pistache
::
Http
::
ResponseWriter
response
)
{
// Getting the path params
// Getting the path params
auto
ueId
=
request
.
param
(
":ueId"
).
as
<
std
::
string
>
();
auto
ueId
=
request
.
param
(
":ueId"
).
as
<
std
::
string
>
();
std
::
cout
<<
"***** ueId ("
<<
ueId
<<
")******"
<<
std
::
endl
;
std
::
cout
<<
"***** request.body() ("
<<
request
.
body
()
<<
")******"
<<
std
::
endl
;
// Getting the body param
// Getting the body param
std
::
vector
<
PatchItem
>
patchItem
;
std
::
vector
<
PatchItem
>
patchItem
;
...
@@ -73,6 +77,42 @@ void AuthenticationSubscriptionDocumentApi::modify_authentication_subscription_h
...
@@ -73,6 +77,42 @@ void AuthenticationSubscriptionDocumentApi::modify_authentication_subscription_h
}
}
void
AuthenticationSubscriptionDocumentApi
::
read_authentication_subscription_handler
(
const
Pistache
::
Rest
::
Request
&
request
,
Pistache
::
Http
::
ResponseWriter
response
)
{
// Getting the path params
auto
ueId
=
request
.
param
(
":ueId"
).
as
<
std
::
string
>
();
std
::
cout
<<
"***** ueId ("
<<
ueId
<<
")******"
<<
std
::
endl
;
std
::
cout
<<
"***** request.body() ("
<<
request
.
body
()
<<
")******"
<<
std
::
endl
;
// Getting the query params
auto
supportedFeaturesQuery
=
request
.
query
().
get
(
"supported-features"
);
Pistache
::
Optional
<
std
::
string
>
supportedFeatures
;
if
(
!
supportedFeaturesQuery
.
isEmpty
()){
std
::
string
valueQuery_instance
;
if
(
fromStringValue
(
supportedFeaturesQuery
.
get
(),
valueQuery_instance
)){
supportedFeatures
=
Pistache
::
Some
(
valueQuery_instance
);
}
}
try
{
this
->
read_authentication_subscription
(
ueId
,
supportedFeatures
,
response
);
}
catch
(
nlohmann
::
detail
::
exception
&
e
)
{
//send a 400 error
response
.
send
(
Pistache
::
Http
::
Code
::
Bad_Request
,
e
.
what
());
return
;
}
catch
(
Pistache
::
Http
::
HttpError
&
e
)
{
response
.
send
(
static_cast
<
Pistache
::
Http
::
Code
>
(
e
.
code
()),
e
.
what
());
return
;
}
catch
(
std
::
exception
&
e
)
{
//send a 500 error
response
.
send
(
Pistache
::
Http
::
Code
::
Internal_Server_Error
,
e
.
what
());
return
;
}
}
void
AuthenticationSubscriptionDocumentApi
::
authentication_subscription_document_api_default_handler
(
const
Pistache
::
Rest
::
Request
&
,
Pistache
::
Http
::
ResponseWriter
response
)
{
void
AuthenticationSubscriptionDocumentApi
::
authentication_subscription_document_api_default_handler
(
const
Pistache
::
Rest
::
Request
&
,
Pistache
::
Http
::
ResponseWriter
response
)
{
response
.
send
(
Pistache
::
Http
::
Code
::
Not_Found
,
"The requested method does not exist"
);
response
.
send
(
Pistache
::
Http
::
Code
::
Not_Found
,
"The requested method does not exist"
);
}
}
...
...
api/AuthenticationSubscriptionDocumentApi.h
View file @
483ac964
...
@@ -50,6 +50,7 @@ private:
...
@@ -50,6 +50,7 @@ private:
void
setupRoutes
();
void
setupRoutes
();
void
modify_authentication_subscription_handler
(
const
Pistache
::
Rest
::
Request
&
request
,
Pistache
::
Http
::
ResponseWriter
response
);
void
modify_authentication_subscription_handler
(
const
Pistache
::
Rest
::
Request
&
request
,
Pistache
::
Http
::
ResponseWriter
response
);
void
read_authentication_subscription_handler
(
const
Pistache
::
Rest
::
Request
&
request
,
Pistache
::
Http
::
ResponseWriter
response
);
void
authentication_subscription_document_api_default_handler
(
const
Pistache
::
Rest
::
Request
&
request
,
Pistache
::
Http
::
ResponseWriter
response
);
void
authentication_subscription_document_api_default_handler
(
const
Pistache
::
Rest
::
Request
&
request
,
Pistache
::
Http
::
ResponseWriter
response
);
std
::
shared_ptr
<
Pistache
::
Rest
::
Router
>
router
;
std
::
shared_ptr
<
Pistache
::
Rest
::
Router
>
router
;
...
@@ -64,6 +65,7 @@ private:
...
@@ -64,6 +65,7 @@ private:
/// <param name="patchItem"></param>
/// <param name="patchItem"></param>
/// <param name="supportedFeatures">Features required to be supported by the target NF (optional, default to "")</param>
/// <param name="supportedFeatures">Features required to be supported by the target NF (optional, default to "")</param>
virtual
void
modify_authentication_subscription
(
const
std
::
string
&
ueId
,
const
std
::
vector
<
PatchItem
>
&
patchItem
,
const
Pistache
::
Optional
<
std
::
string
>
&
supportedFeatures
,
Pistache
::
Http
::
ResponseWriter
&
response
)
=
0
;
virtual
void
modify_authentication_subscription
(
const
std
::
string
&
ueId
,
const
std
::
vector
<
PatchItem
>
&
patchItem
,
const
Pistache
::
Optional
<
std
::
string
>
&
supportedFeatures
,
Pistache
::
Http
::
ResponseWriter
&
response
)
=
0
;
virtual
void
read_authentication_subscription
(
const
std
::
string
&
ueId
,
const
Pistache
::
Optional
<
std
::
string
>
&
supportedFeatures
,
Pistache
::
Http
::
ResponseWriter
&
response
)
=
0
;
};
};
...
...
impl/AccessAndMobilitySubscriptionDataDocumentApiImpl.cpp
View file @
483ac964
...
@@ -25,6 +25,7 @@ AccessAndMobilitySubscriptionDataDocumentApiImpl::AccessAndMobilitySubscriptionD
...
@@ -25,6 +25,7 @@ AccessAndMobilitySubscriptionDataDocumentApiImpl::AccessAndMobilitySubscriptionD
void
AccessAndMobilitySubscriptionDataDocumentApiImpl
::
query_am_data
(
const
std
::
string
&
ueId
,
const
std
::
string
&
servingPlmnId
,
const
Pistache
::
Optional
<
std
::
vector
<
std
::
string
>>
&
fields
,
const
Pistache
::
Optional
<
std
::
string
>
&
supportedFeatures
,
const
Pistache
::
Optional
<
Pistache
::
Http
::
Header
::
Raw
>
&
ifNoneMatch
,
const
Pistache
::
Optional
<
Pistache
::
Http
::
Header
::
Raw
>
&
ifModifiedSince
,
Pistache
::
Http
::
ResponseWriter
&
response
)
{
void
AccessAndMobilitySubscriptionDataDocumentApiImpl
::
query_am_data
(
const
std
::
string
&
ueId
,
const
std
::
string
&
servingPlmnId
,
const
Pistache
::
Optional
<
std
::
vector
<
std
::
string
>>
&
fields
,
const
Pistache
::
Optional
<
std
::
string
>
&
supportedFeatures
,
const
Pistache
::
Optional
<
Pistache
::
Http
::
Header
::
Raw
>
&
ifNoneMatch
,
const
Pistache
::
Optional
<
Pistache
::
Http
::
Header
::
Raw
>
&
ifModifiedSince
,
Pistache
::
Http
::
ResponseWriter
&
response
)
{
response
.
send
(
Pistache
::
Http
::
Code
::
Ok
,
"Do some magic
\n
"
);
response
.
send
(
Pistache
::
Http
::
Code
::
Ok
,
"Do some magic
\n
"
);
}
}
}
}
...
...
impl/AuthenticationSubscriptionDocumentApiImpl.cpp
View file @
483ac964
...
@@ -11,6 +11,7 @@
...
@@ -11,6 +11,7 @@
*/
*/
#include "AuthenticationSubscriptionDocumentApiImpl.h"
#include "AuthenticationSubscriptionDocumentApiImpl.h"
#include "PatchResult.h"
namespace
org
{
namespace
org
{
namespace
openapitools
{
namespace
openapitools
{
...
@@ -24,9 +25,40 @@ AuthenticationSubscriptionDocumentApiImpl::AuthenticationSubscriptionDocumentApi
...
@@ -24,9 +25,40 @@ AuthenticationSubscriptionDocumentApiImpl::AuthenticationSubscriptionDocumentApi
{
}
{
}
void
AuthenticationSubscriptionDocumentApiImpl
::
modify_authentication_subscription
(
const
std
::
string
&
ueId
,
const
std
::
vector
<
PatchItem
>
&
patchItem
,
const
Pistache
::
Optional
<
std
::
string
>
&
supportedFeatures
,
Pistache
::
Http
::
ResponseWriter
&
response
)
{
void
AuthenticationSubscriptionDocumentApiImpl
::
modify_authentication_subscription
(
const
std
::
string
&
ueId
,
const
std
::
vector
<
PatchItem
>
&
patchItem
,
const
Pistache
::
Optional
<
std
::
string
>
&
supportedFeatures
,
Pistache
::
Http
::
ResponseWriter
&
response
)
{
response
.
send
(
Pistache
::
Http
::
Code
::
Ok
,
"Do some magic
\n
"
);
/************************ test ************************/
nlohmann
::
json
j
,
j1
;
for
(
int
i
=
0
;
i
<
patchItem
.
size
();
i
++
)
{
to_json
(
j1
,
patchItem
[
i
]);
j
+=
j1
;
}
response
.
send
(
Pistache
::
Http
::
Code
::
Ok
,
j
.
dump
());
//response.send(Pistache::Http::Code::Ok, "Do some magic hello\n");
/******************************************************/
//1.modify handler
//2.modify success
//3.send PatchResult
//response.send(Pistache::Http::Code::Ok, j.dump());
}
}
void
AuthenticationSubscriptionDocumentApiImpl
::
read_authentication_subscription
(
const
std
::
string
&
ueId
,
const
Pistache
::
Optional
<
std
::
string
>
&
supportedFeatures
,
Pistache
::
Http
::
ResponseWriter
&
response
)
{
/************************ test ************************/
response
.
send
(
Pistache
::
Http
::
Code
::
Ok
,
"read_authentication_subscription"
);
//response.send(Pistache::Http::Code::Ok, "Do some magic hello\n");
/******************************************************/
//1.read handler database
//2.send data
//response.send(Pistache::Http::Code::Ok, j.dump());
}
}
}
}
}
}
}
...
...
impl/AuthenticationSubscriptionDocumentApiImpl.h
View file @
483ac964
...
@@ -48,6 +48,7 @@ public:
...
@@ -48,6 +48,7 @@ public:
~
AuthenticationSubscriptionDocumentApiImpl
()
{}
~
AuthenticationSubscriptionDocumentApiImpl
()
{}
void
modify_authentication_subscription
(
const
std
::
string
&
ueId
,
const
std
::
vector
<
PatchItem
>
&
patchItem
,
const
Pistache
::
Optional
<
std
::
string
>
&
supportedFeatures
,
Pistache
::
Http
::
ResponseWriter
&
response
);
void
modify_authentication_subscription
(
const
std
::
string
&
ueId
,
const
std
::
vector
<
PatchItem
>
&
patchItem
,
const
Pistache
::
Optional
<
std
::
string
>
&
supportedFeatures
,
Pistache
::
Http
::
ResponseWriter
&
response
);
void
read_authentication_subscription
(
const
std
::
string
&
ueId
,
const
Pistache
::
Optional
<
std
::
string
>
&
supportedFeatures
,
Pistache
::
Http
::
ResponseWriter
&
response
);
};
};
...
...
main-api-server.cpp
View file @
483ac964
...
@@ -22,14 +22,12 @@
...
@@ -22,14 +22,12 @@
#include "AMF3GPPAccessRegistrationDocumentApiImpl.h"
#include "AMF3GPPAccessRegistrationDocumentApiImpl.h"
#include "AMFNon3GPPAccessRegistrationDocumentApiImpl.h"
#include "AMFNon3GPPAccessRegistrationDocumentApiImpl.h"
//#include "AMFSubscriptionInfoDocumentApiImpl.h"
#include "AccessAndMobilityDataApiImpl.h"
#include "AccessAndMobilityDataApiImpl.h"
#include "AccessAndMobilityPolicyDataDocumentApiImpl.h"
#include "AccessAndMobilityPolicyDataDocumentApiImpl.h"
#include "AccessAndMobilitySubscriptionDataDocumentApiImpl.h"
#include "AccessAndMobilitySubscriptionDataDocumentApiImpl.h"
#include "AmfSubscriptionInfoDocumentApiImpl.h"
#include "AmfSubscriptionInfoDocumentApiImpl.h"
#include "ApplicationDataSubscriptionsCollectionApiImpl.h"
#include "ApplicationDataSubscriptionsCollectionApiImpl.h"
#include "AuthEventDocumentApiImpl.h"
#include "AuthEventDocumentApiImpl.h"
#include "AuthenticationDataDocumentApiImpl.h"
#include "AuthenticationSoRDocumentApiImpl.h"
#include "AuthenticationSoRDocumentApiImpl.h"
#include "AuthenticationStatusDocumentApiImpl.h"
#include "AuthenticationStatusDocumentApiImpl.h"
#include "AuthenticationSubscriptionDocumentApiImpl.h"
#include "AuthenticationSubscriptionDocumentApiImpl.h"
...
@@ -168,8 +166,6 @@ int main() {
...
@@ -168,8 +166,6 @@ int main() {
AMF3GPPAccessRegistrationDocumentApiserver
.
init
();
AMF3GPPAccessRegistrationDocumentApiserver
.
init
();
AMFNon3GPPAccessRegistrationDocumentApiImpl
AMFNon3GPPAccessRegistrationDocumentApiserver
(
router
);
AMFNon3GPPAccessRegistrationDocumentApiImpl
AMFNon3GPPAccessRegistrationDocumentApiserver
(
router
);
AMFNon3GPPAccessRegistrationDocumentApiserver
.
init
();
AMFNon3GPPAccessRegistrationDocumentApiserver
.
init
();
// AMFSubscriptionInfoDocumentApiImpl AMFSubscriptionInfoDocumentApiserver(router);
// AMFSubscriptionInfoDocumentApiserver.init();
AccessAndMobilityDataApiImpl
AccessAndMobilityDataApiserver
(
router
);
AccessAndMobilityDataApiImpl
AccessAndMobilityDataApiserver
(
router
);
AccessAndMobilityDataApiserver
.
init
();
AccessAndMobilityDataApiserver
.
init
();
AccessAndMobilityPolicyDataDocumentApiImpl
AccessAndMobilityPolicyDataDocumentApiserver
(
router
);
AccessAndMobilityPolicyDataDocumentApiImpl
AccessAndMobilityPolicyDataDocumentApiserver
(
router
);
...
@@ -182,8 +178,6 @@ int main() {
...
@@ -182,8 +178,6 @@ int main() {
ApplicationDataSubscriptionsCollectionApiserver
.
init
();
ApplicationDataSubscriptionsCollectionApiserver
.
init
();
AuthEventDocumentApiImpl
AuthEventDocumentApiserver
(
router
);
AuthEventDocumentApiImpl
AuthEventDocumentApiserver
(
router
);
AuthEventDocumentApiserver
.
init
();
AuthEventDocumentApiserver
.
init
();
AuthenticationDataDocumentApiImpl
AuthenticationDataDocumentApiserver
(
router
);
AuthenticationDataDocumentApiserver
.
init
();
AuthenticationSoRDocumentApiImpl
AuthenticationSoRDocumentApiserver
(
router
);
AuthenticationSoRDocumentApiImpl
AuthenticationSoRDocumentApiserver
(
router
);
AuthenticationSoRDocumentApiserver
.
init
();
AuthenticationSoRDocumentApiserver
.
init
();
AuthenticationStatusDocumentApiImpl
AuthenticationStatusDocumentApiserver
(
router
);
AuthenticationStatusDocumentApiImpl
AuthenticationStatusDocumentApiserver
(
router
);
...
...
model/PatchItem.cpp
View file @
483ac964
...
@@ -12,6 +12,8 @@
...
@@ -12,6 +12,8 @@
#include "PatchItem.h"
#include "PatchItem.h"
#include <iostream>
using
namespace
std
;
namespace
org
{
namespace
org
{
namespace
openapitools
{
namespace
openapitools
{
...
@@ -49,6 +51,7 @@ void to_json(nlohmann::json& j, const PatchItem& o)
...
@@ -49,6 +51,7 @@ void to_json(nlohmann::json& j, const PatchItem& o)
void
from_json
(
const
nlohmann
::
json
&
j
,
PatchItem
&
o
)
void
from_json
(
const
nlohmann
::
json
&
j
,
PatchItem
&
o
)
{
{
cout
<<
"patchitem from_json "
<<
endl
;
j
.
at
(
"op"
).
get_to
(
o
.
m_Op
);
j
.
at
(
"op"
).
get_to
(
o
.
m_Op
);
j
.
at
(
"path"
).
get_to
(
o
.
m_Path
);
j
.
at
(
"path"
).
get_to
(
o
.
m_Path
);
if
(
j
.
find
(
"from"
)
!=
j
.
end
())
if
(
j
.
find
(
"from"
)
!=
j
.
end
())
...
...
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