Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
O
OpenXG-NRF
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-NRF
Commits
bef804bd
Commit
bef804bd
authored
Dec 22, 2020
by
Tien-Thinh Nguyen
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add NFStatusUnSubscribe operation
parent
d3c88ee7
Changes
3
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
118 additions
and
45 deletions
+118
-45
src/api-server/impl/SubscriptionIDDocumentApiImpl.cpp
src/api-server/impl/SubscriptionIDDocumentApiImpl.cpp
+36
-14
src/nrf_app/nrf_app.cpp
src/nrf_app/nrf_app.cpp
+64
-31
src/nrf_app/nrf_app.hpp
src/nrf_app/nrf_app.hpp
+18
-0
No files found.
src/api-server/impl/SubscriptionIDDocumentApiImpl.cpp
View file @
bef804bd
/**
* NRF NFManagement Service
* NRF NFManagement Service. © 2019, 3GPP Organizational Partners (ARIB, ATIS, CCSA, ETSI, TSDSI, TTA, TTC). All rights reserved.
* NRF NFManagement Service. © 2019, 3GPP Organizational Partners (ARIB, ATIS,
* CCSA, ETSI, TSDSI, TTA, TTC). All rights reserved.
*
* The version of the OpenAPI document: 1.1.0.alpha-1
*
*
* NOTE: This class is auto generated by OpenAPI Generator
(https://openapi-generator.tech).
*
https://openapi-generator.tech
*
Do not edit
the class manually.
* NOTE: This class is auto generated by OpenAPI Generator
*
(https://openapi-generator.tech). https://openapi-generator.tech Do not edit
* the class manually.
*/
#include "SubscriptionIDDocumentApiImpl.h"
#include "3gpp_29.500.h"
namespace
oai
{
namespace
nrf
{
...
...
@@ -22,16 +24,37 @@ using namespace oai::nrf::app;
SubscriptionIDDocumentApiImpl
::
SubscriptionIDDocumentApiImpl
(
std
::
shared_ptr
<
Pistache
::
Rest
::
Router
>
rtr
,
nrf_app
*
nrf_app_inst
,
std
::
string
address
)
:
SubscriptionIDDocumentApi
(
rtr
),
m_nrf_app
(
nrf_app_inst
),
m_address
(
address
)
{
}
:
SubscriptionIDDocumentApi
(
rtr
),
m_nrf_app
(
nrf_app_inst
),
m_address
(
address
)
{}
void
SubscriptionIDDocumentApiImpl
::
remove_subscription
(
const
std
::
string
&
subscriptionID
,
Pistache
::
Http
::
ResponseWriter
&
response
)
{
response
.
send
(
Pistache
::
Http
::
Code
::
Ok
,
"Do some magic
\n
"
);
Logger
::
nrf_sbi
().
info
(
"Got a request to remove an existing subscription, subscription ID %s"
,
subscriptionID
.
c_str
());
int
http_code
=
0
;
ProblemDetails
problem_details
=
{};
m_nrf_app
->
handle_remove_subscription
(
subscriptionID
,
http_code
,
1
,
problem_details
);
nlohmann
::
json
json_data
=
{};
std
::
string
content_type
=
"application/json"
;
if
(
http_code
!=
HTTP_STATUS_CODE_204_NO_CONTENT
)
{
to_json
(
json_data
,
problem_details
);
content_type
=
"application/problem+json"
;
// content type
response
.
headers
().
add
<
Pistache
::
Http
::
Header
::
ContentType
>
(
Pistache
::
Http
::
Mime
::
MediaType
(
content_type
));
response
.
send
(
Pistache
::
Http
::
Code
(
http_code
),
json_data
.
dump
().
c_str
());
}
else
{
// content type
response
.
headers
().
add
<
Pistache
::
Http
::
Header
::
ContentType
>
(
Pistache
::
Http
::
Mime
::
MediaType
(
content_type
));
response
.
send
(
Pistache
::
Http
::
Code
(
http_code
));
}
}
void
SubscriptionIDDocumentApiImpl
::
update_subscription
(
const
std
::
string
&
subscriptionID
,
const
std
::
vector
<
PatchItem
>
&
patchItem
,
...
...
@@ -39,7 +62,6 @@ void SubscriptionIDDocumentApiImpl::update_subscription(
response
.
send
(
Pistache
::
Http
::
Code
::
Ok
,
"Do some magic
\n
"
);
}
}
}
}
}
// namespace api
}
// namespace nrf
}
// namespace oai
src/nrf_app/nrf_app.cpp
View file @
bef804bd
This diff is collapsed.
Click to expand it.
src/nrf_app/nrf_app.hpp
View file @
bef804bd
...
...
@@ -129,6 +129,7 @@ class nrf_app {
/*
* Handle a Register NF Instance request
* @param [SubscriptionData &] subscription_data: Subscription data
* @param [std::string &] sub_id: Subscription ID
* @param [int &] http_code: HTTP code used to return to the consumer
* @param [const uint8_t] http_version: HTTP version
* @param [ProblemDetails &] problem_details: Store details of the error
...
...
@@ -139,6 +140,17 @@ class nrf_app {
const
uint8_t
http_version
,
ProblemDetails
&
problem_details
);
/*
* Handle a NFStatusUnSubscribe request (removes an existing subscription)
* @param [const std::string &] sub_id: Subscription ID
* @param [int &] http_code: HTTP code used to return to the consumer
* @param [const uint8_t] http_version: HTTP version
* @param [ProblemDetails &] problem_details: Store details of the error
* @return void
*/
void
handle_remove_subscription
(
const
std
::
string
&
sub_id
,
int
&
http_code
,
const
uint8_t
http_version
,
ProblemDetails
&
problem_details
);
/*
* Insert a nrf profile
* @param [const std::string &] profile_id: Profile ID
...
...
@@ -214,6 +226,12 @@ class nrf_app {
bool
add_subscription
(
const
std
::
string
&
sub_id
,
const
std
::
shared_ptr
<
nrf_subscription
>
&
s
);
/*
* Remove a subscription from the list
* @param [std::string &] sub_id: ID of the subscription to be removed
* @return true if successful, otherwise, return false
*/
bool
remove_subscription
(
const
std
::
string
&
sub_id
);
/*
* Subscribe to the task tick event
* @param [uint64_t &] ms: Current time in ms
...
...
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