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

add AMF api-server for testing purpose

parent 19a39d92
openapi: 3.0.0
info:
version: '1.0.0'
title: 'NSSF NS Selection'
description: 'NSSF Network Slice Selection Service'
security:
- {}
- oAuth2Clientcredentials:
- nnssf-nsselection
servers:
- url: '{apiRoot}/nnssf-nsselection/v1'
variables:
apiRoot:
default: https://example.com
description: apiRoot as defined in subclause 4.4 of 3GPP TS 29.501
externalDocs:
description: 3GPP TS 29.531 V15.2.0; 5G System; Network Slice Selection Services; Stage 3
url: http://www.3gpp.org/ftp/Specs/archive/29_series/29.531/
paths:
/network-slice-information:
get:
summary: Retrieve the Network Slice Selection Information
tags:
- Network Slice Information (Document)
operationId: NSSelectionGet
parameters:
- name: nf-type
in: query
description: NF type of the NF service consumer
required: true
schema:
$ref: 'TS29510_Nnrf_NFManagement.yaml#/components/schemas/NFType'
- name: nf-id
in: query
description: NF Instance ID of the NF service consumer
required: true
schema:
$ref: 'TS29571_CommonData.yaml#/components/schemas/NfInstanceId'
- name: slice-info-request-for-registration
in: query
description: Requested network slice information during Registration procedure
content:
application/json:
schema:
$ref: '#/components/schemas/SliceInfoForRegistration'
- name: slice-info-request-for-pdu-session
in: query
description: Requested network slice information during PDU session establishment procedure
content:
application/json:
schema:
$ref: '#/components/schemas/SliceInfoForPDUSession'
- name: home-plmn-id
in: query
description: PLMN ID of the HPLMN
content:
application/json:
schema:
$ref: 'TS29571_CommonData.yaml#/components/schemas/PlmnId'
- name: tai
in: query
description: TAI of the UE
content:
application/json:
schema:
$ref: 'TS29571_CommonData.yaml#/components/schemas/Tai'
- name: supported-features
in: query
description: Features required to be supported by the NFs in the target slice instance
schema:
$ref: 'TS29571_CommonData.yaml#/components/schemas/SupportedFeatures'
responses:
'200':
description: OK (Successful Network Slice Selection)
content:
application/json:
schema:
$ref: '#/components/schemas/AuthorizedNetworkSliceInfo'
'400':
$ref: 'TS29571_CommonData.yaml#/components/responses/400'
'401':
$ref: 'TS29571_CommonData.yaml#/components/responses/401'
'403':
$ref: 'TS29571_CommonData.yaml#/components/responses/403'
'404':
$ref: 'TS29571_CommonData.yaml#/components/responses/404'
'406':
$ref: 'TS29571_CommonData.yaml#/components/responses/406'
'414':
$ref: 'TS29571_CommonData.yaml#/components/responses/414'
'429':
$ref: 'TS29571_CommonData.yaml#/components/responses/429'
'500':
$ref: 'TS29571_CommonData.yaml#/components/responses/500'
'503':
$ref: 'TS29571_CommonData.yaml#/components/responses/503'
default:
description: Unexpected error
components:
securitySchemes:
oAuth2ClientCredentials:
type: oauth2
flows:
clientCredentials:
tokenUrl: '{nrfApiRoot}/oauth2/token'
scopes:
nnssf-nsselection: Access to the Nnssf_NSSelection API
schemas:
AuthorizedNetworkSliceInfo:
type: object
properties:
allowedNssaiList:
type: array
items:
$ref: '#/components/schemas/AllowedNssai'
minItems: 1
configuredNssai:
type: array
items:
$ref: '#/components/schemas/ConfiguredSnssai'
minItems: 1
targetAmfSet:
type: string
candidateAmfList:
type: array
items:
$ref: 'TS29571_CommonData.yaml#/components/schemas/NfInstanceId'
minItems: 1
rejectedNssaiInPlmn:
type: array
items:
$ref: 'TS29571_CommonData.yaml#/components/schemas/Snssai'
minItems: 1
rejectedNssaiInTa:
type: array
items:
$ref: 'TS29571_CommonData.yaml#/components/schemas/Snssai'
minItems: 1
nsiInformation:
$ref: '#/components/schemas/NsiInformation'
supportedFeatures:
$ref: 'TS29571_CommonData.yaml#/components/schemas/SupportedFeatures'
nrfAmfSet:
$ref: 'TS29571_CommonData.yaml#/components/schemas/Uri'
SubscribedSnssai:
type: object
required:
- subscribedSnssai
properties:
subscribedSnssai:
$ref: 'TS29571_CommonData.yaml#/components/schemas/Snssai'
defaultIndication:
type: boolean
AllowedSnssai:
type: object
required:
- allowedSnssai
properties:
allowedSnssai:
$ref: 'TS29571_CommonData.yaml#/components/schemas/Snssai'
nsiInformationList:
type: array
items:
$ref: '#/components/schemas/NsiInformation'
minItems: 1
mappedHomeSnssai:
$ref: 'TS29571_CommonData.yaml#/components/schemas/Snssai'
AllowedNssai:
type: object
required:
- allowedSnssaiList
- accessType
properties:
allowedSnssaiList:
type: array
items:
$ref: '#/components/schemas/AllowedSnssai'
minItems: 1
accessType:
$ref: 'TS29571_CommonData.yaml#/components/schemas/AccessType'
NsiInformation:
type: object
required:
- nrfId
properties:
nrfId:
$ref: 'TS29571_CommonData.yaml#/components/schemas/Uri'
nsiId:
$ref: '#/components/schemas/NsiId'
MappingOfSnssai:
type: object
required:
- servingSnssai
- homeSnssai
properties:
servingSnssai:
$ref: 'TS29571_CommonData.yaml#/components/schemas/Snssai'
homeSnssai:
$ref: 'TS29571_CommonData.yaml#/components/schemas/Snssai'
SliceInfoForRegistration:
type: object
properties:
subscribedNssai:
type: array
items:
$ref: '#/components/schemas/SubscribedSnssai'
minItems: 1
allowedNssaiCurrentAccess:
$ref: '#/components/schemas/AllowedNssai'
allowedNssaiOtherAccess:
$ref: '#/components/schemas/AllowedNssai'
sNssaiForMapping:
type: array
items:
$ref: 'TS29571_CommonData.yaml#/components/schemas/Snssai'
minItems: 1
requestedNssai:
type: array
items:
$ref: 'TS29571_CommonData.yaml#/components/schemas/Snssai'
minItems: 1
defaultConfiguredSnssaiInd:
type: boolean
mappingOfNssai:
type: array
items:
$ref: '#/components/schemas/MappingOfSnssai'
minItems: 1
requestMapping:
type: boolean
SliceInfoForPDUSession:
type: object
required:
- sNssai
- roamingIndication
properties:
sNssai:
$ref: 'TS29571_CommonData.yaml#/components/schemas/Snssai'
roamingIndication:
$ref: '#/components/schemas/RoamingIndication'
homeSnssai:
$ref: 'TS29571_CommonData.yaml#/components/schemas/Snssai'
ConfiguredSnssai:
type: object
required:
- configuredSnssai
properties:
configuredSnssai:
$ref: 'TS29571_CommonData.yaml#/components/schemas/Snssai'
mappedHomeSnssai:
$ref: 'TS29571_CommonData.yaml#/components/schemas/Snssai'
RoamingIndication:
anyOf:
- type: string
enum:
- NON_ROAMING
- LOCAL_BREAKOUT
- HOME_ROUTED_ROAMING
- type: string
NsiId:
type: string
......@@ -1178,41 +1178,41 @@ components:
$ref: '#/components/schemas/Uinteger'
maxNumOfTAsForNotAllowedAreas:
$ref: '#/components/schemas/Uinteger'
allOf:
# allOf:
#
# 1st condition: restrictionType and areas attributes shall be either both absent
# or both present
#
- oneOf:
- not:
required: [ restrictionType ]
- required: [ areas ]
# - oneOf:
# - not:
# required: [ restrictionType ]
# - required: [ areas ]
#
# 2nd condition: if restrictionType takes value NOT_ALLOWED_AREAS,
# then maxNumOfTAs shall be absent
#
- anyOf:
- not:
required: [ restrictionType ]
properties:
restrictionType:
type: string
enum: [ NOT_ALLOWED_AREAS ]
- not:
required: [ maxNumOfTAs ]
# - anyOf:
# - not:
# required: [ restrictionType ]
# properties:
# restrictionType:
# type: string
# enum: [ NOT_ALLOWED_AREAS ]
# - not:
# required: [ maxNumOfTAs ]
#
# 3rd condition: if restrictionType takes value ALLOWED_AREAS,
# then maxNumOfTAsForNotAllowedAreas shall be absent
#
- anyOf:
- not:
required: [ restrictionType ]
properties:
restrictionType:
type: string
enum: [ ALLOWED_AREAS ]
- not:
required: [ maxNumOfTAsForNotAllowedAreas ]
# - anyOf:
# - not:
# required: [ restrictionType ]
# properties:
# restrictionType:
# type: string
# enum: [ ALLOWED_AREAS ]
# - not:
# required: [ maxNumOfTAsForNotAllowedAreas ]
PresenceInfo:
type: object
properties:
......
This diff is collapsed.
This diff is collapsed.
cmake_minimum_required (VERSION 3.2)
project(amf-api-server)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11 -pg -g3" )
include_directories(model)
include_directories(api)
include_directories(impl)
file(GLOB SRCS
${CMAKE_CURRENT_SOURCE_DIR}/api/*.cpp
${CMAKE_CURRENT_SOURCE_DIR}/impl/*.cpp
${CMAKE_CURRENT_SOURCE_DIR}/model/*.cpp
${CMAKE_CURRENT_SOURCE_DIR}/*.cpp
)
add_executable(${PROJECT_NAME} ${SRCS} )
#add_dependencies(${PROJECT_NAME} PISTACHE NLOHMANN)
target_link_libraries(${PROJECT_NAME} pistache pthread)
# REST API Server for Namf_Communication
## Overview
This API Server was generated by the [OpenAPI Generator](https://openapi-generator.tech) project.
It uses the [Pistache](https://github.com/oktal/pistache) Framework.
## Files organization
The Pistache C++ REST server generator creates three folders:
- `api`: This folder contains the handlers for each method specified in the OpenAPI definition. Every handler extracts
the path and body parameters (if any) from the requests and tries to parse and possibly validate them.
Once this step is completed, the main API class calls the corresponding abstract method that should be implemented
by the developer (a basic implementation is provided under the `impl` folder)
- `impl`: As written above, the implementation folder contains, for each API, the corresponding implementation class,
which extends the main API class and implements the abstract methods.
Every method receives the path and body parameters as constant reference variables and a reference to the response
object, that should be filled with the right response and sent at the end of the method with the command:
response.send(returnCode, responseBody, [mimeType])
- `model`: This folder contains the corresponding class for every object schema found in the OpenAPI specification.
The main folder contains also a file with a main that can be used to start the server.
Of course, is you should customize this file based on your needs
## Installation
First of all, you need to download and install the libraries listed [here](#libraries-required).
Once the libraries are installed, in order to compile and run the server please follow the steps below:
```bash
mkdir build
cd build
cmake ..
make
```
Once compiled run the server:
```bash
cd build
./api-server
```
## Libraries required
- [pistache](http://pistache.io/quickstart)
- [JSON for Modern C++](https://github.com/nlohmann/json/#integration): Please download the `json.hpp` file and
put it under the model/nlohmann folder
## Namespaces
oai.amf.api
oai.amf.model
/**
* 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 "pistache/endpoint.h"
#include "pistache/http.h"
#include "pistache/router.h"
#ifdef __linux__
#include <vector>
#include <signal.h>
#include <unistd.h>
#endif
#include "IndividualSubscriptionDocumentApiImpl.h"
#include "IndividualUeContextDocumentApiImpl.h"
#include "N1N2IndividualSubscriptionDocumentApiImpl.h"
#include "N1N2MessageCollectionDocumentApiImpl.h"
#include "N1N2SubscriptionsCollectionForIndividualUEContextsDocumentApiImpl.h"
#include "NonUEN2MessageNotificationIndividualSubscriptionDocumentApiImpl.h"
#include "NonUEN2MessagesCollectionDocumentApiImpl.h"
#include "NonUEN2MessagesSubscriptionsCollectionDocumentApiImpl.h"
#include "SubscriptionsCollectionDocumentApiImpl.h"
#define PISTACHE_SERVER_THREADS 2
#define PISTACHE_SERVER_MAX_PAYLOAD 32768
static Pistache::Http::Endpoint *httpEndpoint;
#ifdef __linux__
static void sigHandler(int sig){
switch(sig){
case SIGINT:
case SIGQUIT:
case SIGTERM:
case SIGHUP:
default:
httpEndpoint->shutdown();
break;
}
exit(0);
}
static void setUpUnixSignals(std::vector<int> quitSignals) {
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;
for (auto sig : quitSignals)
sigaction(sig, &sa, nullptr);
}
#endif
using namespace oai::amf::api;
int main() {
#ifdef __linux__
std::vector<int> sigs{SIGQUIT, SIGINT, SIGTERM, SIGHUP};
setUpUnixSignals(sigs);
#endif
Pistache::Address addr("172.16.1.106", Pistache::Port(8080));
httpEndpoint = new Pistache::Http::Endpoint((addr));
auto router = std::make_shared<Pistache::Rest::Router>();
auto opts = Pistache::Http::Endpoint::options()
.threads(PISTACHE_SERVER_THREADS);
opts.flags(Pistache::Tcp::Options::ReuseAddr);
opts.maxPayload(PISTACHE_SERVER_MAX_PAYLOAD);
httpEndpoint->init(opts);
IndividualSubscriptionDocumentApiImpl IndividualSubscriptionDocumentApiserver(router);
IndividualSubscriptionDocumentApiserver.init();
IndividualUeContextDocumentApiImpl IndividualUeContextDocumentApiserver(router);
IndividualUeContextDocumentApiserver.init();
N1N2IndividualSubscriptionDocumentApiImpl N1N2IndividualSubscriptionDocumentApiserver(router);
N1N2IndividualSubscriptionDocumentApiserver.init();
N1N2MessageCollectionDocumentApiImpl N1N2MessageCollectionDocumentApiserver(router);
N1N2MessageCollectionDocumentApiserver.init();
N1N2SubscriptionsCollectionForIndividualUEContextsDocumentApiImpl N1N2SubscriptionsCollectionForIndividualUEContextsDocumentApiserver(router);
N1N2SubscriptionsCollectionForIndividualUEContextsDocumentApiserver.init();
NonUEN2MessageNotificationIndividualSubscriptionDocumentApiImpl NonUEN2MessageNotificationIndividualSubscriptionDocumentApiserver(router);
NonUEN2MessageNotificationIndividualSubscriptionDocumentApiserver.init();
NonUEN2MessagesCollectionDocumentApiImpl NonUEN2MessagesCollectionDocumentApiserver(router);
NonUEN2MessagesCollectionDocumentApiserver.init();
NonUEN2MessagesSubscriptionsCollectionDocumentApiImpl NonUEN2MessagesSubscriptionsCollectionDocumentApiserver(router);
NonUEN2MessagesSubscriptionsCollectionDocumentApiserver.init();
SubscriptionsCollectionDocumentApiImpl SubscriptionsCollectionDocumentApiserver(router);
SubscriptionsCollectionDocumentApiserver.init();
httpEndpoint->setHandler(router->handler());
httpEndpoint->serve();
httpEndpoint->shutdown();
}
/**
* 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 "IndividualSubscriptionDocumentApi.h"
#include "Helpers.h"
namespace oai {
namespace amf {
namespace api {
using namespace org::openapitools::server::helpers;
using namespace oai::amf::model;
IndividualSubscriptionDocumentApi::IndividualSubscriptionDocumentApi(std::shared_ptr<Pistache::Rest::Router> rtr) {
router = rtr;
}
void IndividualSubscriptionDocumentApi::init() {
setupRoutes();
}
void IndividualSubscriptionDocumentApi::setupRoutes() {
using namespace Pistache::Rest;
Routes::Put(*router, base + "/subscriptions/:subscriptionId", Routes::bind(&IndividualSubscriptionDocumentApi::a_mf_status_change_subscribe_modfy_handler, this));
Routes::Delete(*router, base + "/subscriptions/:subscriptionId", Routes::bind(&IndividualSubscriptionDocumentApi::a_mf_status_change_un_subscribe_handler, this));
// Default handler, called when a route is not found
router->addCustomHandler(Routes::bind(&IndividualSubscriptionDocumentApi::individual_subscription_document_api_default_handler, this));
}
void IndividualSubscriptionDocumentApi::a_mf_status_change_subscribe_modfy_handler(const Pistache::Rest::Request &request, Pistache::Http::ResponseWriter response) {
// Getting the path params
auto subscriptionId = request.param(":subscriptionId").as<std::string>();
// Getting the body param
SubscriptionData subscriptionData;
try {
nlohmann::json::parse(request.body()).get_to(subscriptionData);
this->a_mf_status_change_subscribe_modfy(subscriptionId, subscriptionData, 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 IndividualSubscriptionDocumentApi::a_mf_status_change_un_subscribe_handler(const Pistache::Rest::Request &request, Pistache::Http::ResponseWriter response) {
// Getting the path params
auto subscriptionId = request.param(":subscriptionId").as<std::string>();
try {
this->a_mf_status_change_un_subscribe(subscriptionId, 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 IndividualSubscriptionDocumentApi::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");
}
}
}
}
/**
* 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.
*/
/*
* IndividualSubscriptionDocumentApi.h
*
*
*/
#ifndef IndividualSubscriptionDocumentApi_H_
#define IndividualSubscriptionDocumentApi_H_
#include <pistache/http.h>
#include <pistache/router.h>
#include <pistache/http_headers.h>
#include <pistache/optional.h>
#include "ProblemDetails.h"
#include "SubscriptionData.h"
#include <string>
namespace oai {
namespace amf {
namespace api {
using namespace oai::amf::model;
class IndividualSubscriptionDocumentApi {
public:
IndividualSubscriptionDocumentApi(std::shared_ptr<Pistache::Rest::Router>);
virtual ~IndividualSubscriptionDocumentApi() {}
void init();
const std::string base = "/namf-comm/v1";
private:
void setupRoutes();
void a_mf_status_change_subscribe_modfy_handler(const Pistache::Rest::Request &request, Pistache::Http::ResponseWriter response);
void a_mf_status_change_un_subscribe_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);
std::shared_ptr<Pistache::Rest::Router> router;
/// <summary>
/// Namf_Communication AMF Status Change Subscribe Modify service Operation
/// </summary>
/// <remarks>
///
/// </remarks>
/// <param name="subscriptionId">AMF Status Change Subscription Identifier</param>
/// <param name="subscriptionData"></param>
virtual void a_mf_status_change_subscribe_modfy(const std::string &subscriptionId, const SubscriptionData &subscriptionData, Pistache::Http::ResponseWriter &response) = 0;
/// <summary>
/// Namf_Communication AMF Status Change UnSubscribe service Operation
/// </summary>
/// <remarks>
///
/// </remarks>
/// <param name="subscriptionId">AMF Status Change Subscription Identifier</param>
virtual void a_mf_status_change_un_subscribe(const std::string &subscriptionId, Pistache::Http::ResponseWriter &response) = 0;
};
}
}
}
#endif /* IndividualSubscriptionDocumentApi_H_ */
/**
* 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 "IndividualUeContextDocumentApi.h"
#include "Helpers.h"
namespace oai {
namespace amf {
namespace api {
using namespace org::openapitools::server::helpers;
using namespace oai::amf::model;
IndividualUeContextDocumentApi::IndividualUeContextDocumentApi(std::shared_ptr<Pistache::Rest::Router> rtr) {
router = rtr;
}
void IndividualUeContextDocumentApi::init() {
setupRoutes();
}
void IndividualUeContextDocumentApi::setupRoutes() {
using namespace Pistache::Rest;
Routes::Put(*router, base + "/ue-contexts/:ueContextId", Routes::bind(&IndividualUeContextDocumentApi::create_ue_context_handler, this));
Routes::Post(*router, base + "/ue-contexts/:ueContextId/assign-ebi", Routes::bind(&IndividualUeContextDocumentApi::e_bi_assignment_handler, this));
Routes::Post(*router, base + "/ue-contexts/:ueContextId/transfer-update", Routes::bind(&IndividualUeContextDocumentApi::registration_status_update_handler, this));
Routes::Post(*router, base + "/ue-contexts/:ueContextId/release", Routes::bind(&IndividualUeContextDocumentApi::release_ue_context_handler, this));
Routes::Post(*router, base + "/ue-contexts/:ueContextId/transfer", Routes::bind(&IndividualUeContextDocumentApi::u_e_context_transfer_handler, this));
// Default handler, called when a route is not found
router->addCustomHandler(Routes::bind(&IndividualUeContextDocumentApi::individual_ue_context_document_api_default_handler, this));
}
void IndividualUeContextDocumentApi::create_ue_context_handler(const Pistache::Rest::Request &request, Pistache::Http::ResponseWriter response) {
// Getting the path params
auto ueContextId = request.param(":ueContextId").as<std::string>();
// Getting the body param
Inline_object inlineObject;
try {
nlohmann::json::parse(request.body()).get_to(inlineObject);
this->create_ue_context(ueContextId, inlineObject, 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 IndividualUeContextDocumentApi::e_bi_assignment_handler(const Pistache::Rest::Request &request, Pistache::Http::ResponseWriter response) {
// Getting the path params
auto ueContextId = request.param(":ueContextId").as<std::string>();
// Getting the body param
AssignEbiData assignEbiData;
try {
nlohmann::json::parse(request.body()).get_to(assignEbiData);
this->e_bi_assignment(ueContextId, assignEbiData, 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 IndividualUeContextDocumentApi::registration_status_update_handler(const Pistache::Rest::Request &request, Pistache::Http::ResponseWriter response) {
// Getting the path params
auto ueContextId = request.param(":ueContextId").as<std::string>();
// Getting the body param
UeRegStatusUpdateReqData ueRegStatusUpdateReqData;
try {
nlohmann::json::parse(request.body()).get_to(ueRegStatusUpdateReqData);
this->registration_status_update(ueContextId, ueRegStatusUpdateReqData, 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 IndividualUeContextDocumentApi::release_ue_context_handler(const Pistache::Rest::Request &request, Pistache::Http::ResponseWriter response) {
// Getting the path params
auto ueContextId = request.param(":ueContextId").as<std::string>();
// Getting the body param
UEContextRelease uEContextRelease;
try {
nlohmann::json::parse(request.body()).get_to(uEContextRelease);
this->release_ue_context(ueContextId, uEContextRelease, 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 IndividualUeContextDocumentApi::u_e_context_transfer_handler(const Pistache::Rest::Request &request, Pistache::Http::ResponseWriter response) {
// Getting the path params
auto ueContextId = request.param(":ueContextId").as<std::string>();
// Getting the body param
UeContextTransferReqData ueContextTransferReqData;
try {
nlohmann::json::parse(request.body()).get_to(ueContextTransferReqData);
this->u_e_context_transfer(ueContextId, ueContextTransferReqData, 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 IndividualUeContextDocumentApi::individual_ue_context_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");
}
}
}
}
/**
* 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.
*/
/*
* IndividualUeContextDocumentApi.h
*
*
*/
#ifndef IndividualUeContextDocumentApi_H_
#define IndividualUeContextDocumentApi_H_
#include <pistache/http.h>
#include <pistache/router.h>
#include <pistache/http_headers.h>
#include <pistache/optional.h>
#include "AssignEbiData.h"
#include "AssignEbiError.h"
#include "AssignedEbiData.h"
#include "Inline_object.h"
#include "ProblemDetails.h"
#include "UEContextRelease.h"
#include "UeContextCreateError.h"
#include "UeContextCreatedData.h"
#include "UeContextTransferReqData.h"
#include "UeContextTransferRspData.h"
#include "UeRegStatusUpdateReqData.h"
#include "UeRegStatusUpdateRspData.h"
#include <string>
namespace oai {
namespace amf {
namespace api {
using namespace oai::amf::model;
class IndividualUeContextDocumentApi {
public:
IndividualUeContextDocumentApi(std::shared_ptr<Pistache::Rest::Router>);
virtual ~IndividualUeContextDocumentApi() {}
void init();
const std::string base = "/namf-comm/v1";
private:
void setupRoutes();
void create_ue_context_handler(const Pistache::Rest::Request &request, Pistache::Http::ResponseWriter response);
void e_bi_assignment_handler(const Pistache::Rest::Request &request, Pistache::Http::ResponseWriter response);
void registration_status_update_handler(const Pistache::Rest::Request &request, Pistache::Http::ResponseWriter response);
void release_ue_context_handler(const Pistache::Rest::Request &request, Pistache::Http::ResponseWriter response);
void u_e_context_transfer_handler(const Pistache::Rest::Request &request, Pistache::Http::ResponseWriter response);
void individual_ue_context_document_api_default_handler(const Pistache::Rest::Request &request, Pistache::Http::ResponseWriter response);
std::shared_ptr<Pistache::Rest::Router> router;
/// <summary>
/// Namf_Communication CreateUEContext service Operation
/// </summary>
/// <remarks>
///
/// </remarks>
/// <param name="ueContextId">UE Context Identifier</param>
/// <param name="inlineObject"></param>
virtual void create_ue_context(const std::string &ueContextId, const Inline_object &inlineObject, Pistache::Http::ResponseWriter &response) = 0;
/// <summary>
/// Namf_Communication EBI Assignment service Operation
/// </summary>
/// <remarks>
///
/// </remarks>
/// <param name="ueContextId">UE Context Identifier</param>
/// <param name="assignEbiData"></param>
virtual void e_bi_assignment(const std::string &ueContextId, const AssignEbiData &assignEbiData, Pistache::Http::ResponseWriter &response) = 0;
/// <summary>
/// Namf_Communication RegistrationStatusUpdate service Operation
/// </summary>
/// <remarks>
///
/// </remarks>
/// <param name="ueContextId">UE Context Identifier</param>
/// <param name="ueRegStatusUpdateReqData"></param>
virtual void registration_status_update(const std::string &ueContextId, const UeRegStatusUpdateReqData &ueRegStatusUpdateReqData, Pistache::Http::ResponseWriter &response) = 0;
/// <summary>
/// Namf_Communication ReleaseUEContext service Operation
/// </summary>
/// <remarks>
///
/// </remarks>
/// <param name="ueContextId">UE Context Identifier</param>
/// <param name="uEContextRelease"></param>
virtual void release_ue_context(const std::string &ueContextId, const UEContextRelease &uEContextRelease, Pistache::Http::ResponseWriter &response) = 0;
/// <summary>
/// Namf_Communication UEContextTransfer service Operation
/// </summary>
/// <remarks>
///
/// </remarks>
/// <param name="ueContextId">UE Context Identifier</param>
/// <param name="ueContextTransferReqData"></param>
virtual void u_e_context_transfer(const std::string &ueContextId, const UeContextTransferReqData &ueContextTransferReqData, Pistache::Http::ResponseWriter &response) = 0;
};
}
}
}
#endif /* IndividualUeContextDocumentApi_H_ */
/**
* 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 "N1N2IndividualSubscriptionDocumentApi.h"
#include "Helpers.h"
namespace oai {
namespace amf {
namespace api {
using namespace org::openapitools::server::helpers;
using namespace oai::amf::model;
N1N2IndividualSubscriptionDocumentApi::N1N2IndividualSubscriptionDocumentApi(std::shared_ptr<Pistache::Rest::Router> rtr) {
router = rtr;
}
void N1N2IndividualSubscriptionDocumentApi::init() {
setupRoutes();
}
void N1N2IndividualSubscriptionDocumentApi::setupRoutes() {
using namespace Pistache::Rest;
Routes::Delete(*router, base + "/ue-contexts/:ueContextId/n1-n2-messages/subscriptions/:subscriptionId", Routes::bind(&N1N2IndividualSubscriptionDocumentApi::n1_n2_message_un_subscribe_handler, this));
// Default handler, called when a route is not found
router->addCustomHandler(Routes::bind(&N1N2IndividualSubscriptionDocumentApi::n1_n2_individual_subscription_document_api_default_handler, this));
}
void N1N2IndividualSubscriptionDocumentApi::n1_n2_message_un_subscribe_handler(const Pistache::Rest::Request &request, Pistache::Http::ResponseWriter response) {
// Getting the path params
auto ueContextId = request.param(":ueContextId").as<std::string>();
auto subscriptionId = request.param(":subscriptionId").as<std::string>();
try {
this->n1_n2_message_un_subscribe(ueContextId, subscriptionId, 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 N1N2IndividualSubscriptionDocumentApi::n1_n2_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");
}
}
}
}
/**
* 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.
*/
/*
* N1N2IndividualSubscriptionDocumentApi.h
*
*
*/
#ifndef N1N2IndividualSubscriptionDocumentApi_H_
#define N1N2IndividualSubscriptionDocumentApi_H_
#include <pistache/http.h>
#include <pistache/router.h>
#include <pistache/http_headers.h>
#include <pistache/optional.h>
#include "ProblemDetails.h"
#include <string>
namespace oai {
namespace amf {
namespace api {
using namespace oai::amf::model;
class N1N2IndividualSubscriptionDocumentApi {
public:
N1N2IndividualSubscriptionDocumentApi(std::shared_ptr<Pistache::Rest::Router>);
virtual ~N1N2IndividualSubscriptionDocumentApi() {}
void init();
const std::string base = "/namf-comm/v1";
private:
void setupRoutes();
void n1_n2_message_un_subscribe_handler(const Pistache::Rest::Request &request, Pistache::Http::ResponseWriter response);
void n1_n2_individual_subscription_document_api_default_handler(const Pistache::Rest::Request &request, Pistache::Http::ResponseWriter response);
std::shared_ptr<Pistache::Rest::Router> router;
/// <summary>
/// Namf_Communication N1N2 Message UnSubscribe (UE Specific) service Operation
/// </summary>
/// <remarks>
///
/// </remarks>
/// <param name="ueContextId">UE Context Identifier</param>
/// <param name="subscriptionId">Subscription Identifier</param>
virtual void n1_n2_message_un_subscribe(const std::string &ueContextId, const std::string &subscriptionId, Pistache::Http::ResponseWriter &response) = 0;
};
}
}
}
#endif /* N1N2IndividualSubscriptionDocumentApi_H_ */
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
/**
* 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 "IndividualSubscriptionDocumentApiImpl.h"
namespace oai {
namespace amf {
namespace api {
using namespace oai::amf::model;
IndividualSubscriptionDocumentApiImpl::IndividualSubscriptionDocumentApiImpl(std::shared_ptr<Pistache::Rest::Router> rtr)
: IndividualSubscriptionDocumentApi(rtr)
{ }
void IndividualSubscriptionDocumentApiImpl::a_mf_status_change_subscribe_modfy(const std::string &subscriptionId, const SubscriptionData &subscriptionData, Pistache::Http::ResponseWriter &response) {
response.send(Pistache::Http::Code::Ok, "Do some magic\n");
}
void IndividualSubscriptionDocumentApiImpl::a_mf_status_change_un_subscribe(const std::string &subscriptionId, Pistache::Http::ResponseWriter &response) {
response.send(Pistache::Http::Code::Ok, "Do some magic\n");
}
}
}
}
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
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