Commit 227a585c authored by Tien-Thinh Nguyen's avatar Tien-Thinh Nguyen

correct format for api-server

parent ad0ea94c
/**
* Nsmf_PDUSession
* SMF PDU Session 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.
*/
* Nsmf_PDUSession
* SMF PDU Session 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 "IndividualPDUSessionHSMFApi.h"
#include "Helpers.h"
......@@ -21,70 +21,70 @@ using namespace oai::smf_server::helpers;
using namespace oai::smf_server::model;
IndividualPDUSessionHSMFApi::IndividualPDUSessionHSMFApi(std::shared_ptr<Pistache::Rest::Router> rtr) {
router = rtr;
router = rtr;
}
void IndividualPDUSessionHSMFApi::init() {
setupRoutes();
setupRoutes();
}
void IndividualPDUSessionHSMFApi::setupRoutes() {
using namespace Pistache::Rest;
using namespace Pistache::Rest;
Routes::Post(*router, base + "/pdu-sessions/:pduSessionRef/release", Routes::bind(&IndividualPDUSessionHSMFApi::release_pdu_session_handler, this));
Routes::Post(*router, base + "/pdu-sessions/:pduSessionRef/modify", Routes::bind(&IndividualPDUSessionHSMFApi::update_pdu_session_handler, this));
Routes::Post(*router, base + "/pdu-sessions/:pduSessionRef/release", Routes::bind(&IndividualPDUSessionHSMFApi::release_pdu_session_handler, this));
Routes::Post(*router, base + "/pdu-sessions/:pduSessionRef/modify", Routes::bind(&IndividualPDUSessionHSMFApi::update_pdu_session_handler, this));
// Default handler, called when a route is not found
router->addCustomHandler(Routes::bind(&IndividualPDUSessionHSMFApi::individual_pdu_session_hsmf_api_default_handler, this));
// Default handler, called when a route is not found
router->addCustomHandler(Routes::bind(&IndividualPDUSessionHSMFApi::individual_pdu_session_hsmf_api_default_handler, this));
}
void IndividualPDUSessionHSMFApi::release_pdu_session_handler(const Pistache::Rest::Request &request, Pistache::Http::ResponseWriter response) {
// Getting the path params
auto pduSessionRef = request.param(":pduSessionRef").as<std::string>();
// Getting the body param
ReleaseData releaseData = {};
try {
nlohmann::json::parse(request.body()).get_to(releaseData);
this->release_pdu_session(pduSessionRef, releaseData, response);
} catch (nlohmann::detail::exception &e) {
//send a 400 error
response.send(Pistache::Http::Code::Bad_Request, e.what());
return;
} catch (std::exception &e) {
//send a 500 error
response.send(Pistache::Http::Code::Internal_Server_Error, e.what());
return;
}
// Getting the path params
auto pduSessionRef = request.param(":pduSessionRef").as<std::string>();
// Getting the body param
ReleaseData releaseData = {};
try {
nlohmann::json::parse(request.body()).get_to(releaseData);
this->release_pdu_session(pduSessionRef, releaseData, response);
} catch (nlohmann::detail::exception &e) {
//send a 400 error
response.send(Pistache::Http::Code::Bad_Request, e.what());
return;
} catch (std::exception &e) {
//send a 500 error
response.send(Pistache::Http::Code::Internal_Server_Error, e.what());
return;
}
}
void IndividualPDUSessionHSMFApi::update_pdu_session_handler(const Pistache::Rest::Request &request, Pistache::Http::ResponseWriter response) {
// Getting the path params
auto pduSessionRef = request.param(":pduSessionRef").as<std::string>();
// Getting the body param
HsmfUpdateData hsmfUpdateData = {};
try {
nlohmann::json::parse(request.body()).get_to(hsmfUpdateData);
this->update_pdu_session(pduSessionRef, hsmfUpdateData, response);
} catch (nlohmann::detail::exception &e) {
//send a 400 error
response.send(Pistache::Http::Code::Bad_Request, e.what());
return;
} catch (std::exception &e) {
//send a 500 error
response.send(Pistache::Http::Code::Internal_Server_Error, e.what());
return;
}
// Getting the path params
auto pduSessionRef = request.param(":pduSessionRef").as<std::string>();
// Getting the body param
HsmfUpdateData hsmfUpdateData = {};
try {
nlohmann::json::parse(request.body()).get_to(hsmfUpdateData);
this->update_pdu_session(pduSessionRef, hsmfUpdateData, response);
} catch (nlohmann::detail::exception &e) {
//send a 400 error
response.send(Pistache::Http::Code::Bad_Request, e.what());
return;
} catch (std::exception &e) {
//send a 500 error
response.send(Pistache::Http::Code::Internal_Server_Error, e.what());
return;
}
}
void IndividualPDUSessionHSMFApi::individual_pdu_session_hsmf_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");
}
}
......
/**
* Nsmf_PDUSession
* SMF PDU Session 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.
*/
* Nsmf_PDUSession
* SMF PDU Session 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.
*/
/*
* IndividualPDUSessionHSMFApi.h
*
......@@ -18,13 +18,11 @@
#ifndef IndividualPDUSessionHSMFApi_H_
#define IndividualPDUSessionHSMFApi_H_
#include <pistache/http.h>
#include <pistache/router.h>
#include <pistache/http_headers.h>
#include <pistache/optional.h>
#include "HsmfUpdateData.h"
#include "HsmfUpdateError.h"
#include "HsmfUpdatedData.h"
......@@ -38,42 +36,43 @@ namespace api {
using namespace oai::smf_server::model;
class IndividualPDUSessionHSMFApi {
public:
IndividualPDUSessionHSMFApi(std::shared_ptr<Pistache::Rest::Router>);
virtual ~IndividualPDUSessionHSMFApi() {}
void init();
const std::string base = "/nsmf-pdusession/v1";
private:
void setupRoutes();
void release_pdu_session_handler(const Pistache::Rest::Request &request, Pistache::Http::ResponseWriter response);
void update_pdu_session_handler(const Pistache::Rest::Request &request, Pistache::Http::ResponseWriter response);
void individual_pdu_session_hsmf_api_default_handler(const Pistache::Rest::Request &request, Pistache::Http::ResponseWriter response);
std::shared_ptr<Pistache::Rest::Router> router;
/// <summary>
/// Release
/// </summary>
/// <remarks>
///
/// </remarks>
/// <param name="pduSessionRef">PDU session reference</param>
/// <param name="releaseData">representation of the data to be sent to H-SMF when releasing the PDU session (optional)</param>
virtual void release_pdu_session(const std::string &pduSessionRef, const ReleaseData &releaseData, Pistache::Http::ResponseWriter &response) = 0;
/// <summary>
/// Update (initiated by V-SMF)
/// </summary>
/// <remarks>
///
/// </remarks>
/// <param name="pduSessionRef">PDU session reference</param>
/// <param name="hsmfUpdateData">representation of the updates to apply to the PDU session</param>
virtual void update_pdu_session(const std::string &pduSessionRef, const HsmfUpdateData &hsmfUpdateData, Pistache::Http::ResponseWriter &response) = 0;
class IndividualPDUSessionHSMFApi {
public:
IndividualPDUSessionHSMFApi(std::shared_ptr<Pistache::Rest::Router>);
virtual ~IndividualPDUSessionHSMFApi() {
}
void init();
const std::string base = "/nsmf-pdusession/v1";
private:
void setupRoutes();
void release_pdu_session_handler(const Pistache::Rest::Request &request, Pistache::Http::ResponseWriter response);
void update_pdu_session_handler(const Pistache::Rest::Request &request, Pistache::Http::ResponseWriter response);
void individual_pdu_session_hsmf_api_default_handler(const Pistache::Rest::Request &request, Pistache::Http::ResponseWriter response);
std::shared_ptr<Pistache::Rest::Router> router;
/// <summary>
/// Release
/// </summary>
/// <remarks>
///
/// </remarks>
/// <param name="pduSessionRef">PDU session reference</param>
/// <param name="releaseData">representation of the data to be sent to H-SMF when releasing the PDU session (optional)</param>
virtual void release_pdu_session(const std::string &pduSessionRef, const ReleaseData &releaseData, Pistache::Http::ResponseWriter &response) = 0;
/// <summary>
/// Update (initiated by V-SMF)
/// </summary>
/// <remarks>
///
/// </remarks>
/// <param name="pduSessionRef">PDU session reference</param>
/// <param name="hsmfUpdateData">representation of the updates to apply to the PDU session</param>
virtual void update_pdu_session(const std::string &pduSessionRef, const HsmfUpdateData &hsmfUpdateData, Pistache::Http::ResponseWriter &response) = 0;
};
......
/**
* Nsmf_PDUSession
* SMF PDU Session 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.
*/
* Nsmf_PDUSession
* SMF PDU Session 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.
*/
/*
* IndividualSMContextApi.h
*
*
*/
/*
* Licensed to the OpenAirInterface (OAI) Software Alliance under one or more
* contributor license agreements. See the NOTICE file distributed with
......@@ -37,17 +36,14 @@
* contact@openairinterface.org
*/
#ifndef IndividualSMContextApi_H_
#define IndividualSMContextApi_H_
#include <pistache/http.h>
#include <pistache/router.h>
#include <pistache/http_headers.h>
#include <pistache/optional.h>
#include "ProblemDetails.h"
#include "SmContextReleaseData.h"
#include "SmContextRetrieveData.h"
......@@ -62,60 +58,60 @@
#include "SmContextCreateError.h"
#include "SmContextCreatedData.h"
namespace oai {
namespace smf_server {
namespace api {
using namespace oai::smf_server::model;
class IndividualSMContextApi {
public:
IndividualSMContextApi(std::shared_ptr<Pistache::Rest::Router>);
virtual ~IndividualSMContextApi() {}
void init();
const std::string base = "/nsmf-pdusession/v2";
private:
void setupRoutes();
void release_sm_context_handler(const Pistache::Rest::Request &request, Pistache::Http::ResponseWriter response);
void retrieve_sm_context_handler(const Pistache::Rest::Request &request, Pistache::Http::ResponseWriter response);
void update_sm_context_handler(const Pistache::Rest::Request &request, Pistache::Http::ResponseWriter response);
void individual_sm_context_api_default_handler(const Pistache::Rest::Request &request, Pistache::Http::ResponseWriter response);
std::shared_ptr<Pistache::Rest::Router> router;
/// <summary>
/// Release SM Context
/// </summary>
/// <remarks>
///
/// </remarks>
/// <param name="smContextRef">SM context reference</param>
/// <param name="smContextReleaseData">representation of the data to be sent to the SMF when releasing the SM context (optional)</param>
virtual void release_sm_context(const std::string &smContextRef, const SmContextReleaseMessage &smContextReleaseMessage, Pistache::Http::ResponseWriter &response) = 0;
/// <summary>
/// Retrieve SM Context
/// </summary>
/// <remarks>
///
/// </remarks>
/// <param name="smContextRef">SM context reference</param>
/// <param name="smContextRetrieveData">parameters used to retrieve the SM context (optional)</param>
virtual void retrieve_sm_context(const std::string &smContextRef, const SmContextRetrieveData &smContextRetrieveData, Pistache::Http::ResponseWriter &response) = 0;
/// <summary>
/// Update SM Context
/// </summary>
/// <remarks>
///
/// </remarks>
/// <param name="smContextRef">SM context reference</param>
/// <param name="smContextUpdateData">representation of the updates to apply to the SM context</param>
virtual void update_sm_context(const std::string &smContextRef, const SmContextUpdateMessage &smContextUpdateMessage, Pistache::Http::ResponseWriter &response) = 0;
class IndividualSMContextApi {
public:
IndividualSMContextApi(std::shared_ptr<Pistache::Rest::Router>);
virtual ~IndividualSMContextApi() {
}
void init();
const std::string base = "/nsmf-pdusession/v2";
private:
void setupRoutes();
void release_sm_context_handler(const Pistache::Rest::Request &request, Pistache::Http::ResponseWriter response);
void retrieve_sm_context_handler(const Pistache::Rest::Request &request, Pistache::Http::ResponseWriter response);
void update_sm_context_handler(const Pistache::Rest::Request &request, Pistache::Http::ResponseWriter response);
void individual_sm_context_api_default_handler(const Pistache::Rest::Request &request, Pistache::Http::ResponseWriter response);
std::shared_ptr<Pistache::Rest::Router> router;
/// <summary>
/// Release SM Context
/// </summary>
/// <remarks>
///
/// </remarks>
/// <param name="smContextRef">SM context reference</param>
/// <param name="smContextReleaseData">representation of the data to be sent to the SMF when releasing the SM context (optional)</param>
virtual void release_sm_context(const std::string &smContextRef, const SmContextReleaseMessage &smContextReleaseMessage, Pistache::Http::ResponseWriter &response) = 0;
/// <summary>
/// Retrieve SM Context
/// </summary>
/// <remarks>
///
/// </remarks>
/// <param name="smContextRef">SM context reference</param>
/// <param name="smContextRetrieveData">parameters used to retrieve the SM context (optional)</param>
virtual void retrieve_sm_context(const std::string &smContextRef, const SmContextRetrieveData &smContextRetrieveData, Pistache::Http::ResponseWriter &response) = 0;
/// <summary>
/// Update SM Context
/// </summary>
/// <remarks>
///
/// </remarks>
/// <param name="smContextRef">SM context reference</param>
/// <param name="smContextUpdateData">representation of the updates to apply to the SM context</param>
virtual void update_sm_context(const std::string &smContextRef, const SmContextUpdateMessage &smContextUpdateMessage, Pistache::Http::ResponseWriter &response) = 0;
};
......
/**
* Nsmf_PDUSession
* SMF PDU Session 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.
*/
* Nsmf_PDUSession
* SMF PDU Session 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 "PDUSessionsCollectionApi.h"
#include "Helpers.h"
......@@ -20,46 +20,46 @@ namespace api {
using namespace oai::smf_server::helpers;
using namespace oai::smf_server::model;
PDUSessionsCollectionApi::PDUSessionsCollectionApi(std::shared_ptr<Pistache::Rest::Router> rtr) {
router = rtr;
PDUSessionsCollectionApi::PDUSessionsCollectionApi(std::shared_ptr<Pistache::Rest::Router> rtr) {
router = rtr;
}
void PDUSessionsCollectionApi::init() {
setupRoutes();
setupRoutes();
}
void PDUSessionsCollectionApi::setupRoutes() {
using namespace Pistache::Rest;
using namespace Pistache::Rest;
Routes::Post(*router, base + "/pdu-sessions", Routes::bind(&PDUSessionsCollectionApi::post_pdu_sessions_handler, this));
Routes::Post(*router, base + "/pdu-sessions", Routes::bind(&PDUSessionsCollectionApi::post_pdu_sessions_handler, this));
// Default handler, called when a route is not found
router->addCustomHandler(Routes::bind(&PDUSessionsCollectionApi::pdu_sessions_collection_api_default_handler, this));
// Default handler, called when a route is not found
router->addCustomHandler(Routes::bind(&PDUSessionsCollectionApi::pdu_sessions_collection_api_default_handler, this));
}
void PDUSessionsCollectionApi::post_pdu_sessions_handler(const Pistache::Rest::Request &request, Pistache::Http::ResponseWriter response) {
// Getting the body param
PduSessionCreateData pduSessionCreateData;
try {
nlohmann::json::parse(request.body()).get_to(pduSessionCreateData);
this->post_pdu_sessions(pduSessionCreateData, response);
} catch (nlohmann::detail::exception &e) {
//send a 400 error
response.send(Pistache::Http::Code::Bad_Request, e.what());
return;
} catch (std::exception &e) {
//send a 500 error
response.send(Pistache::Http::Code::Internal_Server_Error, e.what());
return;
}
// Getting the body param
PduSessionCreateData pduSessionCreateData;
try {
nlohmann::json::parse(request.body()).get_to(pduSessionCreateData);
this->post_pdu_sessions(pduSessionCreateData, response);
} catch (nlohmann::detail::exception &e) {
//send a 400 error
response.send(Pistache::Http::Code::Bad_Request, e.what());
return;
} catch (std::exception &e) {
//send a 500 error
response.send(Pistache::Http::Code::Internal_Server_Error, e.what());
return;
}
}
void PDUSessionsCollectionApi::pdu_sessions_collection_api_default_handler(const Pistache::Rest::Request &, Pistache::Http::ResponseWriter response) {
response.send(Pistache::Http::Code::Not_Found, "The requested method does not exist");
void PDUSessionsCollectionApi::pdu_sessions_collection_api_default_handler(const Pistache::Rest::Request&, Pistache::Http::ResponseWriter response) {
response.send(Pistache::Http::Code::Not_Found, "The requested method does not exist");
}
}
......
/**
* Nsmf_PDUSession
* SMF PDU Session 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.
*/
* Nsmf_PDUSession
* SMF PDU Session 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.
*/
/*
* PDUSessionsCollectionApi.h
*
......@@ -18,13 +18,11 @@
#ifndef PDUSessionsCollectionApi_H_
#define PDUSessionsCollectionApi_H_
#include <pistache/http.h>
#include <pistache/router.h>
#include <pistache/http_headers.h>
#include <pistache/optional.h>
#include "PduSessionCreateData.h"
#include "PduSessionCreateError.h"
#include "PduSessionCreatedData.h"
......@@ -36,30 +34,31 @@ namespace api {
using namespace oai::smf_server::model;
class PDUSessionsCollectionApi {
public:
PDUSessionsCollectionApi(std::shared_ptr<Pistache::Rest::Router>);
virtual ~PDUSessionsCollectionApi() {}
void init();
class PDUSessionsCollectionApi {
public:
PDUSessionsCollectionApi(std::shared_ptr<Pistache::Rest::Router>);
virtual ~PDUSessionsCollectionApi() {
}
void init();
const std::string base = "/nsmf-pdusession/v1";
const std::string base = "/nsmf-pdusession/v1";
private:
void setupRoutes();
private:
void setupRoutes();
void post_pdu_sessions_handler(const Pistache::Rest::Request &request, Pistache::Http::ResponseWriter response);
void pdu_sessions_collection_api_default_handler(const Pistache::Rest::Request &request, Pistache::Http::ResponseWriter response);
void post_pdu_sessions_handler(const Pistache::Rest::Request &request, Pistache::Http::ResponseWriter response);
void pdu_sessions_collection_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;
/// <summary>
/// Create
/// </summary>
/// <remarks>
///
/// </remarks>
/// <param name="pduSessionCreateData">representation of the PDU session to be created in the H-SMF</param>
virtual void post_pdu_sessions(const PduSessionCreateData &pduSessionCreateData, Pistache::Http::ResponseWriter &response) = 0;
/// <summary>
/// Create
/// </summary>
/// <remarks>
///
/// </remarks>
/// <param name="pduSessionCreateData">representation of the PDU session to be created in the H-SMF</param>
virtual void post_pdu_sessions(const PduSessionCreateData &pduSessionCreateData, Pistache::Http::ResponseWriter &response) = 0;
};
......
......@@ -98,9 +98,9 @@ void SMContextsCollectionApi::post_sm_contexts_handler(const Pistache::Rest::Req
init_globals();
multipartparser_init(&parser, reinterpret_cast<const char*>(boundary_str.c_str()));
if ((multipartparser_execute(&parser, &g_callbacks, request.body().c_str(), strlen(request.body().c_str())) != strlen(request.body().c_str())) or (!g_body_begin_called)){
Logger::smf_api_server().warn("The received message can not be parsed properly!");
//TODO: fix this issue
//response.send(Pistache::Http::Code::Bad_Request, "");
Logger::smf_api_server().warn("The received message can not be parsed properly!");
//TODO: fix this issue
//response.send(Pistache::Http::Code::Bad_Request, "");
//return;
}
......@@ -128,8 +128,8 @@ void SMContextsCollectionApi::post_sm_contexts_handler(const Pistache::Rest::Req
this->post_sm_contexts(smContextMessage, response);
} catch (nlohmann::detail::exception &e) {
//send a 400 error
Logger::smf_api_server().warn("Can not parse the json data (error: %s)!", e.what());
response.send(Pistache::Http::Code::Bad_Request, e.what());
Logger::smf_api_server().warn("Can not parse the json data (error: %s)!", e.what());
response.send(Pistache::Http::Code::Bad_Request, e.what());
return;
} catch (std::exception &e) {
//send a 500 error
......
/**
* Nsmf_PDUSession
* SMF PDU Session 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.
*/
* Nsmf_PDUSession
* SMF PDU Session 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.
*/
/*
* SMContextsCollectionApi.h
*
......@@ -59,29 +59,29 @@ namespace api {
using namespace oai::smf_server::model;
class SMContextsCollectionApi {
public:
SMContextsCollectionApi(std::shared_ptr<Pistache::Rest::Router>);
virtual ~SMContextsCollectionApi() {}
void init();
public:
SMContextsCollectionApi(std::shared_ptr<Pistache::Rest::Router>);
virtual ~SMContextsCollectionApi() {}
void init();
const std::string base = "/nsmf-pdusession/v2";
const std::string base = "/nsmf-pdusession/v2";
private:
void setupRoutes();
private:
void setupRoutes();
void post_sm_contexts_handler(const Pistache::Rest::Request &request, Pistache::Http::ResponseWriter response);
void sm_contexts_collection_api_default_handler(const Pistache::Rest::Request &request, Pistache::Http::ResponseWriter response);
void post_sm_contexts_handler(const Pistache::Rest::Request &request, Pistache::Http::ResponseWriter response);
void sm_contexts_collection_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;
/// <summary>
/// Create SM Context
/// </summary>
/// <remarks>
///
/// </remarks>
/// <param name="smContextMessage"></param>
virtual void post_sm_contexts(const SmContextMessage &smContextMessage, Pistache::Http::ResponseWriter &response) = 0;
/// <summary>
/// Create SM Context
/// </summary>
/// <remarks>
///
/// </remarks>
/// <param name="smContextMessage"></param>
virtual void post_sm_contexts(const SmContextMessage &smContextMessage, Pistache::Http::ResponseWriter &response) = 0;
};
......
/**
* Nsmf_PDUSession
* SMF PDU Session 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.
*/
* Nsmf_PDUSession
* SMF PDU Session 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 "IndividualPDUSessionHSMFApiImpl.h"
......@@ -19,16 +19,19 @@ namespace api {
using namespace oai::smf_server::model;
IndividualPDUSessionHSMFApiImpl::IndividualPDUSessionHSMFApiImpl(std::shared_ptr<Pistache::Rest::Router> rtr, smf::smf_app *smf_app_inst, std::string address)
: IndividualPDUSessionHSMFApi(rtr), m_smf_app(smf_app_inst), m_address(address)
{ }
:
IndividualPDUSessionHSMFApi(rtr),
m_smf_app(smf_app_inst),
m_address(address) {
}
void IndividualPDUSessionHSMFApiImpl::release_pdu_session(const std::string &pduSessionRef, const ReleaseData &releaseData, Pistache::Http::ResponseWriter &response) {
Logger::smf_api_server().info("release_pdu_session...");
response.send(Pistache::Http::Code::Ok, "Release_pdu_session API has not been implemented yet!\n");
Logger::smf_api_server().info("release_pdu_session...");
response.send(Pistache::Http::Code::Ok, "Release_pdu_session API has not been implemented yet!\n");
}
void IndividualPDUSessionHSMFApiImpl::update_pdu_session(const std::string &pduSessionRef, const HsmfUpdateData &hsmfUpdateData, Pistache::Http::ResponseWriter &response) {
Logger::smf_api_server().info("update_pdu_session...");
response.send(Pistache::Http::Code::Ok, "Update_pdu_session API has not been implemented yet!\n");
Logger::smf_api_server().info("update_pdu_session...");
response.send(Pistache::Http::Code::Ok, "Update_pdu_session API has not been implemented yet!\n");
}
}
......
/**
* Nsmf_PDUSession
* SMF PDU Session 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.
*/
* Nsmf_PDUSession
* SMF PDU Session 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.
*/
/*
* IndividualPDUSessionHSMFApiImpl.h
*
*
*/
* IndividualPDUSessionHSMFApiImpl.h
*
*
*/
#ifndef INDIVIDUAL_PDU_SESSION_HSMF_API_IMPL_H_
#define INDIVIDUAL_PDU_SESSION_HSMF_API_IMPL_H_
#include <pistache/endpoint.h>
#include <pistache/http.h>
#include <pistache/router.h>
......@@ -44,21 +43,20 @@ namespace api {
using namespace oai::smf_server::model;
class IndividualPDUSessionHSMFApiImpl : public oai::smf_server::api::IndividualPDUSessionHSMFApi {
public:
IndividualPDUSessionHSMFApiImpl(std::shared_ptr<Pistache::Rest::Router>, smf::smf_app *smf_app_inst, std::string address);
~IndividualPDUSessionHSMFApiImpl() {}
void release_pdu_session(const std::string &pduSessionRef, const ReleaseData &releaseData, Pistache::Http::ResponseWriter &response);
void update_pdu_session(const std::string &pduSessionRef, const HsmfUpdateData &hsmfUpdateData, Pistache::Http::ResponseWriter &response);
private:
smf::smf_app *m_smf_app;
std::string m_address;
public:
IndividualPDUSessionHSMFApiImpl(std::shared_ptr<Pistache::Rest::Router>, smf::smf_app *smf_app_inst, std::string address);
~IndividualPDUSessionHSMFApiImpl() {
}
void release_pdu_session(const std::string &pduSessionRef, const ReleaseData &releaseData, Pistache::Http::ResponseWriter &response);
void update_pdu_session(const std::string &pduSessionRef, const HsmfUpdateData &hsmfUpdateData, Pistache::Http::ResponseWriter &response);
private:
smf::smf_app *m_smf_app;
std::string m_address;
};
}
}
}
#endif
......@@ -31,7 +31,6 @@
* contact@openairinterface.org
*/
#include "IndividualSMContextApiImpl.h"
namespace oai {
......@@ -40,9 +39,12 @@ namespace api {
using namespace oai::smf_server::model;
IndividualSMContextApiImpl::IndividualSMContextApiImpl(std::shared_ptr<Pistache::Rest::Router> rtr, smf::smf_app *smf_app_inst, std::string address)
: IndividualSMContextApi(rtr), m_smf_app(smf_app_inst), m_address(address)
{ }
IndividualSMContextApiImpl::IndividualSMContextApiImpl(std::shared_ptr<Pistache::Rest::Router> rtr, smf::smf_app *smf_app_inst, std::string address)
:
IndividualSMContextApi(rtr),
m_smf_app(smf_app_inst),
m_address(address) {
}
void IndividualSMContextApiImpl::release_sm_context(const std::string &smContextRef, const SmContextReleaseMessage &smContextReleaseMessage, Pistache::Http::ResponseWriter &response) {
......@@ -52,11 +54,11 @@ void IndividualSMContextApiImpl::release_sm_context(const std::string &smContext
//handle Nsmf_PDUSession_UpdateSMContext Request
Logger::smf_api_server().info("Received a PDUSession_UpdateSMContext Request: PDU Session Release request from AMF.");
//Get the SmContextUpdateData from this message and process in smf_app
smf::pdu_session_update_sm_context_request sm_context_req_msg = {};
smf::pdu_session_update_sm_context_request sm_context_req_msg = { };
SmContextReleaseData smContextReleaseData = smContextReleaseMessage.getJsonData();
if (smContextReleaseData.n2SmInfoIsSet()){
if (smContextReleaseData.n2SmInfoIsSet()) {
//N2 SM (for Session establishment)
std::string n2_sm_information = smContextReleaseMessage.getBinaryDataN2SmInformation();
//std::string n2_sm_information = (smContextUpdateData.getN2SmInfo()).getContentId();
......@@ -87,10 +89,10 @@ void IndividualSMContextApiImpl::update_sm_context(const std::string &smContextR
//Get the SmContextUpdateData from this message and process in smf_app
Logger::smf_api_server().info("Received a PDUSession_UpdateSMContext Request from AMF.");
smf::pdu_session_update_sm_context_request sm_context_req_msg = {};
smf::pdu_session_update_sm_context_request sm_context_req_msg = { };
SmContextUpdateData smContextUpdateData = smContextUpdateMessage.getJsonData();
if (smContextUpdateData.n2SmInfoIsSet()){
if (smContextUpdateData.n2SmInfoIsSet()) {
//N2 SM (for Session establishment)
std::string n2_sm_information = smContextUpdateMessage.getBinaryDataN2SmInformation();
Logger::smf_api_server().debug("smContextMessage, n2 sm information %s", n2_sm_information.c_str());
......@@ -98,7 +100,7 @@ void IndividualSMContextApiImpl::update_sm_context(const std::string &smContextR
sm_context_req_msg.set_n2_sm_information(n2_sm_information);
sm_context_req_msg.set_n2_sm_info_type(n2_sm_info_type);
} else if (smContextUpdateData.n1SmMsgIsSet()){
} else if (smContextUpdateData.n1SmMsgIsSet()) {
//N1 SM (for session modification)
std::string n1_sm_message = smContextUpdateMessage.getBinaryDataN1SmMessage();
Logger::smf_api_server().debug("smContextMessage, n1 sm message %s", n1_sm_message.c_str());
......@@ -110,11 +112,14 @@ void IndividualSMContextApiImpl::update_sm_context(const std::string &smContextR
//Step 4: PDU Session IDs, Operation Type, UE location Info, Access Type, RAT Type, UE presence in LADN service area, Indication of Access Type can be changed
//PDU Session IDs
//UpCnxState, for activation of user plane (see 5.2.2.3.2.2@3GPP TS 29.502)
if(smContextUpdateData.upCnxStateIsSet()) sm_context_req_msg.set_upCnx_state(smContextUpdateData.getUpCnxState());
if (smContextUpdateData.upCnxStateIsSet())
sm_context_req_msg.set_upCnx_state(smContextUpdateData.getUpCnxState());
//Access Type
if (smContextUpdateData.anTypeIsSet()) sm_context_req_msg.set_an_type(smContextUpdateData.getAnType());
if (smContextUpdateData.anTypeIsSet())
sm_context_req_msg.set_an_type(smContextUpdateData.getAnType());
//RAT Type
if (smContextUpdateData.ratTypeIsSet()) sm_context_req_msg.set_rat_type(smContextUpdateData.getRatType());
if (smContextUpdateData.ratTypeIsSet())
sm_context_req_msg.set_rat_type(smContextUpdateData.getRatType());
//TODO:
//UE presence in LADN service area
//UE location information
......@@ -126,13 +131,11 @@ void IndividualSMContextApiImpl::update_sm_context(const std::string &smContextR
//TODO: Existing PDU session, step 3, SUPI, DNN, S-NSSAIs, SM Context ID, AMF ID, Request Type, N1 SM Container (PDU Session Establishment Request), User location, Access Type, RAT Type, PEI
//step 15. (SM Context ID -> SCID, N2 SM, Request Type)(Initial Request)
//TODO: verify why Request Type is not define in smContextUpdateData
/* PDU Session Modification (SM Context ID -> SCID, N1/N2), section 4.3.3.2@3GPP TS 23.502: */
//step 1.a,UE-initiated: SM Context ID + N1 (PDU Session Modification Request)
//step 1.e (AN initiated modification): SM Context ID, N2 SM information (QFI, User location Information and an indication that the QoS Flow is released)
//step 7a, SM Context ID, N2 SM information, UE location information
//Step 11, SM Context ID, N1 SM (PDU Session Modification Command ACK), User location
//Step 3. Handle the itti_n11_update_sm_context_request message in smf_app
std::shared_ptr<itti_n11_update_sm_context_request> itti_msg = std::make_shared<itti_n11_update_sm_context_request>(TASK_SMF_N11, TASK_SMF_APP, response, smContextRef);
itti_msg->req = sm_context_req_msg;
......
/**
* Nsmf_PDUSession
* SMF PDU Session 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.
*/
* Nsmf_PDUSession
* SMF PDU Session 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.
*/
/*
* IndividualSMContextApiImpl.h
*
*
*/
* IndividualSMContextApiImpl.h
*
*
*/
/*
* Licensed to the OpenAirInterface (OAI) Software Alliance under one or more
* contributor license agreements. See the NOTICE file distributed with
......@@ -39,7 +39,6 @@
#ifndef INDIVIDUAL_SM_CONTEXT_API_IMPL_H_
#define INDIVIDUAL_SM_CONTEXT_API_IMPL_H_
#include <pistache/endpoint.h>
#include <pistache/http.h>
#include <pistache/router.h>
......@@ -68,22 +67,21 @@ namespace api {
using namespace oai::smf_server::model;
class IndividualSMContextApiImpl : public oai::smf_server::api::IndividualSMContextApi {
public:
IndividualSMContextApiImpl(std::shared_ptr<Pistache::Rest::Router>, smf::smf_app *smf_app_inst, std::string address);
~IndividualSMContextApiImpl() {}
public:
IndividualSMContextApiImpl(std::shared_ptr<Pistache::Rest::Router>, smf::smf_app *smf_app_inst, std::string address);
~IndividualSMContextApiImpl() {
}
void release_sm_context(const std::string &smContextRef, const SmContextReleaseMessage &smContextReleaseMessage, Pistache::Http::ResponseWriter &response);
void retrieve_sm_context(const std::string &smContextRef, const SmContextRetrieveData &smContextRetrieveData, Pistache::Http::ResponseWriter &response);
void update_sm_context(const std::string &smContextRef, const SmContextUpdateMessage &smContextUpdateMessage, Pistache::Http::ResponseWriter &response);
private:
smf::smf_app *m_smf_app;
std::string m_address;
void release_sm_context(const std::string &smContextRef, const SmContextReleaseMessage &smContextReleaseMessage, Pistache::Http::ResponseWriter &response);
void retrieve_sm_context(const std::string &smContextRef, const SmContextRetrieveData &smContextRetrieveData, Pistache::Http::ResponseWriter &response);
void update_sm_context(const std::string &smContextRef, const SmContextUpdateMessage &smContextUpdateMessage, Pistache::Http::ResponseWriter &response);
private:
smf::smf_app *m_smf_app;
std::string m_address;
};
}
}
}
#endif
/**
* Nsmf_PDUSession
* SMF PDU Session 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.
*/
* Nsmf_PDUSession
* SMF PDU Session 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 "PDUSessionsCollectionApiImpl.h"
......@@ -19,12 +19,15 @@ namespace api {
using namespace oai::smf_server::model;
PDUSessionsCollectionApiImpl::PDUSessionsCollectionApiImpl(std::shared_ptr<Pistache::Rest::Router> rtr, smf::smf_app *smf_app_inst, std::string address)
: PDUSessionsCollectionApi(rtr), m_smf_app(smf_app_inst), m_address(address)
{ }
:
PDUSessionsCollectionApi(rtr),
m_smf_app(smf_app_inst),
m_address(address) {
}
void PDUSessionsCollectionApiImpl::post_pdu_sessions(const PduSessionCreateData &pduSessionCreateData, Pistache::Http::ResponseWriter &response) {
Logger::smf_api_server().info("post_pdu_sessions...");
response.send(Pistache::Http::Code::Ok, "Post_pdu_sessions API has not been implemented yet!\n");
Logger::smf_api_server().info("post_pdu_sessions...");
response.send(Pistache::Http::Code::Ok, "Post_pdu_sessions API has not been implemented yet!\n");
}
......
/**
* Nsmf_PDUSession
* SMF PDU Session 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.
*/
* Nsmf_PDUSession
* SMF PDU Session 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.
*/
/*
* PDUSessionsCollectionApiImpl.h
*
*
*/
* PDUSessionsCollectionApiImpl.h
*
*
*/
#ifndef PDU_SESSIONS_COLLECTION_API_IMPL_H_
#define PDU_SESSIONS_COLLECTION_API_IMPL_H_
#include <pistache/endpoint.h>
#include <pistache/http.h>
#include <pistache/router.h>
......@@ -42,20 +41,19 @@ namespace api {
using namespace oai::smf_server::model;
class PDUSessionsCollectionApiImpl : public oai::smf_server::api::PDUSessionsCollectionApi {
public:
PDUSessionsCollectionApiImpl(std::shared_ptr<Pistache::Rest::Router>, smf::smf_app *smf_app_inst, std::string address);
~PDUSessionsCollectionApiImpl() {}
void post_pdu_sessions(const PduSessionCreateData &pduSessionCreateData, Pistache::Http::ResponseWriter &response);
private:
smf::smf_app *m_smf_app;
std::string m_address;
public:
PDUSessionsCollectionApiImpl(std::shared_ptr<Pistache::Rest::Router>, smf::smf_app *smf_app_inst, std::string address);
~PDUSessionsCollectionApiImpl() {
}
void post_pdu_sessions(const PduSessionCreateData &pduSessionCreateData, Pistache::Http::ResponseWriter &response);
private:
smf::smf_app *m_smf_app;
std::string m_address;
};
}
}
}
#endif
......@@ -31,7 +31,6 @@
* contact@openairinterface.org
*/
#include "SMContextsCollectionApiImpl.h"
#include "logger.hpp"
#include "smf_msg.hpp"
......@@ -45,9 +44,13 @@ namespace api {
using namespace oai::smf_server::model;
SMContextsCollectionApiImpl::SMContextsCollectionApiImpl(std::shared_ptr<Pistache::Rest::Router> rtr, smf::smf_app *smf_app_inst, std::string address)
: SMContextsCollectionApi(rtr), m_smf_app(smf_app_inst), m_address(address)
:
SMContextsCollectionApi(rtr),
m_smf_app(smf_app_inst),
m_address(address)
{ }
{
}
void SMContextsCollectionApiImpl::post_sm_contexts(const SmContextMessage &smContextMessage, Pistache::Http::ResponseWriter &response) {
......@@ -61,11 +64,11 @@ void SMContextsCollectionApiImpl::post_sm_contexts(const SmContextMessage &smCon
std::string n1_sm_msg = smContextMessage.getBinaryDataN1SmMessage();
std::string n1_sm_msg_hex;
m_smf_app->convert_string_2_hex(n1_sm_msg, n1_sm_msg_hex);
Logger::smf_api_server().debug("smContextMessage, N1 SM message: %s",n1_sm_msg.c_str());
Logger::smf_api_server().debug("smContextMessage, N1 SM message: %s", n1_sm_msg.c_str());
//Step 2. Create a pdu_session_create_sm_context_request message and store the necessary information
Logger::smf_api_server().debug("Create a pdu_session_create_sm_context_request message and store the necessary information");
smf::pdu_session_create_sm_context_request sm_context_req_msg = {};
smf::pdu_session_create_sm_context_request sm_context_req_msg = { };
//set N1 SM Message
sm_context_req_msg.set_n1_sm_message(n1_sm_msg_hex);
......@@ -73,14 +76,14 @@ void SMContextsCollectionApiImpl::post_sm_contexts(const SmContextMessage &smCon
sm_context_req_msg.set_api_root(m_address + base + "/sm-contexts");
//supi
supi_t supi = {.length = 0};
supi_t supi = { .length = 0 };
std::size_t pos = smContextCreateData.getSupi().find("-");
std::string supi_str = smContextCreateData.getSupi().substr(pos +1);
std::string supi_str = smContextCreateData.getSupi().substr(pos + 1);
std::string supi_prefix = smContextCreateData.getSupi().substr(0, pos);
smf_string_to_supi(&supi, supi_str.c_str());
sm_context_req_msg.set_supi(supi);
sm_context_req_msg.set_supi_prefix(supi_prefix);
Logger::smf_api_server().debug("SmContextCreateData, supi %s, prefix %s, imsi %s", smContextCreateData.getSupi().c_str(), supi_prefix.c_str(), supi_str.c_str());
Logger::smf_api_server().debug("SmContextCreateData, supi %s, prefix %s, imsi %s", smContextCreateData.getSupi().c_str(), supi_prefix.c_str(), supi_str.c_str());
//dnn
Logger::smf_api_server().debug("SmContextCreateData, dnn %s", smContextCreateData.getDnn().c_str());
......@@ -97,7 +100,7 @@ void SMContextsCollectionApiImpl::post_sm_contexts(const SmContextMessage &smCon
//AMF ID (ServingNFId)
Logger::smf_api_server().debug("SmContextCreateDatea, ServingNfId %s", smContextCreateData.getServingNfId().c_str());
sm_context_req_msg.set_serving_nf_id(smContextCreateData.getServingNfId().c_str()); //TODO: should be verified that AMF ID is stored in GUAMI or ServingNfId
sm_context_req_msg.set_serving_nf_id(smContextCreateData.getServingNfId().c_str()); //TODO: should be verified that AMF ID is stored in GUAMI or ServingNfId
//Request Type
Logger::smf_api_server().debug("SmContextCreateData, RequestType %s", smContextCreateData.getRequestType().c_str());
......
/**
* Nsmf_PDUSession
* SMF PDU Session 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.
*/
* Nsmf_PDUSession
* SMF PDU Session 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.
*/
/*
* SMContextsCollectionApiImpl.h
*
*
*/
* SMContextsCollectionApiImpl.h
*
*
*/
/*
* Licensed to the OpenAirInterface (OAI) Software Alliance under one or more
* contributor license agreements. See the NOTICE file distributed with
......@@ -39,7 +39,6 @@
#ifndef SM_CONTEXTS_COLLECTION_API_IMPL_H_
#define SM_CONTEXTS_COLLECTION_API_IMPL_H_
#include <pistache/endpoint.h>
#include <pistache/http.h>
#include <pistache/router.h>
......@@ -62,20 +61,19 @@ namespace api {
using namespace oai::smf_server::model;
class SMContextsCollectionApiImpl : public oai::smf_server::api::SMContextsCollectionApi {
public:
SMContextsCollectionApiImpl(std::shared_ptr<Pistache::Rest::Router>, smf::smf_app *smf_app_inst, std::string address);
~SMContextsCollectionApiImpl() {}
public:
SMContextsCollectionApiImpl(std::shared_ptr<Pistache::Rest::Router>, smf::smf_app *smf_app_inst, std::string address);
~SMContextsCollectionApiImpl() {
}
void post_sm_contexts(const SmContextMessage &smContextMessage, Pistache::Http::ResponseWriter &response);
private:
smf::smf_app *m_smf_app;
std::string m_address;
void post_sm_contexts(const SmContextMessage &smContextMessage, Pistache::Http::ResponseWriter &response);
private:
smf::smf_app *m_smf_app;
std::string m_address;
};
}
}
}
#endif
/**
* RNI API
* The ETSI MEC ISG MEC012 Radio Network Information API described using OpenAPI
*
* OpenAPI spec version: 1.1.1
*
*
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
* Do not edit the class manually.
*/
* RNI API
* The ETSI MEC ISG MEC012 Radio Network Information API described using OpenAPI
*
* OpenAPI spec version: 1.1.1
*
*
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
* Do not edit the class manually.
*/
/*
* Licensed to the OpenAirInterface (OAI) Software Alliance under one or more
* contributor license agreements. See the NOTICE file distributed with
......@@ -43,69 +43,68 @@
#define PISTACHE_SERVER_MAX_PAYLOAD 32768
#ifdef __linux__
void sigHandler(int sig){
switch(sig){
case SIGINT:
case SIGQUIT:
case SIGTERM:
case SIGHUP:
default:
break;
}
exit(0);
void sigHandler(int sig) {
switch (sig) {
case SIGINT:
case SIGQUIT:
case SIGTERM:
case SIGHUP:
default:
break;
}
exit(0);
}
void setUpUnixSignals(std::vector<int> quitSignals) {
sigset_t blocking_mask;
sigemptyset(&blocking_mask);
for (auto sig : quitSignals)
sigaddset(&blocking_mask, sig);
sigset_t blocking_mask;
sigemptyset(&blocking_mask);
for (auto sig : quitSignals)
sigaddset(&blocking_mask, sig);
struct sigaction sa;
sa.sa_handler = sigHandler;
sa.sa_mask = blocking_mask;
sa.sa_flags = 0;
struct sigaction sa;
sa.sa_handler = sigHandler;
sa.sa_mask = blocking_mask;
sa.sa_flags = 0;
for (auto sig : quitSignals)
sigaction(sig, &sa, nullptr);
for (auto sig : quitSignals)
sigaction(sig, &sa, nullptr);
}
#endif
using namespace oai::smf_server::api;
void SMFApiServer::init(size_t thr) {
auto opts = Pistache::Http::Endpoint::options()
.threads(thr);
opts.flags(Pistache::Tcp::Options::ReuseAddr);
opts.maxPayload(PISTACHE_SERVER_MAX_PAYLOAD);
m_httpEndpoint->init(opts);
m_individualPDUSessionHSMFApiImpl->init();
m_individualSMContextApiImpl->init();
m_pduSessionsCollectionApiImpl->init();
m_smContextsCollectionApiImpl->init();
auto opts = Pistache::Http::Endpoint::options().threads(thr);
opts.flags(Pistache::Tcp::Options::ReuseAddr);
opts.maxPayload(PISTACHE_SERVER_MAX_PAYLOAD);
m_httpEndpoint->init(opts);
m_individualPDUSessionHSMFApiImpl->init();
m_individualSMContextApiImpl->init();
m_pduSessionsCollectionApiImpl->init();
m_smContextsCollectionApiImpl->init();
}
void SMFApiServer::start(){
m_httpEndpoint->setHandler(m_router->handler());
m_httpEndpoint->serve();
void SMFApiServer::start() {
m_httpEndpoint->setHandler(m_router->handler());
m_httpEndpoint->serve();
}
void SMFApiServer::shutdown(){
m_httpEndpoint->shutdown();
void SMFApiServer::shutdown() {
m_httpEndpoint->shutdown();
}
/*
int main() {
#ifdef __linux__
std::vector<int> sigs{SIGQUIT, SIGINT, SIGTERM, SIGHUP};
setUpUnixSignals(sigs);
#endif
int main() {
#ifdef __linux__
std::vector<int> sigs{SIGQUIT, SIGINT, SIGTERM, SIGHUP};
setUpUnixSignals(sigs);
#endif
Pistache::Address addr(Pistache::Ipv4::any(), Pistache::Port(8080));
SMFApiServer smfApiServer(addr);
smfApiServer.init(2);
smfApiServer.start();
smfApiServer.shutdown();
Pistache::Address addr(Pistache::Ipv4::any(), Pistache::Port(8080));
SMFApiServer smfApiServer(addr);
smfApiServer.init(2);
smfApiServer.start();
smfApiServer.shutdown();
}
*/
}
*/
/**
* RNI API
* The ETSI MEC ISG MEC012 Radio Network Information API described using OpenAPI
*
* OpenAPI spec version: 1.1.1
*
*
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
* Do not edit the class manually.
*/
* RNI API
* The ETSI MEC ISG MEC012 Radio Network Information API described using OpenAPI
*
* OpenAPI spec version: 1.1.1
*
*
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
* Do not edit the class manually.
*/
/*
* Licensed to the OpenAirInterface (OAI) Software Alliance under one or more
......@@ -31,7 +31,6 @@
* contact@openairinterface.org
*/
#include "pistache/endpoint.h"
#include "pistache/http.h"
#include "pistache/router.h"
......@@ -49,30 +48,30 @@
using namespace oai::smf_server::api;
class SMFApiServer {
public:
SMFApiServer(Pistache::Address address, smf::smf_app *smf_app_inst) : m_httpEndpoint(std::make_shared<Pistache::Http::Endpoint>(address)) {
m_router = std::make_shared<Pistache::Rest::Router>();
m_address = address.host() + ":"+ (address.port()).toString();
m_individualPDUSessionHSMFApiImpl = std::make_shared<IndividualPDUSessionHSMFApiImpl> (m_router, smf_app_inst, m_address);
m_individualSMContextApiImpl = std::make_shared<IndividualSMContextApiImpl> (m_router, smf_app_inst, m_address);
m_pduSessionsCollectionApiImpl = std::make_shared<PDUSessionsCollectionApiImpl> (m_router, smf_app_inst, m_address);
m_smContextsCollectionApiImpl = std::make_shared<SMContextsCollectionApiImpl> (m_router, smf_app_inst, m_address);
public:
SMFApiServer(Pistache::Address address, smf::smf_app *smf_app_inst)
:
m_httpEndpoint(std::make_shared<Pistache::Http::Endpoint>(address)) {
m_router = std::make_shared<Pistache::Rest::Router>();
m_address = address.host() + ":" + (address.port()).toString();
m_individualPDUSessionHSMFApiImpl = std::make_shared<IndividualPDUSessionHSMFApiImpl>(m_router, smf_app_inst, m_address);
m_individualSMContextApiImpl = std::make_shared<IndividualSMContextApiImpl>(m_router, smf_app_inst, m_address);
m_pduSessionsCollectionApiImpl = std::make_shared<PDUSessionsCollectionApiImpl>(m_router, smf_app_inst, m_address);
m_smContextsCollectionApiImpl = std::make_shared<SMContextsCollectionApiImpl>(m_router, smf_app_inst, m_address);
}
void init(size_t thr = 1);
void start();
void shutdown();
}
void init(size_t thr = 1);
void start();
void shutdown();
private:
std::shared_ptr<Pistache::Http::Endpoint> m_httpEndpoint;
std::shared_ptr<Pistache::Rest::Router> m_router;
std::shared_ptr<IndividualPDUSessionHSMFApiImpl> m_individualPDUSessionHSMFApiImpl;
std::shared_ptr <IndividualSMContextApiImpl> m_individualSMContextApiImpl;
std::shared_ptr <PDUSessionsCollectionApiImpl> m_pduSessionsCollectionApiImpl;
std::shared_ptr <SMContextsCollectionApiImpl> m_smContextsCollectionApiImpl;
std::string m_address;
private:
std::shared_ptr<Pistache::Http::Endpoint> m_httpEndpoint;
std::shared_ptr<Pistache::Rest::Router> m_router;
std::shared_ptr<IndividualPDUSessionHSMFApiImpl> m_individualPDUSessionHSMFApiImpl;
std::shared_ptr<IndividualSMContextApiImpl> m_individualSMContextApiImpl;
std::shared_ptr<PDUSessionsCollectionApiImpl> m_pduSessionsCollectionApiImpl;
std::shared_ptr<SMContextsCollectionApiImpl> m_smContextsCollectionApiImpl;
std::string m_address;
};
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