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

Add OAI header

parent 3a268d4e
...@@ -11,6 +11,28 @@ ...@@ -11,6 +11,28 @@
* the class manually. * the class manually.
*/ */
/*
* Licensed to the OpenAirInterface (OAI) Software Alliance under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The OpenAirInterface Software Alliance licenses this file to You under
* the OAI Public License, Version 1.1 (the "License"); you may not use this file
* except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.openairinterface.org/?page_id=698
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*-------------------------------------------------------------------------------
* For more information about the OpenAirInterface (OAI) Software Alliance:
* contact@openairinterface.org
*/
#include "AccessTokenRequestApiImpl.h" #include "AccessTokenRequestApiImpl.h"
#include "3gpp_29.500.h" #include "3gpp_29.500.h"
#include "AccessTokenRsp.h" #include "AccessTokenRsp.h"
...@@ -26,24 +48,24 @@ using namespace oai::nrf::app; ...@@ -26,24 +48,24 @@ using namespace oai::nrf::app;
using namespace oai::nrf::helpers; using namespace oai::nrf::helpers;
AccessTokenRequestApiImpl::AccessTokenRequestApiImpl( AccessTokenRequestApiImpl::AccessTokenRequestApiImpl(
std::shared_ptr<Pistache::Rest::Router> rtr, nrf_app *nrf_app_inst, std::shared_ptr<Pistache::Rest::Router> rtr, nrf_app* nrf_app_inst,
std::string address) std::string address)
: AccessTokenRequestApi(rtr), m_nrf_app(nrf_app_inst), m_address(address) {} : AccessTokenRequestApi(rtr), m_nrf_app(nrf_app_inst), m_address(address) {}
void AccessTokenRequestApiImpl::access_token_request( void AccessTokenRequestApiImpl::access_token_request(
const Pistache::Rest::Request &request, const Pistache::Rest::Request& request,
Pistache::Http::ResponseWriter &response) { Pistache::Http::ResponseWriter& response) {
Logger::nrf_sbi().info( Logger::nrf_sbi().info(
"Got a request to request an OAuth2 access token from the authorization " "Got a request to request an OAuth2 access token from the authorization "
"server (NRF)"); "server (NRF)");
Logger::nrf_sbi().info("request body %s", request.body().c_str()); Logger::nrf_sbi().info("request body %s", request.body().c_str());
int http_code = 0; int http_code = 0;
ProblemDetails problem_details = {}; ProblemDetails problem_details = {};
AccessTokenRsp access_token_rsp = {}; AccessTokenRsp access_token_rsp = {};
m_nrf_app->handle_access_token_request(request.body(), access_token_rsp, m_nrf_app->handle_access_token_request(
http_code, 1, problem_details); request.body(), access_token_rsp, http_code, 1, problem_details);
nlohmann::json json_data = {}; nlohmann::json json_data = {};
std::string content_type = "application/json"; std::string content_type = "application/json";
......
/** /**
* NRF OAuth2 * NRF OAuth2
* NRF OAuth2 Authorization. © 2019, 3GPP Organizational Partners (ARIB, ATIS, CCSA, ETSI, TSDSI, TTA, TTC). All rights reserved. * NRF OAuth2 Authorization. © 2019, 3GPP Organizational Partners (ARIB, ATIS,
* CCSA, ETSI, TSDSI, TTA, TTC). All rights reserved.
* *
* The version of the OpenAPI document: 1.0.2 * The version of the OpenAPI document: 1.0.2
* *
* *
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). * NOTE: This class is auto generated by OpenAPI Generator
* https://openapi-generator.tech * (https://openapi-generator.tech). https://openapi-generator.tech Do not edit
* Do not edit the class manually. * the class manually.
*/
/*
* Licensed to the OpenAirInterface (OAI) Software Alliance under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The OpenAirInterface Software Alliance licenses this file to You under
* the OAI Public License, Version 1.1 (the "License"); you may not use this file
* except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.openairinterface.org/?page_id=698
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*-------------------------------------------------------------------------------
* For more information about the OpenAirInterface (OAI) Software Alliance:
* contact@openairinterface.org
*/ */
/* /*
...@@ -45,20 +67,22 @@ using namespace oai::nrf::app; ...@@ -45,20 +67,22 @@ using namespace oai::nrf::app;
class AccessTokenRequestApiImpl : public oai::nrf::api::AccessTokenRequestApi { class AccessTokenRequestApiImpl : public oai::nrf::api::AccessTokenRequestApi {
public: public:
AccessTokenRequestApiImpl(std::shared_ptr<Pistache::Rest::Router>, AccessTokenRequestApiImpl(
nrf_app *nrf_app_inst, std::string address); std::shared_ptr<Pistache::Rest::Router>, nrf_app* nrf_app_inst,
~AccessTokenRequestApiImpl() { std::string address);
} ~AccessTokenRequestApiImpl() {}
void access_token_request(
const Pistache::Rest::Request& request,
Pistache::Http::ResponseWriter& response);
void access_token_request(const Pistache::Rest::Request &request,
Pistache::Http::ResponseWriter &response);
private: private:
nrf_app *m_nrf_app; nrf_app* m_nrf_app;
std::string m_address; std::string m_address;
}; };
} } // namespace api
} } // namespace nrf
} } // namespace oai
#endif #endif
/** /**
* NRF NFDiscovery Service * NRF NFDiscovery Service
* NRF NFDiscovery Service. © 2019, 3GPP Organizational Partners (ARIB, ATIS, CCSA, ETSI, TSDSI, TTA, TTC). All rights reserved. * NRF NFDiscovery 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 * The version of the OpenAPI document: 1.1.0.alpha-1
* *
* *
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). * NOTE: This class is auto generated by OpenAPI Generator
* https://openapi-generator.tech * (https://openapi-generator.tech). https://openapi-generator.tech Do not edit
* Do not edit the class manually. * the class manually.
*/ */
/*
* Licensed to the OpenAirInterface (OAI) Software Alliance under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The OpenAirInterface Software Alliance licenses this file to You under
* the OAI Public License, Version 1.1 (the "License"); you may not use this file
* except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.openairinterface.org/?page_id=698
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*-------------------------------------------------------------------------------
* For more information about the OpenAirInterface (OAI) Software Alliance:
* contact@openairinterface.org
*/
#include "CompleteStoredSearchDocumentApiImpl.h" #include "CompleteStoredSearchDocumentApiImpl.h"
#include "3gpp_29.500.h" #include "3gpp_29.500.h"
...@@ -21,46 +44,44 @@ using namespace oai::nrf::model; ...@@ -21,46 +44,44 @@ using namespace oai::nrf::model;
using namespace oai::nrf::app; using namespace oai::nrf::app;
CompleteStoredSearchDocumentApiImpl::CompleteStoredSearchDocumentApiImpl( CompleteStoredSearchDocumentApiImpl::CompleteStoredSearchDocumentApiImpl(
std::shared_ptr<Pistache::Rest::Router> rtr, nrf_app *nrf_app_inst, std::shared_ptr<Pistache::Rest::Router> rtr, nrf_app* nrf_app_inst,
std::string address) std::string address)
: : CompleteStoredSearchDocumentApi(rtr),
CompleteStoredSearchDocumentApi(rtr), m_nrf_app(nrf_app_inst),
m_nrf_app(nrf_app_inst), m_address(address) {}
m_address(address) {
}
void CompleteStoredSearchDocumentApiImpl::retrieve_complete_search( void CompleteStoredSearchDocumentApiImpl::retrieve_complete_search(
const std::string &searchId, Pistache::Http::ResponseWriter &response) { const std::string& searchId, Pistache::Http::ResponseWriter& response) {
Logger::nrf_sbi().info( Logger::nrf_sbi().info(
"Got a request to retrieve a complete search with ID %s", "Got a request to retrieve a complete search with ID %s",
searchId.c_str()); searchId.c_str());
nlohmann::json sr_json = { }; nlohmann::json sr_json = {};
nlohmann::json json_data = { }; nlohmann::json json_data = {};
json_data["nfInstances"] = nlohmann::json::array(); json_data["nfInstances"] = nlohmann::json::array();
std::string content_type = "application/json"; std::string content_type = "application/json";
std::shared_ptr<nrf_search_result> search_result = { }; std::shared_ptr<nrf_search_result> search_result = {};
m_nrf_app->find_search_result(searchId, search_result); m_nrf_app->find_search_result(searchId, search_result);
// convert the profile to Json // convert the profile to Json
if (search_result != nullptr) { if (search_result != nullptr) {
search_result.get()->to_json(sr_json, 0); //with maximum number of NF profiles search_result.get()->to_json(
sr_json, 0); // with maximum number of NF profiles
json_data["nfInstances"] = sr_json["nfInstances"]; json_data["nfInstances"] = sr_json["nfInstances"];
} }
Logger::nrf_sbi().debug("Json data: %s", json_data.dump().c_str()); Logger::nrf_sbi().debug("Json data: %s", json_data.dump().c_str());
// content type // content type
response.headers().add < Pistache::Http::Header::ContentType response.headers().add<Pistache::Http::Header::ContentType>(
> (Pistache::Http::Mime::MediaType(content_type)); Pistache::Http::Mime::MediaType(content_type));
response.send(Pistache::Http::Code(HTTP_STATUS_CODE_200_OK),
json_data.dump().c_str());
}
} response.send(
} Pistache::Http::Code(HTTP_STATUS_CODE_200_OK), json_data.dump().c_str());
} }
} // namespace api
} // namespace nrf
} // namespace oai
/** /**
* NRF NFDiscovery Service * NRF NFDiscovery Service
* NRF NFDiscovery Service. © 2019, 3GPP Organizational Partners (ARIB, ATIS, CCSA, ETSI, TSDSI, TTA, TTC). All rights reserved. * NRF NFDiscovery 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 * The version of the OpenAPI document: 1.1.0.alpha-1
* *
* *
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). * NOTE: This class is auto generated by OpenAPI Generator
* https://openapi-generator.tech * (https://openapi-generator.tech). https://openapi-generator.tech Do not edit
* Do not edit the class manually. * the class manually.
*/
/*
* Licensed to the OpenAirInterface (OAI) Software Alliance under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The OpenAirInterface Software Alliance licenses this file to You under
* the OAI Public License, Version 1.1 (the "License"); you may not use this file
* except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.openairinterface.org/?page_id=698
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*-------------------------------------------------------------------------------
* For more information about the OpenAirInterface (OAI) Software Alliance:
* contact@openairinterface.org
*/ */
/* /*
...@@ -39,24 +61,24 @@ namespace api { ...@@ -39,24 +61,24 @@ namespace api {
using namespace oai::nrf::model; using namespace oai::nrf::model;
using namespace oai::nrf::app; using namespace oai::nrf::app;
class CompleteStoredSearchDocumentApiImpl : class CompleteStoredSearchDocumentApiImpl
public oai::nrf::api::CompleteStoredSearchDocumentApi { : public oai::nrf::api::CompleteStoredSearchDocumentApi {
public: public:
CompleteStoredSearchDocumentApiImpl(std::shared_ptr<Pistache::Rest::Router>, CompleteStoredSearchDocumentApiImpl(
nrf_app *nrf_app_inst, std::shared_ptr<Pistache::Rest::Router>, nrf_app* nrf_app_inst,
std::string address); std::string address);
~CompleteStoredSearchDocumentApiImpl() { ~CompleteStoredSearchDocumentApiImpl() {}
}
void retrieve_complete_search(
void retrieve_complete_search(const std::string &searchId, const std::string& searchId, Pistache::Http::ResponseWriter& response);
Pistache::Http::ResponseWriter &response);
private: private:
nrf_app *m_nrf_app; nrf_app* m_nrf_app;
std::string m_address; std::string m_address;
}; };
} } // namespace api
} } // namespace nrf
} } // namespace oai
#endif #endif
/** /**
* NRF NFDiscovery Service * NRF NFDiscovery Service
* NRF NFDiscovery Service. © 2019, 3GPP Organizational Partners (ARIB, ATIS, CCSA, ETSI, TSDSI, TTA, TTC). All rights reserved. * NRF NFDiscovery 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 * The version of the OpenAPI document: 1.1.0.alpha-1
* *
* *
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). * NOTE: This class is auto generated by OpenAPI Generator
* https://openapi-generator.tech * (https://openapi-generator.tech). https://openapi-generator.tech Do not edit
* Do not edit the class manually. * the class manually.
*/ */
/*
* Licensed to the OpenAirInterface (OAI) Software Alliance under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The OpenAirInterface Software Alliance licenses this file to You under
* the OAI Public License, Version 1.1 (the "License"); you may not use this file
* except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.openairinterface.org/?page_id=698
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*-------------------------------------------------------------------------------
* For more information about the OpenAirInterface (OAI) Software Alliance:
* contact@openairinterface.org
*/
/* /*
* NFInstancesStoreApiImpl.h * NFInstancesStoreApiImpl.h
* *
...@@ -56,70 +79,71 @@ namespace api { ...@@ -56,70 +79,71 @@ namespace api {
using namespace oai::nrf::model; using namespace oai::nrf::model;
using namespace oai::nrf::app; using namespace oai::nrf::app;
class DiscNFInstancesStoreApiImpl : class DiscNFInstancesStoreApiImpl
public oai::nrf::api::DiscNFInstancesStoreApi { : public oai::nrf::api::DiscNFInstancesStoreApi {
public: public:
DiscNFInstancesStoreApiImpl(std::shared_ptr<Pistache::Rest::Router>, DiscNFInstancesStoreApiImpl(
nrf_app *nrf_app_inst, std::string address); std::shared_ptr<Pistache::Rest::Router>, nrf_app* nrf_app_inst,
~DiscNFInstancesStoreApiImpl() { std::string address);
} ~DiscNFInstancesStoreApiImpl() {}
void search_nf_instances( void search_nf_instances(
const Pistache::Optional<std::string> &targetNfType, const Pistache::Optional<std::string>& targetNfType,
const Pistache::Optional<std::string> &requesterNfType, const Pistache::Optional<std::string>& requesterNfType,
const Pistache::Optional<std::string> &requesterNfInstanceId, const Pistache::Optional<std::string>& requesterNfInstanceId,
const Pistache::Optional<std::vector<ServiceName>> &serviceNames, const Pistache::Optional<std::vector<ServiceName>>& serviceNames,
const Pistache::Optional<std::string> &requesterNfInstanceFqdn, const Pistache::Optional<std::string>& requesterNfInstanceFqdn,
const Pistache::Optional<std::vector<PlmnId>> &targetPlmnList, const Pistache::Optional<std::vector<PlmnId>>& targetPlmnList,
const Pistache::Optional<std::vector<PlmnId>> &requesterPlmnList, const Pistache::Optional<std::vector<PlmnId>>& requesterPlmnList,
const Pistache::Optional<std::string> &targetNfInstanceId, const Pistache::Optional<std::string>& targetNfInstanceId,
const Pistache::Optional<std::string> &targetNfFqdn, const Pistache::Optional<std::string>& targetNfFqdn,
const Pistache::Optional<std::string> &hnrfUri, const Pistache::Optional<std::string>& hnrfUri,
const Pistache::Optional<std::vector<Snssai>> &snssais, const Pistache::Optional<std::vector<Snssai>>& snssais,
const Pistache::Optional<std::vector<Snssai>> &requesterSnssais, const Pistache::Optional<std::vector<Snssai>>& requesterSnssais,
const Pistache::Optional<std::vector<PlmnSnssai>> &plmnSpecificSnssaiList, const Pistache::Optional<std::vector<PlmnSnssai>>& plmnSpecificSnssaiList,
const Pistache::Optional<std::string> &dnn, const Pistache::Optional<std::string>& dnn,
const Pistache::Optional<std::vector<std::string>> &nsiList, const Pistache::Optional<std::vector<std::string>>& nsiList,
const Pistache::Optional<std::string> &smfServingArea, const Pistache::Optional<std::string>& smfServingArea,
const Pistache::Optional<Tai> &tai, const Pistache::Optional<Tai>& tai,
const Pistache::Optional<std::string> &amfRegionId, const Pistache::Optional<std::string>& amfRegionId,
const Pistache::Optional<std::string> &amfSetId, const Pistache::Optional<std::string>& amfSetId,
const Pistache::Optional<Guami> &guami, const Pistache::Optional<Guami>& guami,
const Pistache::Optional<std::string> &supi, const Pistache::Optional<std::string>& supi,
const Pistache::Optional<std::string> &ueIpv4Address, const Pistache::Optional<std::string>& ueIpv4Address,
const Pistache::Optional<std::string> &ipDomain, const Pistache::Optional<std::string>& ipDomain,
const Pistache::Optional<Ipv6Prefix> &ueIpv6Prefix, const Pistache::Optional<Ipv6Prefix>& ueIpv6Prefix,
const Pistache::Optional<bool> &pgwInd, const Pistache::Optional<bool>& pgwInd,
const Pistache::Optional<std::string> &pgw, const Pistache::Optional<std::string>& pgw,
const Pistache::Optional<std::string> &gpsi, const Pistache::Optional<std::string>& gpsi,
const Pistache::Optional<std::string> &externalGroupIdentity, const Pistache::Optional<std::string>& externalGroupIdentity,
const Pistache::Optional<DataSetId> &dataSet, const Pistache::Optional<DataSetId>& dataSet,
const Pistache::Optional<std::string> &routingIndicator, const Pistache::Optional<std::string>& routingIndicator,
const Pistache::Optional<std::vector<std::string>> &groupIdList, const Pistache::Optional<std::vector<std::string>>& groupIdList,
const Pistache::Optional<std::vector<std::string>> &dnaiList, const Pistache::Optional<std::vector<std::string>>& dnaiList,
const Pistache::Optional<std::vector<PduSessionType>> &pduSessionTypes, const Pistache::Optional<std::vector<PduSessionType>>& pduSessionTypes,
const Pistache::Optional<std::vector<EventId>> &eventIdList, const Pistache::Optional<std::vector<EventId>>& eventIdList,
const Pistache::Optional<std::vector<NwdafEvent>> &nwdafEventList, const Pistache::Optional<std::vector<NwdafEvent>>& nwdafEventList,
const Pistache::Optional<std::string> &supportedFeatures, const Pistache::Optional<std::string>& supportedFeatures,
const Pistache::Optional<bool> &upfIwkEpsInd, const Pistache::Optional<bool>& upfIwkEpsInd,
const Pistache::Optional<PlmnId> &chfSupportedPlmn, const Pistache::Optional<PlmnId>& chfSupportedPlmn,
const Pistache::Optional<std::string> &preferredLocality, const Pistache::Optional<std::string>& preferredLocality,
const Pistache::Optional<AccessType> &accessType, const Pistache::Optional<AccessType>& accessType,
const Pistache::Optional<int32_t> &limit, const Pistache::Optional<int32_t>& limit,
const Pistache::Optional<std::vector<std::string>> &requiredFeatures, const Pistache::Optional<std::vector<std::string>>& requiredFeatures,
const Pistache::Optional<ComplexQuery> &complexQuery, const Pistache::Optional<ComplexQuery>& complexQuery,
const Pistache::Optional<int32_t> &maxPayloadSize, const Pistache::Optional<int32_t>& maxPayloadSize,
const Pistache::Optional<AtsssCapability> &atsssCapability, const Pistache::Optional<AtsssCapability>& atsssCapability,
const Pistache::Optional<bool> &upfUeIpAddrInd, const Pistache::Optional<bool>& upfUeIpAddrInd,
const Pistache::Optional<Pistache::Http::Header::Raw> &ifNoneMatch, const Pistache::Optional<Pistache::Http::Header::Raw>& ifNoneMatch,
Pistache::Http::ResponseWriter &response); Pistache::Http::ResponseWriter& response);
private: private:
nrf_app *m_nrf_app; nrf_app* m_nrf_app;
std::string m_address; std::string m_address;
}; };
} } // namespace api
} } // namespace nrf
} } // namespace oai
#endif #endif
...@@ -30,7 +30,7 @@ using namespace oai::nrf::app; ...@@ -30,7 +30,7 @@ using namespace oai::nrf::app;
using namespace oai::nrf; using namespace oai::nrf;
NFInstanceIDDocumentApiImpl::NFInstanceIDDocumentApiImpl( NFInstanceIDDocumentApiImpl::NFInstanceIDDocumentApiImpl(
std::shared_ptr<Pistache::Rest::Router> rtr, nrf_app *nrf_app_inst, std::shared_ptr<Pistache::Rest::Router> rtr, nrf_app* nrf_app_inst,
std::string address) std::string address)
: NFInstanceIDDocumentApi(rtr), : NFInstanceIDDocumentApi(rtr),
m_nrf_app(nrf_app_inst), m_nrf_app(nrf_app_inst),
...@@ -38,15 +38,15 @@ NFInstanceIDDocumentApiImpl::NFInstanceIDDocumentApiImpl( ...@@ -38,15 +38,15 @@ NFInstanceIDDocumentApiImpl::NFInstanceIDDocumentApiImpl(
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
void NFInstanceIDDocumentApiImpl::deregister_nf_instance( void NFInstanceIDDocumentApiImpl::deregister_nf_instance(
const std::string &nfInstanceID, Pistache::Http::ResponseWriter &response) { const std::string& nfInstanceID, Pistache::Http::ResponseWriter& response) {
Logger::nrf_sbi().info( Logger::nrf_sbi().info(
"Got a request to de-register a given NF Instance, Instance ID: %s", "Got a request to de-register a given NF Instance, Instance ID: %s",
nfInstanceID.c_str()); nfInstanceID.c_str());
int http_code = 0; int http_code = 0;
ProblemDetails problem_details = {}; ProblemDetails problem_details = {};
m_nrf_app->handle_deregister_nf_instance(nfInstanceID, http_code, 1, m_nrf_app->handle_deregister_nf_instance(
problem_details); nfInstanceID, http_code, 1, problem_details);
nlohmann::json json_data = {}; nlohmann::json json_data = {};
std::string content_type = "application/json"; std::string content_type = "application/json";
...@@ -68,17 +68,17 @@ void NFInstanceIDDocumentApiImpl::deregister_nf_instance( ...@@ -68,17 +68,17 @@ void NFInstanceIDDocumentApiImpl::deregister_nf_instance(
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
void NFInstanceIDDocumentApiImpl::get_nf_instance( void NFInstanceIDDocumentApiImpl::get_nf_instance(
const std::string &nfInstanceID, Pistache::Http::ResponseWriter &response) { const std::string& nfInstanceID, Pistache::Http::ResponseWriter& response) {
Logger::nrf_sbi().info( Logger::nrf_sbi().info(
"Got a request to retrieve the profile of a given NF Instance, Instance " "Got a request to retrieve the profile of a given NF Instance, Instance "
"ID: %s", "ID: %s",
nfInstanceID.c_str()); nfInstanceID.c_str());
int http_code = 0; int http_code = 0;
std::shared_ptr<nrf_profile> profile = {}; std::shared_ptr<nrf_profile> profile = {};
ProblemDetails problem_details = {}; ProblemDetails problem_details = {};
m_nrf_app->handle_get_nf_instance(nfInstanceID, profile, http_code, 1, m_nrf_app->handle_get_nf_instance(
problem_details); nfInstanceID, profile, http_code, 1, problem_details);
nlohmann::json json_data = {}; nlohmann::json json_data = {};
std::string content_type = "application/json"; std::string content_type = "application/json";
...@@ -98,18 +98,18 @@ void NFInstanceIDDocumentApiImpl::get_nf_instance( ...@@ -98,18 +98,18 @@ void NFInstanceIDDocumentApiImpl::get_nf_instance(
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
void NFInstanceIDDocumentApiImpl::register_nf_instance( void NFInstanceIDDocumentApiImpl::register_nf_instance(
const std::string &nfInstanceID, const NFProfile &nFProfile, const std::string& nfInstanceID, const NFProfile& nFProfile,
const Pistache::Optional<Pistache::Http::Header::Raw> &contentEncoding, const Pistache::Optional<Pistache::Http::Header::Raw>& contentEncoding,
Pistache::Http::ResponseWriter &response) { Pistache::Http::ResponseWriter& response) {
Logger::nrf_sbi().info( Logger::nrf_sbi().info(
"Got a request to register an NF instance/Update an NF instance, " "Got a request to register an NF instance/Update an NF instance, "
"Instance ID: %s", "Instance ID: %s",
nfInstanceID.c_str()); nfInstanceID.c_str());
int http_code = 0; int http_code = 0;
ProblemDetails problem_details = {}; ProblemDetails problem_details = {};
m_nrf_app->handle_register_nf_instance(nfInstanceID, nFProfile, http_code, 1, m_nrf_app->handle_register_nf_instance(
problem_details); nfInstanceID, nFProfile, http_code, 1, problem_details);
nlohmann::json json_data = {}; nlohmann::json json_data = {};
std::string content_type = "application/json"; std::string content_type = "application/json";
...@@ -120,11 +120,11 @@ void NFInstanceIDDocumentApiImpl::register_nf_instance( ...@@ -120,11 +120,11 @@ void NFInstanceIDDocumentApiImpl::register_nf_instance(
to_json(json_data, problem_details); to_json(json_data, problem_details);
content_type = "application/problem+json"; content_type = "application/problem+json";
} else { } else {
std::shared_ptr<nrf_profile> profile = std::shared_ptr<nrf_profile> profile =
m_nrf_app->find_nf_profile(nfInstanceID); m_nrf_app->find_nf_profile(nfInstanceID);
if (profile.get()!=nullptr) { if (profile.get() != nullptr) {
profile.get()->to_json(json_data); profile.get()->to_json(json_data);
//to_json(json_data, nFProfile); // to_json(json_data, nFProfile);
} }
// Location header // Location header
...@@ -141,17 +141,17 @@ void NFInstanceIDDocumentApiImpl::register_nf_instance( ...@@ -141,17 +141,17 @@ void NFInstanceIDDocumentApiImpl::register_nf_instance(
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
void NFInstanceIDDocumentApiImpl::update_nf_instance( void NFInstanceIDDocumentApiImpl::update_nf_instance(
const std::string &nfInstanceID, const std::vector<PatchItem> &patchItem, const std::string& nfInstanceID, const std::vector<PatchItem>& patchItem,
Pistache::Http::ResponseWriter &response) { Pistache::Http::ResponseWriter& response) {
Logger::nrf_sbi().info(""); Logger::nrf_sbi().info("");
Logger::nrf_sbi().info( Logger::nrf_sbi().info(
"Got a request to update an NF instance, Instance ID: %s", "Got a request to update an NF instance, Instance ID: %s",
nfInstanceID.c_str()); nfInstanceID.c_str());
int http_code = 0; int http_code = 0;
ProblemDetails problem_details = {}; ProblemDetails problem_details = {};
m_nrf_app->handle_update_nf_instance(nfInstanceID, patchItem, http_code, 1, m_nrf_app->handle_update_nf_instance(
problem_details); nfInstanceID, patchItem, http_code, 1, problem_details);
nlohmann::json json_data = {}; nlohmann::json json_data = {};
std::string content_type = "application/json"; std::string content_type = "application/json";
......
/** /**
* NRF NFManagement Service * NRF NFManagement Service
* NRF NFManagement Service. © 2019, 3GPP Organizational Partners (ARIB, ATIS, CCSA, ETSI, TSDSI, TTA, TTC). All rights reserved. * NRF NFManagement Service. © 2019, 3GPP Organizational Partners (ARIB, ATIS,
* CCSA, ETSI, TSDSI, TTA, TTC). All rights reserved.
* *
* The version of the OpenAPI document: 1.1.0.alpha-1 * 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 * NOTE: This class is auto generated by OpenAPI Generator
* Do not edit the class manually. * (https://openapi-generator.tech). https://openapi-generator.tech Do not edit
* the class manually.
*/ */
/* /*
* NFInstanceIDDocumentApiImpl.h * NFInstanceIDDocumentApiImpl.h
* *
* *
*/ */
#ifndef NF_INSTANCE_ID_DOCUMENT_API_IMPL_H_ #ifndef NF_INSTANCE_ID_DOCUMENT_API_IMPL_H_
...@@ -42,32 +43,35 @@ namespace api { ...@@ -42,32 +43,35 @@ namespace api {
using namespace oai::nrf::model; using namespace oai::nrf::model;
using namespace oai::nrf::app; using namespace oai::nrf::app;
class NFInstanceIDDocumentApiImpl : class NFInstanceIDDocumentApiImpl
public oai::nrf::api::NFInstanceIDDocumentApi { : public oai::nrf::api::NFInstanceIDDocumentApi {
public: public:
NFInstanceIDDocumentApiImpl(std::shared_ptr<Pistache::Rest::Router>, NFInstanceIDDocumentApiImpl(
nrf_app *nrf_app_inst, std::string address); std::shared_ptr<Pistache::Rest::Router>, nrf_app* nrf_app_inst,
~NFInstanceIDDocumentApiImpl() { std::string address);
} ~NFInstanceIDDocumentApiImpl() {}
void deregister_nf_instance(const std::string &nfInstanceID, void deregister_nf_instance(
Pistache::Http::ResponseWriter &response); const std::string& nfInstanceID,
void get_nf_instance(const std::string &nfInstanceID, Pistache::Http::ResponseWriter& response);
Pistache::Http::ResponseWriter &response); void get_nf_instance(
const std::string& nfInstanceID,
Pistache::Http::ResponseWriter& response);
void register_nf_instance( void register_nf_instance(
const std::string &nfInstanceID, const NFProfile &nFProfile, const std::string& nfInstanceID, const NFProfile& nFProfile,
const Pistache::Optional<Pistache::Http::Header::Raw> &contentEncoding, const Pistache::Optional<Pistache::Http::Header::Raw>& contentEncoding,
Pistache::Http::ResponseWriter &response); Pistache::Http::ResponseWriter& response);
void update_nf_instance(const std::string &nfInstanceID, void update_nf_instance(
const std::vector<PatchItem> &patchItem, const std::string& nfInstanceID, const std::vector<PatchItem>& patchItem,
Pistache::Http::ResponseWriter &response); Pistache::Http::ResponseWriter& response);
private: private:
nrf_app *m_nrf_app; nrf_app* m_nrf_app;
std::string m_address; std::string m_address;
}; };
} } // namespace api
} } // namespace nrf
} } // namespace oai
#endif #endif
...@@ -23,13 +23,13 @@ using namespace oai::nrf::model; ...@@ -23,13 +23,13 @@ using namespace oai::nrf::model;
using namespace oai::nrf::app; using namespace oai::nrf::app;
NFInstancesStoreApiImpl::NFInstancesStoreApiImpl( NFInstancesStoreApiImpl::NFInstancesStoreApiImpl(
std::shared_ptr<Pistache::Rest::Router> rtr, nrf_app *nrf_app_inst, std::shared_ptr<Pistache::Rest::Router> rtr, nrf_app* nrf_app_inst,
std::string address) std::string address)
: NFInstancesStoreApi(rtr), m_nrf_app(nrf_app_inst), m_address(address) {} : NFInstancesStoreApi(rtr), m_nrf_app(nrf_app_inst), m_address(address) {}
void NFInstancesStoreApiImpl::get_nf_instances( void NFInstancesStoreApiImpl::get_nf_instances(
const Pistache::Optional<std::string> &nfType, const Pistache::Optional<std::string>& nfType,
const Pistache::Optional<int32_t> &limit, const Pistache::Optional<int32_t>& limit,
Pistache::Http::ResponseWriter &response) { Pistache::Http::ResponseWriter& response) {
Logger::nrf_sbi().info( Logger::nrf_sbi().info(
"Got a request to retrieve a collection of NF Instances"); "Got a request to retrieve a collection of NF Instances");
...@@ -45,11 +45,11 @@ void NFInstancesStoreApiImpl::get_nf_instances( ...@@ -45,11 +45,11 @@ void NFInstancesStoreApiImpl::get_nf_instances(
Logger::nrf_sbi().debug("\tLimit number of items: %d", limit_item); Logger::nrf_sbi().debug("\tLimit number of items: %d", limit_item);
} }
int http_code = 0; int http_code = 0;
std::vector<std::string> uris = {}; std::vector<std::string> uris = {};
ProblemDetails problem_details = {}; ProblemDetails problem_details = {};
m_nrf_app->handle_get_nf_instances(nf_type, uris, limit_item, http_code, 1, m_nrf_app->handle_get_nf_instances(
problem_details); nf_type, uris, limit_item, http_code, 1, problem_details);
nlohmann::json json_data = {}; nlohmann::json json_data = {};
// TODO: std::string content_type = "application/3gppHal+json"; // TODO: std::string content_type = "application/3gppHal+json";
...@@ -64,7 +64,7 @@ void NFInstancesStoreApiImpl::get_nf_instances( ...@@ -64,7 +64,7 @@ void NFInstancesStoreApiImpl::get_nf_instances(
json_data["_links"]["self"] = ""; json_data["_links"]["self"] = "";
for (auto u : uris) { for (auto u : uris) {
nlohmann::json json_item = {}; nlohmann::json json_item = {};
json_item["href"] = u; json_item["href"] = u;
json_data["_links"]["item"].push_back(json_item); json_data["_links"]["item"].push_back(json_item);
} }
} }
...@@ -77,7 +77,7 @@ void NFInstancesStoreApiImpl::get_nf_instances( ...@@ -77,7 +77,7 @@ void NFInstancesStoreApiImpl::get_nf_instances(
response.send(Pistache::Http::Code(http_code), json_data.dump().c_str()); response.send(Pistache::Http::Code(http_code), json_data.dump().c_str());
} }
void NFInstancesStoreApiImpl::options_nf_instances( void NFInstancesStoreApiImpl::options_nf_instances(
Pistache::Http::ResponseWriter &response) { Pistache::Http::ResponseWriter& response) {
response.send(Pistache::Http::Code::Ok, "Do some magic\n"); response.send(Pistache::Http::Code::Ok, "Do some magic\n");
} }
......
/** /**
* NRF NFDiscovery Service * NRF NFDiscovery Service
* NRF NFDiscovery Service. © 2019, 3GPP Organizational Partners (ARIB, ATIS, CCSA, ETSI, TSDSI, TTA, TTC). All rights reserved. * NRF NFDiscovery 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 * 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 * NOTE: This class is auto generated by OpenAPI Generator
* Do not edit the class manually. * (https://openapi-generator.tech). https://openapi-generator.tech Do not edit
* the class manually.
*/ */
/* /*
* NFInstancesStoreApiImpl.h * NFInstancesStoreApiImpl.h
* *
* *
*/ */
#ifndef NF_INSTANCES_STORE_API_IMPL_H_ #ifndef NF_INSTANCES_STORE_API_IMPL_H_
...@@ -58,22 +59,24 @@ using namespace oai::nrf::app; ...@@ -58,22 +59,24 @@ using namespace oai::nrf::app;
class NFInstancesStoreApiImpl : public oai::nrf::api::NFInstancesStoreApi { class NFInstancesStoreApiImpl : public oai::nrf::api::NFInstancesStoreApi {
public: public:
NFInstancesStoreApiImpl(std::shared_ptr<Pistache::Rest::Router>, NFInstancesStoreApiImpl(
nrf_app *nrf_app_inst, std::string address); std::shared_ptr<Pistache::Rest::Router>, nrf_app* nrf_app_inst,
~NFInstancesStoreApiImpl() { 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);
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: private:
nrf_app *m_nrf_app; nrf_app* m_nrf_app;
std::string m_address; std::string m_address;
}; };
} } // namespace api
} } // namespace nrf
} } // namespace oai
#endif #endif
/** /**
* NRF NFDiscovery Service * NRF NFDiscovery Service
* NRF NFDiscovery Service. © 2019, 3GPP Organizational Partners (ARIB, ATIS, CCSA, ETSI, TSDSI, TTA, TTC). All rights reserved. * NRF NFDiscovery 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 * The version of the OpenAPI document: 1.1.0.alpha-1
* *
* *
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). * NOTE: This class is auto generated by OpenAPI Generator
* https://openapi-generator.tech * (https://openapi-generator.tech). https://openapi-generator.tech Do not edit
* Do not edit the class manually. * the class manually.
*/ */
#include "StoredSearchDocumentApiImpl.h" #include "StoredSearchDocumentApiImpl.h"
...@@ -21,47 +22,44 @@ using namespace oai::nrf::model; ...@@ -21,47 +22,44 @@ using namespace oai::nrf::model;
using namespace oai::nrf::app; using namespace oai::nrf::app;
StoredSearchDocumentApiImpl::StoredSearchDocumentApiImpl( StoredSearchDocumentApiImpl::StoredSearchDocumentApiImpl(
std::shared_ptr<Pistache::Rest::Router> rtr, nrf_app *nrf_app_inst, std::shared_ptr<Pistache::Rest::Router> rtr, nrf_app* nrf_app_inst,
std::string address) std::string address)
: : StoredSearchDocumentApi(rtr),
StoredSearchDocumentApi(rtr), m_nrf_app(nrf_app_inst),
m_nrf_app(nrf_app_inst), m_address(address) {}
m_address(address) {
}
void StoredSearchDocumentApiImpl::retrieve_stored_search( void StoredSearchDocumentApiImpl::retrieve_stored_search(
const std::string &searchId, Pistache::Http::ResponseWriter &response) { const std::string& searchId, Pistache::Http::ResponseWriter& response) {
Logger::nrf_sbi().info(
Logger::nrf_sbi().info("Got a request to retrieve a stored search with ID %s", "Got a request to retrieve a stored search with ID %s", searchId.c_str());
searchId.c_str());
nlohmann::json sr_json = { }; nlohmann::json sr_json = {};
nlohmann::json json_data = { }; nlohmann::json json_data = {};
json_data["nfInstances"] = nlohmann::json::array(); json_data["nfInstances"] = nlohmann::json::array();
std::string content_type = "application/json"; std::string content_type = "application/json";
std::shared_ptr<nrf_search_result> search_result = { }; std::shared_ptr<nrf_search_result> search_result = {};
m_nrf_app->find_search_result(searchId, search_result); m_nrf_app->find_search_result(searchId, search_result);
// convert the profile to Json // convert the profile to Json
if (search_result != nullptr) { if (search_result != nullptr) {
search_result.get()->to_json(sr_json, search_result.get()->get_limit_nf_instances()); search_result.get()->to_json(
sr_json, search_result.get()->get_limit_nf_instances());
json_data["nfInstances"] = sr_json["nfInstances"]; json_data["nfInstances"] = sr_json["nfInstances"];
} }
Logger::nrf_sbi().debug("Json data: %s", json_data.dump().c_str()); Logger::nrf_sbi().debug("Json data: %s", json_data.dump().c_str());
// content type // content type
response.headers().add < Pistache::Http::Header::ContentType response.headers().add<Pistache::Http::Header::ContentType>(
> (Pistache::Http::Mime::MediaType(content_type)); Pistache::Http::Mime::MediaType(content_type));
//TODO: add headers: Cache-Control, ETag // TODO: add headers: Cache-Control, ETag
response.send(Pistache::Http::Code(HTTP_STATUS_CODE_200_OK),
json_data.dump().c_str());
}
} response.send(
} Pistache::Http::Code(HTTP_STATUS_CODE_200_OK), json_data.dump().c_str());
} }
} // namespace api
} // namespace nrf
} // namespace oai
/** /**
* NRF NFDiscovery Service * NRF NFDiscovery Service
* NRF NFDiscovery Service. © 2019, 3GPP Organizational Partners (ARIB, ATIS, CCSA, ETSI, TSDSI, TTA, TTC). All rights reserved. * NRF NFDiscovery 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 * 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 * NOTE: This class is auto generated by OpenAPI Generator
* Do not edit the class manually. * (https://openapi-generator.tech). https://openapi-generator.tech Do not edit
* the class manually.
*/ */
/* /*
* StoredSearchDocumentApiImpl.h * StoredSearchDocumentApiImpl.h
* *
* *
*/ */
#ifndef STORED_SEARCH_DOCUMENT_API_IMPL_H_ #ifndef STORED_SEARCH_DOCUMENT_API_IMPL_H_
...@@ -39,23 +40,24 @@ namespace api { ...@@ -39,23 +40,24 @@ namespace api {
using namespace oai::nrf::model; using namespace oai::nrf::model;
using namespace oai::nrf::app; using namespace oai::nrf::app;
class StoredSearchDocumentApiImpl : class StoredSearchDocumentApiImpl
public oai::nrf::api::StoredSearchDocumentApi { : public oai::nrf::api::StoredSearchDocumentApi {
public: public:
StoredSearchDocumentApiImpl(std::shared_ptr<Pistache::Rest::Router>, StoredSearchDocumentApiImpl(
nrf_app *nrf_app_inst, std::string address); std::shared_ptr<Pistache::Rest::Router>, nrf_app* nrf_app_inst,
~StoredSearchDocumentApiImpl() { std::string address);
} ~StoredSearchDocumentApiImpl() {}
void retrieve_stored_search(
const std::string& searchId, Pistache::Http::ResponseWriter& response);
void retrieve_stored_search(const std::string &searchId,
Pistache::Http::ResponseWriter &response);
private: private:
nrf_app *m_nrf_app; nrf_app* m_nrf_app;
std::string m_address; std::string m_address;
}; };
} } // namespace api
} } // namespace nrf
} } // namespace oai
#endif #endif
...@@ -22,23 +22,23 @@ using namespace oai::nrf::model; ...@@ -22,23 +22,23 @@ using namespace oai::nrf::model;
using namespace oai::nrf::app; using namespace oai::nrf::app;
SubscriptionIDDocumentApiImpl::SubscriptionIDDocumentApiImpl( SubscriptionIDDocumentApiImpl::SubscriptionIDDocumentApiImpl(
std::shared_ptr<Pistache::Rest::Router> rtr, nrf_app *nrf_app_inst, std::shared_ptr<Pistache::Rest::Router> rtr, nrf_app* nrf_app_inst,
std::string address) std::string address)
: SubscriptionIDDocumentApi(rtr), : SubscriptionIDDocumentApi(rtr),
m_nrf_app(nrf_app_inst), m_nrf_app(nrf_app_inst),
m_address(address) {} m_address(address) {}
void SubscriptionIDDocumentApiImpl::remove_subscription( void SubscriptionIDDocumentApiImpl::remove_subscription(
const std::string &subscriptionID, const std::string& subscriptionID,
Pistache::Http::ResponseWriter &response) { Pistache::Http::ResponseWriter& response) {
Logger::nrf_sbi().info( Logger::nrf_sbi().info(
"Got a request to remove an existing subscription, subscription ID %s", "Got a request to remove an existing subscription, subscription ID %s",
subscriptionID.c_str()); subscriptionID.c_str());
int http_code = 0; int http_code = 0;
ProblemDetails problem_details = {}; ProblemDetails problem_details = {};
m_nrf_app->handle_remove_subscription(subscriptionID, http_code, 1, m_nrf_app->handle_remove_subscription(
problem_details); subscriptionID, http_code, 1, problem_details);
nlohmann::json json_data = {}; nlohmann::json json_data = {};
std::string content_type = "application/json"; std::string content_type = "application/json";
...@@ -58,17 +58,17 @@ void SubscriptionIDDocumentApiImpl::remove_subscription( ...@@ -58,17 +58,17 @@ void SubscriptionIDDocumentApiImpl::remove_subscription(
} }
} }
void SubscriptionIDDocumentApiImpl::update_subscription( void SubscriptionIDDocumentApiImpl::update_subscription(
const std::string &subscriptionID, const std::vector<PatchItem> &patchItem, const std::string& subscriptionID, const std::vector<PatchItem>& patchItem,
Pistache::Http::ResponseWriter &response) { Pistache::Http::ResponseWriter& response) {
Logger::nrf_sbi().info( Logger::nrf_sbi().info(
"Got a request to update of subscription to NF instances, subscription " "Got a request to update of subscription to NF instances, subscription "
"ID %s", "ID %s",
subscriptionID.c_str()); subscriptionID.c_str());
int http_code = 0; int http_code = 0;
ProblemDetails problem_details = {}; ProblemDetails problem_details = {};
m_nrf_app->handle_update_subscription(subscriptionID, patchItem, http_code, 1, m_nrf_app->handle_update_subscription(
problem_details); subscriptionID, patchItem, http_code, 1, problem_details);
// TODO: (section 5.2.2.5.6, Update of Subscription to NF Instances, // TODO: (section 5.2.2.5.6, Update of Subscription to NF Instances,
// 3GPP TS 29.510 V16.0.0 (2019-06)) if the NRF accepts the extension // 3GPP TS 29.510 V16.0.0 (2019-06)) if the NRF accepts the extension
......
/** /**
* NRF NFManagement Service * NRF NFManagement Service
* NRF NFManagement Service. © 2019, 3GPP Organizational Partners (ARIB, ATIS, CCSA, ETSI, TSDSI, TTA, TTC). All rights reserved. * NRF NFManagement Service. © 2019, 3GPP Organizational Partners (ARIB, ATIS,
* CCSA, ETSI, TSDSI, TTA, TTC). All rights reserved.
* *
* The version of the OpenAPI document: 1.1.0.alpha-1 * 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 * NOTE: This class is auto generated by OpenAPI Generator
* Do not edit the class manually. * (https://openapi-generator.tech). https://openapi-generator.tech Do not edit
* the class manually.
*/ */
/* /*
* SubscriptionIDDocumentApiImpl.h * SubscriptionIDDocumentApiImpl.h
* *
* *
*/ */
#ifndef SUBSCRIPTION_ID_DOCUMENT_API_IMPL_H_ #ifndef SUBSCRIPTION_ID_DOCUMENT_API_IMPL_H_
...@@ -42,26 +43,29 @@ namespace api { ...@@ -42,26 +43,29 @@ namespace api {
using namespace oai::nrf::model; using namespace oai::nrf::model;
using namespace oai::nrf::app; using namespace oai::nrf::app;
class SubscriptionIDDocumentApiImpl : class SubscriptionIDDocumentApiImpl
public oai::nrf::api::SubscriptionIDDocumentApi { : public oai::nrf::api::SubscriptionIDDocumentApi {
public: public:
SubscriptionIDDocumentApiImpl(std::shared_ptr<Pistache::Rest::Router>, SubscriptionIDDocumentApiImpl(
nrf_app *nrf_app_inst, std::string address); std::shared_ptr<Pistache::Rest::Router>, nrf_app* nrf_app_inst,
~SubscriptionIDDocumentApiImpl() { 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);
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: private:
nrf_app *m_nrf_app; nrf_app* m_nrf_app;
std::string m_address; std::string m_address;
}; };
} } // namespace api
} } // namespace nrf
} } // namespace oai
#endif #endif
...@@ -28,26 +28,26 @@ using namespace oai::nrf::model; ...@@ -28,26 +28,26 @@ using namespace oai::nrf::model;
using namespace oai::nrf::app; using namespace oai::nrf::app;
SubscriptionsCollectionApiImpl::SubscriptionsCollectionApiImpl( SubscriptionsCollectionApiImpl::SubscriptionsCollectionApiImpl(
std::shared_ptr<Pistache::Rest::Router> rtr, nrf_app *nrf_app_inst, std::shared_ptr<Pistache::Rest::Router> rtr, nrf_app* nrf_app_inst,
std::string address) std::string address)
: SubscriptionsCollectionApi(rtr), : SubscriptionsCollectionApi(rtr),
m_nrf_app(nrf_app_inst), m_nrf_app(nrf_app_inst),
m_address(address) {} m_address(address) {}
void SubscriptionsCollectionApiImpl::create_subscription( void SubscriptionsCollectionApiImpl::create_subscription(
const SubscriptionData &subscriptionData, const SubscriptionData& subscriptionData,
Pistache::Http::ResponseWriter &response) { Pistache::Http::ResponseWriter& response) {
Logger::nrf_sbi().info("Got a request to create a new subscription"); Logger::nrf_sbi().info("Got a request to create a new subscription");
int http_code = 0; int http_code = 0;
ProblemDetails problem_details = {}; ProblemDetails problem_details = {};
std::string sub_id; std::string sub_id;
nlohmann::json json_sub = {}; nlohmann::json json_sub = {};
to_json(json_sub, subscriptionData); to_json(json_sub, subscriptionData);
Logger::nrf_sbi().debug("Subscription data %s", json_sub.dump().c_str()); Logger::nrf_sbi().debug("Subscription data %s", json_sub.dump().c_str());
m_nrf_app->handle_create_subscription(subscriptionData, sub_id, http_code, 1, m_nrf_app->handle_create_subscription(
problem_details); subscriptionData, sub_id, http_code, 1, problem_details);
nlohmann::json json_data = {}; nlohmann::json json_data = {};
std::string content_type = "application/json"; std::string content_type = "application/json";
......
/** /**
* NRF NFManagement Service * NRF NFManagement Service
* NRF NFManagement Service. © 2019, 3GPP Organizational Partners (ARIB, ATIS, CCSA, ETSI, TSDSI, TTA, TTC). All rights reserved. * NRF NFManagement Service. © 2019, 3GPP Organizational Partners (ARIB, ATIS,
* CCSA, ETSI, TSDSI, TTA, TTC). All rights reserved.
* *
* The version of the OpenAPI document: 1.1.0.alpha-1 * 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 * NOTE: This class is auto generated by OpenAPI Generator
* Do not edit the class manually. * (https://openapi-generator.tech). https://openapi-generator.tech Do not edit
* the class manually.
*/ */
/* /*
* SubscriptionsCollectionApiImpl.h * SubscriptionsCollectionApiImpl.h
* *
* *
*/ */
#ifndef SUBSCRIPTIONS_COLLECTION_API_IMPL_H_ #ifndef SUBSCRIPTIONS_COLLECTION_API_IMPL_H_
...@@ -39,23 +40,25 @@ namespace api { ...@@ -39,23 +40,25 @@ namespace api {
using namespace oai::nrf::model; using namespace oai::nrf::model;
using namespace oai::nrf::app; using namespace oai::nrf::app;
class SubscriptionsCollectionApiImpl : class SubscriptionsCollectionApiImpl
public oai::nrf::api::SubscriptionsCollectionApi { : public oai::nrf::api::SubscriptionsCollectionApi {
public: public:
SubscriptionsCollectionApiImpl(std::shared_ptr<Pistache::Rest::Router>, SubscriptionsCollectionApiImpl(
nrf_app *nrf_app_inst, std::string address); std::shared_ptr<Pistache::Rest::Router>, nrf_app* nrf_app_inst,
~SubscriptionsCollectionApiImpl() { std::string address);
} ~SubscriptionsCollectionApiImpl() {}
void create_subscription(
const SubscriptionData& subscriptionData,
Pistache::Http::ResponseWriter& response);
void create_subscription(const SubscriptionData &subscriptionData,
Pistache::Http::ResponseWriter &response);
private: private:
nrf_app *m_nrf_app; nrf_app* m_nrf_app;
std::string m_address; std::string m_address;
}; };
} } // namespace api
} } // namespace nrf
} } // namespace oai
#endif #endif
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