Commit 5c5a381f authored by Tien-Thinh Nguyen's avatar Tien-Thinh Nguyen
Browse files

add RegisterNFInstance and NFInstances operations

parent 08e76121
......@@ -14,7 +14,7 @@
#include "Helpers.h"
#include "nrf_config.hpp"
extern oai::nrf::nrf_config nrf_cfg;
extern oai::nrf::app::nrf_config nrf_cfg;
namespace oai {
namespace nrf {
......
......@@ -15,7 +15,7 @@
#include "nrf_config.hpp"
#include "logger.hpp"
extern oai::nrf::nrf_config nrf_cfg;
extern oai::nrf::app::nrf_config nrf_cfg;
namespace oai {
namespace nrf {
......
......@@ -15,7 +15,7 @@
#include "nrf_config.hpp"
#include "logger.hpp"
extern oai::nrf::nrf_config nrf_cfg;
extern oai::nrf::app::nrf_config nrf_cfg;
namespace oai {
namespace nrf {
......
......@@ -15,13 +15,13 @@
#include "nrf_config.hpp"
#include "logger.hpp"
extern oai::nrf::nrf_config nrf_cfg;
extern oai::nrf::app::nrf_config nrf_cfg;
namespace oai {
namespace nrf {
namespace api {
using namespace oai::nrf;
using namespace oai::nrf::app;
using namespace oai::nrf::model;
NFInstancesStoreApi::NFInstancesStoreApi(std::shared_ptr<Pistache::Rest::Router> rtr) {
......
......@@ -57,7 +57,7 @@ public:
virtual ~NFInstancesStoreApi() {}
void init();
const std::string base = "/nnrf-nfm/v1";
const std::string base = "/nnrf-nfm/";
private:
void setupRoutes();
......
......@@ -14,7 +14,7 @@
#include "Helpers.h"
#include "nrf_config.hpp"
extern oai::nrf::nrf_config nrf_cfg;
extern oai::nrf::app::nrf_config nrf_cfg;
namespace oai {
namespace nrf {
......
......@@ -14,7 +14,7 @@
#include "Helpers.h"
#include "nrf_config.hpp"
extern oai::nrf::nrf_config nrf_cfg;
extern oai::nrf::app::nrf_config nrf_cfg;
namespace oai {
namespace nrf {
......
......@@ -14,7 +14,7 @@
#include "Helpers.h"
#include "nrf_config.hpp"
extern oai::nrf::nrf_config nrf_cfg;
extern oai::nrf::app::nrf_config nrf_cfg;
namespace oai {
namespace nrf {
......
......@@ -17,9 +17,10 @@ namespace nrf {
namespace api {
using namespace oai::nrf::model;
using namespace oai::nrf::app;
CompleteStoredSearchDocumentApiImpl::CompleteStoredSearchDocumentApiImpl(
std::shared_ptr<Pistache::Rest::Router> rtr, nrf::nrf_app *nrf_app_inst,
std::shared_ptr<Pistache::Rest::Router> rtr, nrf_app *nrf_app_inst,
std::string address)
:
CompleteStoredSearchDocumentApi(rtr),
......
......@@ -37,12 +37,13 @@ namespace nrf {
namespace api {
using namespace oai::nrf::model;
using namespace oai::nrf::app;
class CompleteStoredSearchDocumentApiImpl :
public oai::nrf::api::CompleteStoredSearchDocumentApi {
public:
CompleteStoredSearchDocumentApiImpl(std::shared_ptr<Pistache::Rest::Router>,
oai::nrf::nrf_app *nrf_app_inst,
nrf_app *nrf_app_inst,
std::string address);
~CompleteStoredSearchDocumentApiImpl() {
}
......@@ -50,7 +51,7 @@ class CompleteStoredSearchDocumentApiImpl :
void retrieve_complete_search(const std::string &searchId,
Pistache::Http::ResponseWriter &response);
private:
oai::nrf::nrf_app *m_nrf_app;
nrf_app *m_nrf_app;
std::string m_address;
};
......
......@@ -18,10 +18,11 @@ namespace nrf {
namespace api {
using namespace oai::nrf::model;
using namespace oai::nrf::app;
DiscNFInstancesStoreApiImpl::DiscNFInstancesStoreApiImpl(
std::shared_ptr<Pistache::Rest::Router> rtr,
oai::nrf::nrf_app *nrf_app_inst, std::string address)
nrf_app *nrf_app_inst, std::string address)
:
DiscNFInstancesStoreApi(rtr),
m_nrf_app(nrf_app_inst),
......
......@@ -54,11 +54,12 @@ namespace nrf {
namespace api {
using namespace oai::nrf::model;
using namespace oai::nrf::app;
class DiscNFInstancesStoreApiImpl : public oai::nrf::api::DiscNFInstancesStoreApi {
public:
DiscNFInstancesStoreApiImpl(std::shared_ptr<Pistache::Rest::Router>,
oai::nrf::nrf_app *nrf_app_inst, std::string address);
nrf_app *nrf_app_inst, std::string address);
~DiscNFInstancesStoreApiImpl() {
}
......@@ -112,7 +113,7 @@ class DiscNFInstancesStoreApiImpl : public oai::nrf::api::DiscNFInstancesStoreAp
const Pistache::Optional<Pistache::Http::Header::Raw> &ifNoneMatch,
Pistache::Http::ResponseWriter &response);
private:
oai::nrf::nrf_app *m_nrf_app;
nrf_app *m_nrf_app;
std::string m_address;
};
......
......@@ -19,9 +19,11 @@ namespace nrf {
namespace api {
using namespace oai::nrf::model;
using namespace oai::nrf::app;
using namespace oai::nrf;
NFInstanceIDDocumentApiImpl::NFInstanceIDDocumentApiImpl(std::shared_ptr<Pistache::Rest::Router> rtr,
oai::nrf::nrf_app *nrf_app_inst,
nrf_app *nrf_app_inst,
std::string address)
: NFInstanceIDDocumentApi(rtr), m_nrf_app(nrf_app_inst),
m_address(address)
......@@ -38,7 +40,7 @@ void NFInstanceIDDocumentApiImpl::register_nf_instance(const std::string &nfInst
NFProfile nf_profile = nFProfile;
int http_code = 0;
m_nrf_app->handle_nf_instance_registration_request(nfInstanceID, nf_profile, http_code, 1);
m_nrf_app->handle_nf_instance_registration_request(nfInstanceID, nFProfile, http_code, 1);
nlohmann::json json_data = { };
to_json(json_data, nf_profile);
......
......@@ -41,11 +41,12 @@ namespace nrf {
namespace api {
using namespace oai::nrf::model;
using namespace oai::nrf::app;
class NFInstanceIDDocumentApiImpl : public oai::nrf::api::NFInstanceIDDocumentApi {
public:
NFInstanceIDDocumentApiImpl(std::shared_ptr<Pistache::Rest::Router>,
oai::nrf::nrf_app *nrf_app_inst,
nrf_app *nrf_app_inst,
std::string address);
~NFInstanceIDDocumentApiImpl() {}
......@@ -54,7 +55,7 @@ public:
void register_nf_instance(const std::string &nfInstanceID, const NFProfile &nFProfile, const Pistache::Optional<Pistache::Http::Header::Raw> &contentEncoding, Pistache::Http::ResponseWriter &response);
void update_nf_instance(const std::string &nfInstanceID, const std::vector<PatchItem> &patchItem, Pistache::Http::ResponseWriter &response);
private:
oai::nrf::nrf_app *m_nrf_app;
nrf_app *m_nrf_app;
std::string m_address;
};
......
/**
* NRF NFManagement Service
* NRF NFManagement Service. © 2019, 3GPP Organizational Partners (ARIB, ATIS, CCSA, ETSI, TSDSI, TTA, TTC). All rights reserved.
*
* The version of the OpenAPI document: 1.1.0.alpha-1
*
*
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
* Do not edit the class manually.
*/
* NRF NFManagement Service
* NRF NFManagement Service. © 2019, 3GPP Organizational Partners (ARIB, ATIS, CCSA, ETSI, TSDSI, TTA, TTC). All rights reserved.
*
* The version of the OpenAPI document: 1.1.0.alpha-1
*
*
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
* Do not edit the class manually.
*/
#include "NFInstancesStoreApiImpl.h"
#include "logger.hpp"
#include "nrf_app.hpp"
namespace oai {
namespace nrf {
namespace api {
using namespace oai::nrf::model;
using namespace oai::nrf::app;
NFInstancesStoreApiImpl::NFInstancesStoreApiImpl(
std::shared_ptr<Pistache::Rest::Router> rtr, oai::nrf::nrf_app *nrf_app_inst,
std::string address)
:
NFInstancesStoreApi(rtr),
m_nrf_app(nrf_app_inst),
m_address(address) {
std::shared_ptr<Pistache::Rest::Router> rtr, nrf_app *nrf_app_inst,
std::string address) :
NFInstancesStoreApi(rtr), m_nrf_app(nrf_app_inst), m_address(address) {
}
void NFInstancesStoreApiImpl::get_nf_instances(const Pistache::Optional<std::string> &nfType, const Pistache::Optional<int32_t> &limit, Pistache::Http::ResponseWriter &response) {
response.send(Pistache::Http::Code::Ok, "Do some magic\n");
void NFInstancesStoreApiImpl::get_nf_instances(
const Pistache::Optional<std::string> &nfType,
const Pistache::Optional<int32_t> &limit,
Pistache::Http::ResponseWriter &response) {
Logger::nrf_sbi().info(
"Got a request to retrieve a collection of NF Instances");
std::string nf_type = { };
if (!nfType.isEmpty()) {
nf_type = nfType.get();
Logger::nrf_sbi().debug(
"Retrieve a collection of NF Instances, NF type: %s",
nf_type.c_str());
}
uint32_t limit_item = 0;
if (!limit.isEmpty()) {
limit_item = limit.get();
Logger::nrf_sbi().debug(
"Retrieve a collection of NF Instances, limit number of items: %d",
limit_item);
}
int http_code = 0;
m_nrf_app->handle_get_nf_instances(nf_type, limit_item, http_code, 1);
nlohmann::json json_data = { };
//to_json(json_data, nf_profile);
//response.send(Pistache::Http::Code::Ok, json_data.dump().c_str());
response.send(Pistache::Http::Code::Ok, "Do some magic\n");
}
void NFInstancesStoreApiImpl::options_nf_instances(Pistache::Http::ResponseWriter &response) {
response.send(Pistache::Http::Code::Ok, "Do some magic\n");
void NFInstancesStoreApiImpl::options_nf_instances(
Pistache::Http::ResponseWriter &response) {
response.send(Pistache::Http::Code::Ok, "Do some magic\n");
}
}
......
......@@ -56,18 +56,19 @@ namespace nrf {
namespace api {
using namespace oai::nrf::model;
using namespace oai::nrf::app;
class NFInstancesStoreApiImpl : public oai::nrf::api::NFInstancesStoreApi {
public:
NFInstancesStoreApiImpl(std::shared_ptr<Pistache::Rest::Router>,
oai::nrf::nrf_app *nrf_app_inst,
nrf_app *nrf_app_inst,
std::string address);
~NFInstancesStoreApiImpl() {}
void get_nf_instances(const Pistache::Optional<std::string> &nfType, const Pistache::Optional<int32_t> &limit, Pistache::Http::ResponseWriter &response);
void options_nf_instances(Pistache::Http::ResponseWriter &response);
private:
oai::nrf::nrf_app *m_nrf_app;
nrf_app *m_nrf_app;
std::string m_address;
};
......
......@@ -17,9 +17,10 @@ namespace nrf {
namespace api {
using namespace oai::nrf::model;
using namespace oai::nrf::app;
StoredSearchDocumentApiImpl::StoredSearchDocumentApiImpl(
std::shared_ptr<Pistache::Rest::Router> rtr, oai::nrf::nrf_app *nrf_app_inst,
std::shared_ptr<Pistache::Rest::Router> rtr, nrf_app *nrf_app_inst,
std::string address)
:
StoredSearchDocumentApi(rtr),
......
......@@ -38,17 +38,18 @@ namespace nrf {
namespace api {
using namespace oai::nrf::model;
using namespace oai::nrf::app;
class StoredSearchDocumentApiImpl : public oai::nrf::api::StoredSearchDocumentApi {
public:
StoredSearchDocumentApiImpl(std::shared_ptr<Pistache::Rest::Router>,
oai::nrf::nrf_app *nrf_app_inst,
nrf_app *nrf_app_inst,
std::string address);
~StoredSearchDocumentApiImpl() {}
void retrieve_stored_search(const std::string &searchId, Pistache::Http::ResponseWriter &response);
private:
oai::nrf::nrf_app *m_nrf_app;
nrf_app *m_nrf_app;
std::string m_address;
};
......
......@@ -17,9 +17,10 @@ namespace nrf {
namespace api {
using namespace oai::nrf::model;
using namespace oai::nrf::app;
SubscriptionIDDocumentApiImpl::SubscriptionIDDocumentApiImpl(
std::shared_ptr<Pistache::Rest::Router> rtr, oai::nrf::nrf_app *nrf_app_inst,
std::shared_ptr<Pistache::Rest::Router> rtr, nrf_app *nrf_app_inst,
std::string address)
:
SubscriptionIDDocumentApi(rtr),
......
......@@ -41,18 +41,19 @@ namespace nrf {
namespace api {
using namespace oai::nrf::model;
using namespace oai::nrf::app;
class SubscriptionIDDocumentApiImpl : public oai::nrf::api::SubscriptionIDDocumentApi {
public:
SubscriptionIDDocumentApiImpl(std::shared_ptr<Pistache::Rest::Router>,
oai::nrf::nrf_app *nrf_app_inst,
nrf_app *nrf_app_inst,
std::string address);
~SubscriptionIDDocumentApiImpl() {}
void remove_subscription(const std::string &subscriptionID, Pistache::Http::ResponseWriter &response);
void update_subscription(const std::string &subscriptionID, const std::vector<PatchItem> &patchItem, Pistache::Http::ResponseWriter &response);
private:
oai::nrf::nrf_app *m_nrf_app;
nrf_app *m_nrf_app;
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