Commit ddcaaab0 authored by Tien-Thinh Nguyen's avatar Tien-Thinh Nguyen

Associate EventExposure with AMF App

parent 50003832
...@@ -23,6 +23,7 @@ ...@@ -23,6 +23,7 @@
#define FILE_3GPP_29_518_SEEN #define FILE_3GPP_29_518_SEEN
#include "amf.hpp" #include "amf.hpp"
#include <vector>
typedef enum amf_event_e { typedef enum amf_event_e {
LOCATION_REPORT = 1, LOCATION_REPORT = 1,
......
...@@ -9,6 +9,7 @@ void AMFApiServer::init(size_t thr) { ...@@ -9,6 +9,7 @@ void AMFApiServer::init(size_t thr) {
opts.maxRequestSize(PISTACHE_SERVER_MAX_PAYLOAD); opts.maxRequestSize(PISTACHE_SERVER_MAX_PAYLOAD);
m_httpEndpoint->init(opts); m_httpEndpoint->init(opts);
m_individualSubscriptionDocumentApiImpl->init(); m_individualSubscriptionDocumentApiImpl->init();
m_individualSubscriptionDocumentApiImplEventExposure->init();
m_individualUeContextDocumentApiImpl->init(); m_individualUeContextDocumentApiImpl->init();
m_n1N2IndividualSubscriptionDocumentApiImpl->init(); m_n1N2IndividualSubscriptionDocumentApiImpl->init();
m_n1N2MessageCollectionDocumentApiImpl->init(); m_n1N2MessageCollectionDocumentApiImpl->init();
...@@ -24,6 +25,9 @@ void AMFApiServer::start() { ...@@ -24,6 +25,9 @@ void AMFApiServer::start() {
if (m_individualSubscriptionDocumentApiImpl != nullptr) if (m_individualSubscriptionDocumentApiImpl != nullptr)
Logger::amf_server().debug( Logger::amf_server().debug(
"AMF handler for IndividualSubscriptionDocumentApiImpl"); "AMF handler for IndividualSubscriptionDocumentApiImpl");
if (m_individualSubscriptionDocumentApiImplEventExposure != nullptr)
Logger::amf_server().debug(
"AMF handler for IndividualSubscriptionDocumentApiImpl");
if (m_individualUeContextDocumentApiImpl != nullptr) if (m_individualUeContextDocumentApiImpl != nullptr)
Logger::amf_server().debug( Logger::amf_server().debug(
"AMF handler for IndividualUeContextDocumentApiImpl"); "AMF handler for IndividualUeContextDocumentApiImpl");
......
...@@ -8,6 +8,7 @@ ...@@ -8,6 +8,7 @@
#endif #endif
#include "IndividualSubscriptionDocumentApiImpl.h" #include "IndividualSubscriptionDocumentApiImpl.h"
#include "IndividualSubscriptionDocumentApiImplEventExposure.h"
#include "IndividualUeContextDocumentApiImpl.h" #include "IndividualUeContextDocumentApiImpl.h"
#include "N1N2IndividualSubscriptionDocumentApiImpl.h" #include "N1N2IndividualSubscriptionDocumentApiImpl.h"
#include "N1N2MessageCollectionDocumentApiImpl.h" #include "N1N2MessageCollectionDocumentApiImpl.h"
...@@ -16,8 +17,6 @@ ...@@ -16,8 +17,6 @@
#include "NonUEN2MessagesCollectionDocumentApiImpl.h" #include "NonUEN2MessagesCollectionDocumentApiImpl.h"
#include "NonUEN2MessagesSubscriptionsCollectionDocumentApiImpl.h" #include "NonUEN2MessagesSubscriptionsCollectionDocumentApiImpl.h"
#include "SubscriptionsCollectionDocumentApiImpl.h" #include "SubscriptionsCollectionDocumentApiImpl.h"
#include "SubscriptionsCollectionApiImpl.h"
#include "NFStatusNotifyApiImpl.h"
#define PISTACHE_SERVER_THREADS 2 #define PISTACHE_SERVER_THREADS 2
#define PISTACHE_SERVER_MAX_PAYLOAD 32768 #define PISTACHE_SERVER_MAX_PAYLOAD 32768
...@@ -36,6 +35,9 @@ class AMFApiServer { ...@@ -36,6 +35,9 @@ class AMFApiServer {
m_individualSubscriptionDocumentApiImpl = m_individualSubscriptionDocumentApiImpl =
std::make_shared<IndividualSubscriptionDocumentApiImpl>( std::make_shared<IndividualSubscriptionDocumentApiImpl>(
m_router, amf_app_inst); m_router, amf_app_inst);
m_individualSubscriptionDocumentApiImplEventExposure =
std::make_shared<IndividualSubscriptionDocumentApiImplEventExposure>(
m_router, amf_app_inst);
m_individualUeContextDocumentApiImpl = m_individualUeContextDocumentApiImpl =
std::make_shared<IndividualUeContextDocumentApiImpl>( std::make_shared<IndividualUeContextDocumentApiImpl>(
m_router, amf_app_inst); m_router, amf_app_inst);
...@@ -62,11 +64,6 @@ class AMFApiServer { ...@@ -62,11 +64,6 @@ class AMFApiServer {
m_subscriptionsCollectionDocumentApiImpl = m_subscriptionsCollectionDocumentApiImpl =
std::make_shared<SubscriptionsCollectionDocumentApiImpl>( std::make_shared<SubscriptionsCollectionDocumentApiImpl>(
m_router, amf_app_inst); m_router, amf_app_inst);
m_subscriptionsCollectionApiImpl =
std::make_shared<SubscriptionsCollectionApiImpl>(
m_router, amf_app_inst, m_address);
m_nfStatusNotifyApiImpl = std::make_shared<NFStatusNotifyApiImpl>(
m_router, amf_app_inst, m_address);
} }
void init(size_t thr = 1); void init(size_t thr = 1);
...@@ -78,6 +75,8 @@ class AMFApiServer { ...@@ -78,6 +75,8 @@ class AMFApiServer {
std::shared_ptr<Pistache::Rest::Router> m_router; std::shared_ptr<Pistache::Rest::Router> m_router;
std::shared_ptr<IndividualSubscriptionDocumentApiImpl> std::shared_ptr<IndividualSubscriptionDocumentApiImpl>
m_individualSubscriptionDocumentApiImpl; m_individualSubscriptionDocumentApiImpl;
std::shared_ptr<IndividualSubscriptionDocumentApiImplEventExposure>
m_individualSubscriptionDocumentApiImplEventExposure;
std::shared_ptr<IndividualUeContextDocumentApiImpl> std::shared_ptr<IndividualUeContextDocumentApiImpl>
m_individualUeContextDocumentApiImpl; m_individualUeContextDocumentApiImpl;
std::shared_ptr<N1N2IndividualSubscriptionDocumentApiImpl> std::shared_ptr<N1N2IndividualSubscriptionDocumentApiImpl>
...@@ -96,8 +95,5 @@ class AMFApiServer { ...@@ -96,8 +95,5 @@ class AMFApiServer {
m_nonUEN2MessagesSubscriptionsCollectionDocumentApiImpl; m_nonUEN2MessagesSubscriptionsCollectionDocumentApiImpl;
std::shared_ptr<SubscriptionsCollectionDocumentApiImpl> std::shared_ptr<SubscriptionsCollectionDocumentApiImpl>
m_subscriptionsCollectionDocumentApiImpl; m_subscriptionsCollectionDocumentApiImpl;
std::shared_ptr<SubscriptionsCollectionApiImpl>
m_subscriptionsCollectionApiImpl;
std::shared_ptr<NFStatusNotifyApiImpl> m_nfStatusNotifyApiImpl;
std::string m_address; std::string m_address;
}; };
...@@ -25,8 +25,9 @@ using namespace org::openapitools::server::helpers; ...@@ -25,8 +25,9 @@ using namespace org::openapitools::server::helpers;
using namespace oai::amf::model; using namespace oai::amf::model;
IndividualSubscriptionDocumentApi::IndividualSubscriptionDocumentApi( IndividualSubscriptionDocumentApi::IndividualSubscriptionDocumentApi(
const std::shared_ptr<Pistache::Rest::Router>& rtr) std::shared_ptr<Pistache::Rest::Router> rtr) {
: router(rtr) {} router = rtr;
}
void IndividualSubscriptionDocumentApi::init() { void IndividualSubscriptionDocumentApi::init() {
setupRoutes(); setupRoutes();
...@@ -35,17 +36,19 @@ void IndividualSubscriptionDocumentApi::init() { ...@@ -35,17 +36,19 @@ void IndividualSubscriptionDocumentApi::init() {
void IndividualSubscriptionDocumentApi::setupRoutes() { void IndividualSubscriptionDocumentApi::setupRoutes() {
using namespace Pistache::Rest; using namespace Pistache::Rest;
Routes::Delete( Routes::Put(
*router, *router,
base + amf_cfg.sbi_api_version + "/subscriptions/:subscriptionId", base + amf_cfg.sbi_api_version + "/subscriptions/:subscriptionId",
Routes::bind( Routes::bind(
&IndividualSubscriptionDocumentApi::delete_subscription_handler, &IndividualSubscriptionDocumentApi::
a_mf_status_change_subscribe_modfy_handler,
this)); this));
Routes::Patch( Routes::Delete(
*router, *router,
base + amf_cfg.sbi_api_version + "/subscriptions/:subscriptionId", base + amf_cfg.sbi_api_version + "/subscriptions/:subscriptionId",
Routes::bind( Routes::bind(
&IndividualSubscriptionDocumentApi::modify_subscription_handler, &IndividualSubscriptionDocumentApi::
a_mf_status_change_un_subscribe_handler,
this)); this));
// Default handler, called when a route is not found // Default handler, called when a route is not found
...@@ -55,84 +58,47 @@ void IndividualSubscriptionDocumentApi::setupRoutes() { ...@@ -55,84 +58,47 @@ void IndividualSubscriptionDocumentApi::setupRoutes() {
this)); this));
} }
std::pair<Pistache::Http::Code, std::string> void IndividualSubscriptionDocumentApi::
IndividualSubscriptionDocumentApi::handleParsingException( a_mf_status_change_subscribe_modfy_handler(
const std::exception& ex) const noexcept {
try {
throw ex;
} catch (nlohmann::detail::exception& e) {
return std::make_pair(Pistache::Http::Code::Bad_Request, e.what());
} catch (org::openapitools::server::helpers::ValidationException& e) {
return std::make_pair(Pistache::Http::Code::Bad_Request, e.what());
}
}
std::pair<Pistache::Http::Code, std::string>
IndividualSubscriptionDocumentApi::handleOperationException(
const std::exception& ex) const noexcept {
return std::make_pair(Pistache::Http::Code::Internal_Server_Error, ex.what());
}
void IndividualSubscriptionDocumentApi::delete_subscription_handler(
const Pistache::Rest::Request& request, const Pistache::Rest::Request& request,
Pistache::Http::ResponseWriter response) { Pistache::Http::ResponseWriter response) {
try {
// Getting the path params // Getting the path params
auto subscriptionId = request.param(":subscriptionId").as<std::string>(); auto subscriptionId = request.param(":subscriptionId").as<std::string>();
// Getting the body param
SubscriptionData subscriptionData;
try { try {
this->delete_subscription(subscriptionId, response); nlohmann::json::parse(request.body()).get_to(subscriptionData);
} catch (Pistache::Http::HttpError& e) { this->a_mf_status_change_subscribe_modfy(
response.send(static_cast<Pistache::Http::Code>(e.code()), e.what()); subscriptionId, subscriptionData, response);
return; } catch (nlohmann::detail::exception& e) {
} catch (std::exception& e) { // send a 400 error
const std::pair<Pistache::Http::Code, std::string> errorInfo = response.send(Pistache::Http::Code::Bad_Request, e.what());
this->handleOperationException(e);
response.send(errorInfo.first, errorInfo.second);
return; return;
}
} catch (std::exception& e) { } catch (std::exception& e) {
// send a 500 error
response.send(Pistache::Http::Code::Internal_Server_Error, e.what()); response.send(Pistache::Http::Code::Internal_Server_Error, e.what());
return;
} }
} }
void IndividualSubscriptionDocumentApi::modify_subscription_handler( void IndividualSubscriptionDocumentApi::a_mf_status_change_un_subscribe_handler(
const Pistache::Rest::Request& request, const Pistache::Rest::Request& request,
Pistache::Http::ResponseWriter response) { Pistache::Http::ResponseWriter response) {
try {
// Getting the path params // Getting the path params
auto subscriptionId = request.param(":subscriptionId").as<std::string>(); auto subscriptionId = request.param(":subscriptionId").as<std::string>();
// Getting the body param
// UNKNOWN_BASE_TYPE uNKNOWNBASETYPE;
AmfUpdateEventOptionItem amfUpdateEventOptionItem;
// TODO:AmfUpdateEventSubscriptionItem
try { try {
nlohmann::json::parse(request.body()).get_to(amfUpdateEventOptionItem); this->a_mf_status_change_un_subscribe(subscriptionId, response);
amfUpdateEventOptionItem.validate(); } catch (nlohmann::detail::exception& e) {
} catch (std::exception& e) { // send a 400 error
const std::pair<Pistache::Http::Code, std::string> errorInfo = response.send(Pistache::Http::Code::Bad_Request, e.what());
this->handleParsingException(e);
response.send(errorInfo.first, errorInfo.second);
return; return;
}
/*
//TODO:AmfUpdateEventSubscriptionItem
try {
//this->modify_subscription(subscriptionId, uNKNOWNBASETYPE,
response); } catch (Pistache::Http::HttpError &e) {
response.send(static_cast<Pistache::Http::Code>(e.code()),
e.what()); return; } 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) { } catch (std::exception& e) {
// send a 500 error
response.send(Pistache::Http::Code::Internal_Server_Error, e.what()); response.send(Pistache::Http::Code::Internal_Server_Error, e.what());
return;
} }
} }
......
/** /**
* Namf_EventExposure * Namf_Communication
* AMF Event Exposure Service © 2019, 3GPP Organizational Partners (ARIB, ATIS, * AMF Communication Service © 2019, 3GPP Organizational Partners (ARIB, ATIS,
* CCSA, ETSI, TSDSI, TTA, TTC). All rights reserved. * CCSA, ETSI, TSDSI, TTA, TTC). All rights reserved.
* *
* The version of the OpenAPI document: 1.1.0.alpha-1 * The version of the OpenAPI document: 1.1.0.alpha-1
...@@ -24,13 +24,8 @@ ...@@ -24,13 +24,8 @@
#include <pistache/http_headers.h> #include <pistache/http_headers.h>
#include <pistache/optional.h> #include <pistache/optional.h>
#include <utility>
#include "AmfUpdatedEventSubscription.h"
//#include "OneOfarrayAmfUpdateEventOptionItem.h"
#include "ProblemDetails.h" #include "ProblemDetails.h"
//#include "SubscriptionData.h" #include "SubscriptionData.h"
#include "AmfUpdateEventOptionItem.h"
#include <string> #include <string>
namespace oai { namespace oai {
...@@ -41,9 +36,8 @@ using namespace oai::amf::model; ...@@ -41,9 +36,8 @@ using namespace oai::amf::model;
class IndividualSubscriptionDocumentApi { class IndividualSubscriptionDocumentApi {
public: public:
explicit IndividualSubscriptionDocumentApi( IndividualSubscriptionDocumentApi(std::shared_ptr<Pistache::Rest::Router>);
const std::shared_ptr<Pistache::Rest::Router>& rtr); virtual ~IndividualSubscriptionDocumentApi() {}
virtual ~IndividualSubscriptionDocumentApi() = default;
void init(); void init();
const std::string base = "/namf-comm/"; const std::string base = "/namf-comm/";
...@@ -51,55 +45,41 @@ class IndividualSubscriptionDocumentApi { ...@@ -51,55 +45,41 @@ class IndividualSubscriptionDocumentApi {
private: private:
void setupRoutes(); void setupRoutes();
void delete_subscription_handler( void a_mf_status_change_subscribe_modfy_handler(
const Pistache::Rest::Request& request, const Pistache::Rest::Request& request,
Pistache::Http::ResponseWriter response); Pistache::Http::ResponseWriter response);
void modify_subscription_handler( void a_mf_status_change_un_subscribe_handler(
const Pistache::Rest::Request& request, const Pistache::Rest::Request& request,
Pistache::Http::ResponseWriter response); Pistache::Http::ResponseWriter response);
void individual_subscription_document_api_default_handler( void individual_subscription_document_api_default_handler(
const Pistache::Rest::Request& request, const Pistache::Rest::Request& request,
Pistache::Http::ResponseWriter response); Pistache::Http::ResponseWriter response);
const std::shared_ptr<Pistache::Rest::Router> router; std::shared_ptr<Pistache::Rest::Router> router;
/// <summary>
/// Helper function to handle unexpected Exceptions during Parameter parsing
/// and validation. May be overriden to return custom error formats.
/// </summary>
virtual std::pair<Pistache::Http::Code, std::string> handleParsingException(
const std::exception& ex) const noexcept;
/// <summary>
/// Helper function to handle unexpected Exceptions during processing of the
/// request in handler functions. May be overriden to return custom error
/// formats.
/// </summary>
virtual std::pair<Pistache::Http::Code, std::string> handleOperationException(
const std::exception& ex) const noexcept;
/// <summary> /// <summary>
/// Namf_EventExposure Unsubscribe service Operation /// Namf_Communication AMF Status Change Subscribe Modify service Operation
/// </summary> /// </summary>
/// <remarks> /// <remarks>
/// ///
/// </remarks> /// </remarks>
/// <param name="subscriptionId">Unique ID of the subscription to be /// <param name="subscriptionId">AMF Status Change Subscription
/// deleted</param> /// Identifier</param> <param name="subscriptionData"></param>
virtual void delete_subscription( virtual void a_mf_status_change_subscribe_modfy(
const std::string& subscriptionId, const std::string& subscriptionId,
const SubscriptionData& subscriptionData,
Pistache::Http::ResponseWriter& response) = 0; Pistache::Http::ResponseWriter& response) = 0;
/// <summary> /// <summary>
/// Namf_EventExposure Subscribe Modify service Operation /// Namf_Communication AMF Status Change UnSubscribe service Operation
/// </summary> /// </summary>
/// <remarks> /// <remarks>
/// ///
/// </remarks> /// </remarks>
/// <param name="subscriptionId">Unique ID of the subscription to be /// <param name="subscriptionId">AMF Status Change Subscription
/// modified</param> <param name="AmfUpdateEventOptionItem"></param> /// Identifier</param>
virtual void modify_subscription( virtual void a_mf_status_change_un_subscribe(
const std::string& subscriptionId, const std::string& subscriptionId,
const oai::amf::model::AmfUpdateEventOptionItem& amfUpdateEventOptionItem,
Pistache::Http::ResponseWriter& response) = 0; Pistache::Http::ResponseWriter& response) = 0;
}; };
......
/**
* Namf_Communication
* AMF Communication 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.
*/
#include "IndividualSubscriptionDocumentApiEventExposure.h"
#include "Helpers.h"
#include "amf_config.hpp"
extern config::amf_config amf_cfg;
namespace oai {
namespace amf {
namespace api {
using namespace org::openapitools::server::helpers;
using namespace oai::amf::model;
IndividualSubscriptionDocumentApiEventExposure::
IndividualSubscriptionDocumentApiEventExposure(
const std::shared_ptr<Pistache::Rest::Router>& rtr)
: router(rtr) {}
void IndividualSubscriptionDocumentApiEventExposure::init() {
setupRoutes();
}
void IndividualSubscriptionDocumentApiEventExposure::setupRoutes() {
using namespace Pistache::Rest;
Routes::Delete(
*router,
base + amf_cfg.sbi_api_version + "/subscriptions/:subscriptionId",
Routes::bind(
&IndividualSubscriptionDocumentApiEventExposure::
delete_subscription_handler,
this));
Routes::Patch(
*router,
base + amf_cfg.sbi_api_version + "/subscriptions/:subscriptionId",
Routes::bind(
&IndividualSubscriptionDocumentApiEventExposure::
modify_subscription_handler,
this));
// Default handler, called when a route is not found
router->addCustomHandler(Routes::bind(
&IndividualSubscriptionDocumentApiEventExposure::
individual_subscription_document_api_default_handler,
this));
}
std::pair<Pistache::Http::Code, std::string>
IndividualSubscriptionDocumentApiEventExposure::handleParsingException(
const std::exception& ex) const noexcept {
try {
throw ex;
} catch (nlohmann::detail::exception& e) {
return std::make_pair(Pistache::Http::Code::Bad_Request, e.what());
} catch (org::openapitools::server::helpers::ValidationException& e) {
return std::make_pair(Pistache::Http::Code::Bad_Request, e.what());
}
}
std::pair<Pistache::Http::Code, std::string>
IndividualSubscriptionDocumentApiEventExposure::handleOperationException(
const std::exception& ex) const noexcept {
return std::make_pair(Pistache::Http::Code::Internal_Server_Error, ex.what());
}
void IndividualSubscriptionDocumentApiEventExposure::
delete_subscription_handler(
const Pistache::Rest::Request& request,
Pistache::Http::ResponseWriter response) {
try {
// Getting the path params
auto subscriptionId = request.param(":subscriptionId").as<std::string>();
try {
this->delete_subscription(subscriptionId, response);
} catch (Pistache::Http::HttpError& e) {
response.send(static_cast<Pistache::Http::Code>(e.code()), e.what());
return;
} 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 IndividualSubscriptionDocumentApiEventExposure::
modify_subscription_handler(
const Pistache::Rest::Request& request,
Pistache::Http::ResponseWriter response) {
try {
// Getting the path params
auto subscriptionId = request.param(":subscriptionId").as<std::string>();
// Getting the body param
// UNKNOWN_BASE_TYPE uNKNOWNBASETYPE;
AmfUpdateEventOptionItem amfUpdateEventOptionItem;
// TODO:AmfUpdateEventSubscriptionItem
try {
nlohmann::json::parse(request.body()).get_to(amfUpdateEventOptionItem);
amfUpdateEventOptionItem.validate();
} catch (std::exception& e) {
const std::pair<Pistache::Http::Code, std::string> errorInfo =
this->handleParsingException(e);
response.send(errorInfo.first, errorInfo.second);
return;
}
/*
//TODO:AmfUpdateEventSubscriptionItem
try {
//this->modify_subscription(subscriptionId, uNKNOWNBASETYPE,
response); } catch (Pistache::Http::HttpError &e) {
response.send(static_cast<Pistache::Http::Code>(e.code()),
e.what()); return; } 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 IndividualSubscriptionDocumentApiEventExposure::
individual_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");
}
} // namespace api
} // namespace amf
} // namespace oai
/**
* Namf_EventExposure
* AMF Event Exposure 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.
*/
/*
* IndividualSubscriptionDocumentApiEventExposure.h
*
*
*/
#ifndef IndividualSubscriptionDocumentApiEventExposure_H_
#define IndividualSubscriptionDocumentApiEventExposure_H_
#include <pistache/http.h>
#include <pistache/router.h>
#include <pistache/http_headers.h>
#include <pistache/optional.h>
#include <utility>
#include "AmfUpdatedEventSubscription.h"
//#include "OneOfarrayAmfUpdateEventOptionItem.h"
#include "ProblemDetails.h"
//#include "SubscriptionData.h"
#include "AmfUpdateEventOptionItem.h"
#include <string>
namespace oai {
namespace amf {
namespace api {
using namespace oai::amf::model;
class IndividualSubscriptionDocumentApiEventExposure {
public:
explicit IndividualSubscriptionDocumentApiEventExposure(
const std::shared_ptr<Pistache::Rest::Router>& rtr);
virtual ~IndividualSubscriptionDocumentApiEventExposure() = default;
void init();
const std::string base = "/namf-comm/";
private:
void setupRoutes();
void delete_subscription_handler(
const Pistache::Rest::Request& request,
Pistache::Http::ResponseWriter response);
void modify_subscription_handler(
const Pistache::Rest::Request& request,
Pistache::Http::ResponseWriter response);
void individual_subscription_document_api_default_handler(
const Pistache::Rest::Request& request,
Pistache::Http::ResponseWriter response);
const std::shared_ptr<Pistache::Rest::Router> router;
/// <summary>
/// Helper function to handle unexpected Exceptions during Parameter parsing
/// and validation. May be overriden to return custom error formats.
/// </summary>
virtual std::pair<Pistache::Http::Code, std::string> handleParsingException(
const std::exception& ex) const noexcept;
/// <summary>
/// Helper function to handle unexpected Exceptions during processing of the
/// request in handler functions. May be overriden to return custom error
/// formats.
/// </summary>
virtual std::pair<Pistache::Http::Code, std::string> handleOperationException(
const std::exception& ex) const noexcept;
/// <summary>
/// Namf_EventExposure Unsubscribe service Operation
/// </summary>
/// <remarks>
///
/// </remarks>
/// <param name="subscriptionId">Unique ID of the subscription to be
/// deleted</param>
virtual void delete_subscription(
const std::string& subscriptionId,
Pistache::Http::ResponseWriter& response) = 0;
/// <summary>
/// Namf_EventExposure Subscribe Modify service Operation
/// </summary>
/// <remarks>
///
/// </remarks>
/// <param name="subscriptionId">Unique ID of the subscription to be
/// modified</param> <param name="AmfUpdateEventOptionItem"></param>
virtual void modify_subscription(
const std::string& subscriptionId,
const oai::amf::model::AmfUpdateEventOptionItem& amfUpdateEventOptionItem,
Pistache::Http::ResponseWriter& response) = 0;
};
} // namespace api
} // namespace amf
} // namespace oai
#endif /* IndividualSubscriptionDocumentApiEventExposure_H_ */
...@@ -19,9 +19,6 @@ namespace oai::amf::api { ...@@ -19,9 +19,6 @@ namespace oai::amf::api {
using namespace org::openapitools::server::helpers; using namespace org::openapitools::server::helpers;
using namespace oai::amf::model; using namespace oai::amf::model;
const std::string SubscriptionsCollectionDocumentApiEventExposure::base =
"/namf-evts/v1";
SubscriptionsCollectionDocumentApiEventExposure:: SubscriptionsCollectionDocumentApiEventExposure::
SubscriptionsCollectionDocumentApiEventExposure( SubscriptionsCollectionDocumentApiEventExposure(
const std::shared_ptr<Pistache::Rest::Router>& rtr) const std::shared_ptr<Pistache::Rest::Router>& rtr)
......
...@@ -39,7 +39,7 @@ class SubscriptionsCollectionDocumentApiEventExposure { ...@@ -39,7 +39,7 @@ class SubscriptionsCollectionDocumentApiEventExposure {
virtual ~SubscriptionsCollectionDocumentApiEventExposure() = default; virtual ~SubscriptionsCollectionDocumentApiEventExposure() = default;
void init(); void init();
static const std::string base; const std::string base = "/namf-evts/";
private: private:
void setupRoutes(); void setupRoutes();
......
/** /**
* Namf_EventExposure * Namf_Communication
* AMF Event Exposure Service © 2019, 3GPP Organizational Partners (ARIB, ATIS, * AMF Communication Service © 2019, 3GPP Organizational Partners (ARIB, ATIS,
* CCSA, ETSI, TSDSI, TTA, TTC). All rights reserved. * CCSA, ETSI, TSDSI, TTA, TTC). All rights reserved.
* *
* The version of the OpenAPI document: 1.1.0.alpha-1 * The version of the OpenAPI document: 1.1.0.alpha-1
...@@ -20,22 +20,25 @@ namespace api { ...@@ -20,22 +20,25 @@ namespace api {
using namespace oai::amf::model; using namespace oai::amf::model;
IndividualSubscriptionDocumentApiImpl::IndividualSubscriptionDocumentApiImpl( IndividualSubscriptionDocumentApiImpl::IndividualSubscriptionDocumentApiImpl(
const std::shared_ptr<Pistache::Rest::Router>& rtr, std::shared_ptr<Pistache::Rest::Router> rtr,
amf_application::amf_app* amf_app_inst) amf_application::amf_app* amf_app_inst)
: IndividualSubscriptionDocumentApi(rtr), m_amf_app(amf_app_inst) {} : IndividualSubscriptionDocumentApi(rtr), m_amf_app(amf_app_inst) {}
void IndividualSubscriptionDocumentApiImpl::delete_subscription( void IndividualSubscriptionDocumentApiImpl::a_mf_status_change_subscribe_modfy(
const std::string& subscriptionId, const std::string& subscriptionId, const SubscriptionData& subscriptionData,
Pistache::Http::ResponseWriter& response) { Pistache::Http::ResponseWriter& response) {
response.send( response.send(
Pistache::Http::Code::Ok, "This API has not been implemented yet!\n"); Pistache::Http::Code::Ok,
"IndividualSubscriptionDocumentApiImpl::a_mf_status_change_subscribe_"
"modfy API has not been implemented yet!\n");
} }
void IndividualSubscriptionDocumentApiImpl::modify_subscription( void IndividualSubscriptionDocumentApiImpl::a_mf_status_change_un_subscribe(
const std::string& subscriptionId, const std::string& subscriptionId,
const AmfUpdateEventOptionItem& amfUpdateEventOptionItem,
Pistache::Http::ResponseWriter& response) { Pistache::Http::ResponseWriter& response) {
response.send( response.send(
Pistache::Http::Code::Ok, "This API has not been implemented yet!\n"); Pistache::Http::Code::Ok,
"IndividualSubscriptionDocumentApiImpl::a_mf_status_change_un_subscribe "
"API has not been implemented yet!\n");
} }
} // namespace api } // namespace api
......
/** /**
* Namf_EventExposure * Namf_Communication
* AMF Event Exposure Service © 2019, 3GPP Organizational Partners (ARIB, ATIS, * AMF Communication Service © 2019, 3GPP Organizational Partners (ARIB, ATIS,
* CCSA, ETSI, TSDSI, TTA, TTC). All rights reserved. * CCSA, ETSI, TSDSI, TTA, TTC). All rights reserved.
* *
* The version of the OpenAPI document: 1.1.0.alpha-1 * The version of the OpenAPI document: 1.1.0.alpha-1
...@@ -29,10 +29,8 @@ ...@@ -29,10 +29,8 @@
#include <pistache/optional.h> #include <pistache/optional.h>
#include "AmfUpdatedEventSubscription.h"
//#include "OneOfarrayAmfUpdateEventOptionItem.h"
#include "ProblemDetails.h" #include "ProblemDetails.h"
#include "AmfUpdateEventOptionItem.h" #include "SubscriptionData.h"
#include <string> #include <string>
#include "amf_app.hpp" #include "amf_app.hpp"
...@@ -42,22 +40,21 @@ namespace amf { ...@@ -42,22 +40,21 @@ namespace amf {
namespace api { namespace api {
using namespace oai::amf::model; using namespace oai::amf::model;
using namespace oai::amf::api;
class IndividualSubscriptionDocumentApiImpl class IndividualSubscriptionDocumentApiImpl
: public IndividualSubscriptionDocumentApi { : public oai::amf::api::IndividualSubscriptionDocumentApi {
public: public:
explicit IndividualSubscriptionDocumentApiImpl( IndividualSubscriptionDocumentApiImpl(
const std::shared_ptr<Pistache::Rest::Router>&, std::shared_ptr<Pistache::Rest::Router>,
amf_application::amf_app* amf_app_inst); amf_application::amf_app* amf_app_inst);
~IndividualSubscriptionDocumentApiImpl() override = default; ~IndividualSubscriptionDocumentApiImpl() {}
void delete_subscription( void a_mf_status_change_subscribe_modfy(
const std::string& subscriptionId, const std::string& subscriptionId,
const SubscriptionData& subscriptionData,
Pistache::Http::ResponseWriter& response); Pistache::Http::ResponseWriter& response);
void modify_subscription( void a_mf_status_change_un_subscribe(
const std::string& subscriptionId, const std::string& subscriptionId,
const AmfUpdateEventOptionItem& amfUpdateEventOptionItem,
Pistache::Http::ResponseWriter& response); Pistache::Http::ResponseWriter& response);
private: private:
......
/**
* Namf_EventExposure
* AMF Event Exposure 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.
*/
#include "IndividualSubscriptionDocumentApiImplEventExposure.h"
namespace oai {
namespace amf {
namespace api {
using namespace oai::amf::model;
IndividualSubscriptionDocumentApiImplEventExposure::
IndividualSubscriptionDocumentApiImplEventExposure(
const std::shared_ptr<Pistache::Rest::Router>& rtr,
amf_application::amf_app* amf_app_inst)
: IndividualSubscriptionDocumentApiEventExposure(rtr),
m_amf_app(amf_app_inst) {}
void IndividualSubscriptionDocumentApiImplEventExposure::delete_subscription(
const std::string& subscriptionId,
Pistache::Http::ResponseWriter& response) {
response.send(
Pistache::Http::Code::Ok, "This API has not been implemented yet!\n");
}
void IndividualSubscriptionDocumentApiImplEventExposure::modify_subscription(
const std::string& subscriptionId,
const AmfUpdateEventOptionItem& amfUpdateEventOptionItem,
Pistache::Http::ResponseWriter& response) {
response.send(
Pistache::Http::Code::Ok, "This API has not been implemented yet!\n");
}
} // namespace api
} // namespace amf
} // namespace oai
/**
* Namf_EventExposure
* AMF Event Exposure 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.
*/
/*
* IndividualSubscriptionDocumentApiImplEventExposure.h
*
*
*/
#ifndef INDIVIDUAL_SUBSCRIPTION_DOCUMENT_API_IMPL_EVENT_EXPOSURE_H_
#define INDIVIDUAL_SUBSCRIPTION_DOCUMENT_API_IMPL_EVENT_EXPOSURE_H_
#include <pistache/endpoint.h>
#include <pistache/http.h>
#include <pistache/router.h>
#include <memory>
#include <IndividualSubscriptionDocumentApiEventExposure.h>
#include <pistache/optional.h>
#include "AmfUpdatedEventSubscription.h"
//#include "OneOfarrayAmfUpdateEventOptionItem.h"
#include "ProblemDetails.h"
#include "AmfUpdateEventOptionItem.h"
#include <string>
#include "amf_app.hpp"
namespace oai {
namespace amf {
namespace api {
using namespace oai::amf::model;
using namespace oai::amf::api;
class IndividualSubscriptionDocumentApiImplEventExposure
: public IndividualSubscriptionDocumentApiEventExposure {
public:
explicit IndividualSubscriptionDocumentApiImplEventExposure(
const std::shared_ptr<Pistache::Rest::Router>&,
amf_application::amf_app* amf_app_inst);
~IndividualSubscriptionDocumentApiImplEventExposure() override = default;
void delete_subscription(
const std::string& subscriptionId,
Pistache::Http::ResponseWriter& response);
void modify_subscription(
const std::string& subscriptionId,
const AmfUpdateEventOptionItem& amfUpdateEventOptionItem,
Pistache::Http::ResponseWriter& response);
private:
amf_application::amf_app* m_amf_app;
};
} // namespace api
} // namespace amf
} // namespace oai
#endif
...@@ -21,8 +21,10 @@ using namespace oai::amf::model; ...@@ -21,8 +21,10 @@ using namespace oai::amf::model;
SubscriptionsCollectionDocumentApiImplEventExposure:: SubscriptionsCollectionDocumentApiImplEventExposure::
SubscriptionsCollectionDocumentApiImplEventExposure( SubscriptionsCollectionDocumentApiImplEventExposure(
const std::shared_ptr<Pistache::Rest::Router>& rtr) const std::shared_ptr<Pistache::Rest::Router>& rtr,
: SubscriptionsCollectionDocumentApiEventExposure(rtr) {} amf_application::amf_app* amf_app_inst)
: SubscriptionsCollectionDocumentApiEventExposure(rtr),
m_amf_app(amf_app_inst) {}
void SubscriptionsCollectionDocumentApiImplEventExposure::create_subscription( void SubscriptionsCollectionDocumentApiImplEventExposure::create_subscription(
const AmfCreateEventSubscription& amfCreateEventSubscription, const AmfCreateEventSubscription& amfCreateEventSubscription,
......
...@@ -32,21 +32,27 @@ ...@@ -32,21 +32,27 @@
#include "AmfCreateEventSubscription.h" #include "AmfCreateEventSubscription.h"
#include "AmfCreatedEventSubscription.h" #include "AmfCreatedEventSubscription.h"
#include "ProblemDetails.h" #include "ProblemDetails.h"
#include "amf_app.hpp"
namespace oai::amf::api { namespace oai::amf::api {
using namespace oai::amf::model; using namespace oai::amf::model;
using namespace oai::amf::api;
class SubscriptionsCollectionDocumentApiImplEventExposure class SubscriptionsCollectionDocumentApiImplEventExposure
: public SubscriptionsCollectionDocumentApiEventExposure { : public SubscriptionsCollectionDocumentApiEventExposure {
public: public:
explicit SubscriptionsCollectionDocumentApiImplEventExposure( explicit SubscriptionsCollectionDocumentApiImplEventExposure(
const std::shared_ptr<Pistache::Rest::Router>& rtr); const std::shared_ptr<Pistache::Rest::Router>& rtr,
amf_application::amf_app* amf_app_inst);
~SubscriptionsCollectionDocumentApiImplEventExposure() override = default; ~SubscriptionsCollectionDocumentApiImplEventExposure() override = default;
void create_subscription( void create_subscription(
const AmfCreateEventSubscription& amfCreateEventSubscription, const AmfCreateEventSubscription& amfCreateEventSubscription,
Pistache::Http::ResponseWriter& response); Pistache::Http::ResponseWriter& response);
private:
amf_application::amf_app* m_amf_app;
}; };
} // namespace oai::amf::api } // namespace oai::amf::api
......
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