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

Add OAI header

parent 3a268d4e
......@@ -11,6 +11,28 @@
* 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 "3gpp_29.500.h"
#include "AccessTokenRsp.h"
......@@ -26,13 +48,13 @@ using namespace oai::nrf::app;
using namespace oai::nrf::helpers;
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)
: AccessTokenRequestApi(rtr), m_nrf_app(nrf_app_inst), m_address(address) {}
void AccessTokenRequestApiImpl::access_token_request(
const Pistache::Rest::Request &request,
Pistache::Http::ResponseWriter &response) {
const Pistache::Rest::Request& request,
Pistache::Http::ResponseWriter& response) {
Logger::nrf_sbi().info(
"Got a request to request an OAuth2 access token from the authorization "
"server (NRF)");
......@@ -42,8 +64,8 @@ void AccessTokenRequestApiImpl::access_token_request(
int http_code = 0;
ProblemDetails problem_details = {};
AccessTokenRsp access_token_rsp = {};
m_nrf_app->handle_access_token_request(request.body(), access_token_rsp,
http_code, 1, problem_details);
m_nrf_app->handle_access_token_request(
request.body(), access_token_rsp, http_code, 1, problem_details);
nlohmann::json json_data = {};
std::string content_type = "application/json";
......
/**
* 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
*
*
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
* Do not edit the class manually.
* NOTE: This class is auto generated by OpenAPI Generator
* (https://openapi-generator.tech). https://openapi-generator.tech Do not edit
* the class manually.
*/
/*
* Licensed to the OpenAirInterface (OAI) Software Alliance under one or more
* contributor license agreements. See the NOTICE file distributed with
* 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;
class AccessTokenRequestApiImpl : public oai::nrf::api::AccessTokenRequestApi {
public:
AccessTokenRequestApiImpl(std::shared_ptr<Pistache::Rest::Router>,
nrf_app *nrf_app_inst, std::string address);
~AccessTokenRequestApiImpl() {
}
AccessTokenRequestApiImpl(
std::shared_ptr<Pistache::Rest::Router>, nrf_app* nrf_app_inst,
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:
nrf_app *m_nrf_app;
nrf_app* m_nrf_app;
std::string m_address;
};
}
}
}
} // namespace api
} // namespace nrf
} // namespace oai
#endif
/**
* 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
*
*
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
* Do not edit the class manually.
* NOTE: This class is auto generated by OpenAPI Generator
* (https://openapi-generator.tech). https://openapi-generator.tech Do not edit
* the class manually.
*/
/*
* Licensed to the OpenAirInterface (OAI) Software Alliance under one or more
* contributor license agreements. See the NOTICE file distributed with
* 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 "3gpp_29.500.h"
......@@ -21,46 +44,44 @@ using namespace oai::nrf::model;
using namespace oai::nrf::app;
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)
:
CompleteStoredSearchDocumentApi(rtr),
: CompleteStoredSearchDocumentApi(rtr),
m_nrf_app(nrf_app_inst),
m_address(address) {
}
m_address(address) {}
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(
"Got a request to retrieve a complete search with ID %s",
searchId.c_str());
nlohmann::json sr_json = { };
nlohmann::json json_data = { };
nlohmann::json sr_json = {};
nlohmann::json json_data = {};
json_data["nfInstances"] = nlohmann::json::array();
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);
// convert the profile to Json
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"];
}
Logger::nrf_sbi().debug("Json data: %s", json_data.dump().c_str());
// content type
response.headers().add < Pistache::Http::Header::ContentType
> (Pistache::Http::Mime::MediaType(content_type));
response.send(Pistache::Http::Code(HTTP_STATUS_CODE_200_OK),
json_data.dump().c_str());
}
response.headers().add<Pistache::Http::Header::ContentType>(
Pistache::Http::Mime::MediaType(content_type));
}
}
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. © 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
*
*
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
* Do not edit the class manually.
* NOTE: This class is auto generated by OpenAPI Generator
* (https://openapi-generator.tech). https://openapi-generator.tech Do not edit
* the class manually.
*/
/*
* Licensed to the OpenAirInterface (OAI) Software Alliance under one or more
* contributor license agreements. See the NOTICE file distributed with
* 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 {
using namespace oai::nrf::model;
using namespace oai::nrf::app;
class CompleteStoredSearchDocumentApiImpl :
public oai::nrf::api::CompleteStoredSearchDocumentApi {
class CompleteStoredSearchDocumentApiImpl
: public oai::nrf::api::CompleteStoredSearchDocumentApi {
public:
CompleteStoredSearchDocumentApiImpl(std::shared_ptr<Pistache::Rest::Router>,
nrf_app *nrf_app_inst,
CompleteStoredSearchDocumentApiImpl(
std::shared_ptr<Pistache::Rest::Router>, nrf_app* nrf_app_inst,
std::string address);
~CompleteStoredSearchDocumentApiImpl() {
}
~CompleteStoredSearchDocumentApiImpl() {}
void retrieve_complete_search(
const std::string& searchId, Pistache::Http::ResponseWriter& response);
void retrieve_complete_search(const std::string &searchId,
Pistache::Http::ResponseWriter &response);
private:
nrf_app *m_nrf_app;
nrf_app* m_nrf_app;
std::string m_address;
};
}
}
}
} // namespace api
} // namespace nrf
} // namespace oai
#endif
/**
* 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
*
*
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
* Do not edit the class manually.
* NOTE: This class is auto generated by OpenAPI Generator
* (https://openapi-generator.tech). https://openapi-generator.tech Do not edit
* the class manually.
*/
/*
* Licensed to the OpenAirInterface (OAI) Software Alliance under one or more
* contributor license agreements. See the NOTICE file distributed with
* 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
*
......@@ -56,70 +79,71 @@ namespace api {
using namespace oai::nrf::model;
using namespace oai::nrf::app;
class DiscNFInstancesStoreApiImpl :
public oai::nrf::api::DiscNFInstancesStoreApi {
class DiscNFInstancesStoreApiImpl
: public oai::nrf::api::DiscNFInstancesStoreApi {
public:
DiscNFInstancesStoreApiImpl(std::shared_ptr<Pistache::Rest::Router>,
nrf_app *nrf_app_inst, std::string address);
~DiscNFInstancesStoreApiImpl() {
}
DiscNFInstancesStoreApiImpl(
std::shared_ptr<Pistache::Rest::Router>, nrf_app* nrf_app_inst,
std::string address);
~DiscNFInstancesStoreApiImpl() {}
void search_nf_instances(
const Pistache::Optional<std::string> &targetNfType,
const Pistache::Optional<std::string> &requesterNfType,
const Pistache::Optional<std::string> &requesterNfInstanceId,
const Pistache::Optional<std::vector<ServiceName>> &serviceNames,
const Pistache::Optional<std::string> &requesterNfInstanceFqdn,
const Pistache::Optional<std::vector<PlmnId>> &targetPlmnList,
const Pistache::Optional<std::vector<PlmnId>> &requesterPlmnList,
const Pistache::Optional<std::string> &targetNfInstanceId,
const Pistache::Optional<std::string> &targetNfFqdn,
const Pistache::Optional<std::string> &hnrfUri,
const Pistache::Optional<std::vector<Snssai>> &snssais,
const Pistache::Optional<std::vector<Snssai>> &requesterSnssais,
const Pistache::Optional<std::vector<PlmnSnssai>> &plmnSpecificSnssaiList,
const Pistache::Optional<std::string> &dnn,
const Pistache::Optional<std::vector<std::string>> &nsiList,
const Pistache::Optional<std::string> &smfServingArea,
const Pistache::Optional<Tai> &tai,
const Pistache::Optional<std::string> &amfRegionId,
const Pistache::Optional<std::string> &amfSetId,
const Pistache::Optional<Guami> &guami,
const Pistache::Optional<std::string> &supi,
const Pistache::Optional<std::string> &ueIpv4Address,
const Pistache::Optional<std::string> &ipDomain,
const Pistache::Optional<Ipv6Prefix> &ueIpv6Prefix,
const Pistache::Optional<bool> &pgwInd,
const Pistache::Optional<std::string> &pgw,
const Pistache::Optional<std::string> &gpsi,
const Pistache::Optional<std::string> &externalGroupIdentity,
const Pistache::Optional<DataSetId> &dataSet,
const Pistache::Optional<std::string> &routingIndicator,
const Pistache::Optional<std::vector<std::string>> &groupIdList,
const Pistache::Optional<std::vector<std::string>> &dnaiList,
const Pistache::Optional<std::vector<PduSessionType>> &pduSessionTypes,
const Pistache::Optional<std::vector<EventId>> &eventIdList,
const Pistache::Optional<std::vector<NwdafEvent>> &nwdafEventList,
const Pistache::Optional<std::string> &supportedFeatures,
const Pistache::Optional<bool> &upfIwkEpsInd,
const Pistache::Optional<PlmnId> &chfSupportedPlmn,
const Pistache::Optional<std::string> &preferredLocality,
const Pistache::Optional<AccessType> &accessType,
const Pistache::Optional<int32_t> &limit,
const Pistache::Optional<std::vector<std::string>> &requiredFeatures,
const Pistache::Optional<ComplexQuery> &complexQuery,
const Pistache::Optional<int32_t> &maxPayloadSize,
const Pistache::Optional<AtsssCapability> &atsssCapability,
const Pistache::Optional<bool> &upfUeIpAddrInd,
const Pistache::Optional<Pistache::Http::Header::Raw> &ifNoneMatch,
Pistache::Http::ResponseWriter &response);
const Pistache::Optional<std::string>& targetNfType,
const Pistache::Optional<std::string>& requesterNfType,
const Pistache::Optional<std::string>& requesterNfInstanceId,
const Pistache::Optional<std::vector<ServiceName>>& serviceNames,
const Pistache::Optional<std::string>& requesterNfInstanceFqdn,
const Pistache::Optional<std::vector<PlmnId>>& targetPlmnList,
const Pistache::Optional<std::vector<PlmnId>>& requesterPlmnList,
const Pistache::Optional<std::string>& targetNfInstanceId,
const Pistache::Optional<std::string>& targetNfFqdn,
const Pistache::Optional<std::string>& hnrfUri,
const Pistache::Optional<std::vector<Snssai>>& snssais,
const Pistache::Optional<std::vector<Snssai>>& requesterSnssais,
const Pistache::Optional<std::vector<PlmnSnssai>>& plmnSpecificSnssaiList,
const Pistache::Optional<std::string>& dnn,
const Pistache::Optional<std::vector<std::string>>& nsiList,
const Pistache::Optional<std::string>& smfServingArea,
const Pistache::Optional<Tai>& tai,
const Pistache::Optional<std::string>& amfRegionId,
const Pistache::Optional<std::string>& amfSetId,
const Pistache::Optional<Guami>& guami,
const Pistache::Optional<std::string>& supi,
const Pistache::Optional<std::string>& ueIpv4Address,
const Pistache::Optional<std::string>& ipDomain,
const Pistache::Optional<Ipv6Prefix>& ueIpv6Prefix,
const Pistache::Optional<bool>& pgwInd,
const Pistache::Optional<std::string>& pgw,
const Pistache::Optional<std::string>& gpsi,
const Pistache::Optional<std::string>& externalGroupIdentity,
const Pistache::Optional<DataSetId>& dataSet,
const Pistache::Optional<std::string>& routingIndicator,
const Pistache::Optional<std::vector<std::string>>& groupIdList,
const Pistache::Optional<std::vector<std::string>>& dnaiList,
const Pistache::Optional<std::vector<PduSessionType>>& pduSessionTypes,
const Pistache::Optional<std::vector<EventId>>& eventIdList,
const Pistache::Optional<std::vector<NwdafEvent>>& nwdafEventList,
const Pistache::Optional<std::string>& supportedFeatures,
const Pistache::Optional<bool>& upfIwkEpsInd,
const Pistache::Optional<PlmnId>& chfSupportedPlmn,
const Pistache::Optional<std::string>& preferredLocality,
const Pistache::Optional<AccessType>& accessType,
const Pistache::Optional<int32_t>& limit,
const Pistache::Optional<std::vector<std::string>>& requiredFeatures,
const Pistache::Optional<ComplexQuery>& complexQuery,
const Pistache::Optional<int32_t>& maxPayloadSize,
const Pistache::Optional<AtsssCapability>& atsssCapability,
const Pistache::Optional<bool>& upfUeIpAddrInd,
const Pistache::Optional<Pistache::Http::Header::Raw>& ifNoneMatch,
Pistache::Http::ResponseWriter& response);
private:
nrf_app *m_nrf_app;
nrf_app* m_nrf_app;
std::string m_address;
};
}
}
}
} // namespace api
} // namespace nrf
} // namespace oai
#endif
......@@ -30,7 +30,7 @@ using namespace oai::nrf::app;
using namespace oai::nrf;
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)
: NFInstanceIDDocumentApi(rtr),
m_nrf_app(nrf_app_inst),
......@@ -38,15 +38,15 @@ NFInstanceIDDocumentApiImpl::NFInstanceIDDocumentApiImpl(
//------------------------------------------------------------------------------
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(
"Got a request to de-register a given NF Instance, Instance ID: %s",
nfInstanceID.c_str());
int http_code = 0;
ProblemDetails problem_details = {};
m_nrf_app->handle_deregister_nf_instance(nfInstanceID, http_code, 1,
problem_details);
m_nrf_app->handle_deregister_nf_instance(
nfInstanceID, http_code, 1, problem_details);
nlohmann::json json_data = {};
std::string content_type = "application/json";
......@@ -68,7 +68,7 @@ void NFInstanceIDDocumentApiImpl::deregister_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(
"Got a request to retrieve the profile of a given NF Instance, Instance "
"ID: %s",
......@@ -77,8 +77,8 @@ void NFInstanceIDDocumentApiImpl::get_nf_instance(
int http_code = 0;
std::shared_ptr<nrf_profile> profile = {};
ProblemDetails problem_details = {};
m_nrf_app->handle_get_nf_instance(nfInstanceID, profile, http_code, 1,
problem_details);
m_nrf_app->handle_get_nf_instance(
nfInstanceID, profile, http_code, 1, problem_details);
nlohmann::json json_data = {};
std::string content_type = "application/json";
......@@ -98,9 +98,9 @@ void NFInstanceIDDocumentApiImpl::get_nf_instance(
//------------------------------------------------------------------------------
void NFInstanceIDDocumentApiImpl::register_nf_instance(
const std::string &nfInstanceID, const NFProfile &nFProfile,
const Pistache::Optional<Pistache::Http::Header::Raw> &contentEncoding,
Pistache::Http::ResponseWriter &response) {
const std::string& nfInstanceID, const NFProfile& nFProfile,
const Pistache::Optional<Pistache::Http::Header::Raw>& contentEncoding,
Pistache::Http::ResponseWriter& response) {
Logger::nrf_sbi().info(
"Got a request to register an NF instance/Update an NF instance, "
"Instance ID: %s",
......@@ -108,8 +108,8 @@ void NFInstanceIDDocumentApiImpl::register_nf_instance(
int http_code = 0;
ProblemDetails problem_details = {};
m_nrf_app->handle_register_nf_instance(nfInstanceID, nFProfile, http_code, 1,
problem_details);
m_nrf_app->handle_register_nf_instance(
nfInstanceID, nFProfile, http_code, 1, problem_details);
nlohmann::json json_data = {};
std::string content_type = "application/json";
......@@ -122,9 +122,9 @@ void NFInstanceIDDocumentApiImpl::register_nf_instance(
} else {
std::shared_ptr<nrf_profile> profile =
m_nrf_app->find_nf_profile(nfInstanceID);
if (profile.get()!=nullptr) {
if (profile.get() != nullptr) {
profile.get()->to_json(json_data);
//to_json(json_data, nFProfile);
// to_json(json_data, nFProfile);
}
// Location header
......@@ -141,8 +141,8 @@ void NFInstanceIDDocumentApiImpl::register_nf_instance(
//------------------------------------------------------------------------------
void NFInstanceIDDocumentApiImpl::update_nf_instance(
const std::string &nfInstanceID, const std::vector<PatchItem> &patchItem,
Pistache::Http::ResponseWriter &response) {
const std::string& nfInstanceID, const std::vector<PatchItem>& patchItem,
Pistache::Http::ResponseWriter& response) {
Logger::nrf_sbi().info("");
Logger::nrf_sbi().info(
"Got a request to update an NF instance, Instance ID: %s",
......@@ -150,8 +150,8 @@ void NFInstanceIDDocumentApiImpl::update_nf_instance(
int http_code = 0;
ProblemDetails problem_details = {};
m_nrf_app->handle_update_nf_instance(nfInstanceID, patchItem, http_code, 1,
problem_details);
m_nrf_app->handle_update_nf_instance(
nfInstanceID, patchItem, http_code, 1, problem_details);
nlohmann::json json_data = {};
std::string content_type = "application/json";
......
/**
* 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
*
*
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
* Do not edit the class manually.
* NOTE: This class is auto generated by OpenAPI Generator
* (https://openapi-generator.tech). https://openapi-generator.tech Do not edit
* the class manually.
*/
/*
......@@ -42,32 +43,35 @@ namespace api {
using namespace oai::nrf::model;
using namespace oai::nrf::app;
class NFInstanceIDDocumentApiImpl :
public oai::nrf::api::NFInstanceIDDocumentApi {
class NFInstanceIDDocumentApiImpl
: public oai::nrf::api::NFInstanceIDDocumentApi {
public:
NFInstanceIDDocumentApiImpl(std::shared_ptr<Pistache::Rest::Router>,
nrf_app *nrf_app_inst, std::string address);
~NFInstanceIDDocumentApiImpl() {
}
NFInstanceIDDocumentApiImpl(
std::shared_ptr<Pistache::Rest::Router>, nrf_app* nrf_app_inst,
std::string address);
~NFInstanceIDDocumentApiImpl() {}
void deregister_nf_instance(const std::string &nfInstanceID,
Pistache::Http::ResponseWriter &response);
void get_nf_instance(const std::string &nfInstanceID,
Pistache::Http::ResponseWriter &response);
void deregister_nf_instance(
const std::string& nfInstanceID,
Pistache::Http::ResponseWriter& response);
void get_nf_instance(
const std::string& nfInstanceID,
Pistache::Http::ResponseWriter& response);
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);
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:
nrf_app *m_nrf_app;
nrf_app* m_nrf_app;
std::string m_address;
};
}
}
}
} // namespace api
} // namespace nrf
} // namespace oai
#endif
......@@ -23,13 +23,13 @@ using namespace oai::nrf::model;
using namespace oai::nrf::app;
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)
: 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) {
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");
......@@ -48,8 +48,8 @@ void NFInstancesStoreApiImpl::get_nf_instances(
int http_code = 0;
std::vector<std::string> uris = {};
ProblemDetails problem_details = {};
m_nrf_app->handle_get_nf_instances(nf_type, uris, limit_item, http_code, 1,
problem_details);
m_nrf_app->handle_get_nf_instances(
nf_type, uris, limit_item, http_code, 1, problem_details);
nlohmann::json json_data = {};
// TODO: std::string content_type = "application/3gppHal+json";
......@@ -77,7 +77,7 @@ void NFInstancesStoreApiImpl::get_nf_instances(
response.send(Pistache::Http::Code(http_code), json_data.dump().c_str());
}
void NFInstancesStoreApiImpl::options_nf_instances(
Pistache::Http::ResponseWriter &response) {
Pistache::Http::ResponseWriter& response) {
response.send(Pistache::Http::Code::Ok, "Do some magic\n");
}
......
/**
* 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
*
*
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
* Do not edit the class manually.
* NOTE: This class is auto generated by OpenAPI Generator
* (https://openapi-generator.tech). https://openapi-generator.tech Do not edit
* the class manually.
*/
/*
......@@ -58,22 +59,24 @@ using namespace oai::nrf::app;
class NFInstancesStoreApiImpl : public oai::nrf::api::NFInstancesStoreApi {
public:
NFInstancesStoreApiImpl(std::shared_ptr<Pistache::Rest::Router>,
nrf_app *nrf_app_inst, std::string address);
~NFInstancesStoreApiImpl() {
}
NFInstancesStoreApiImpl(
std::shared_ptr<Pistache::Rest::Router>, 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);
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:
nrf_app *m_nrf_app;
nrf_app* m_nrf_app;
std::string m_address;
};
}
}
}
} // namespace api
} // namespace nrf
} // namespace oai
#endif
/**
* 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
*
*
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
* Do not edit the class manually.
* NOTE: This class is auto generated by OpenAPI Generator
* (https://openapi-generator.tech). https://openapi-generator.tech Do not edit
* the class manually.
*/
#include "StoredSearchDocumentApiImpl.h"
......@@ -21,47 +22,44 @@ using namespace oai::nrf::model;
using namespace oai::nrf::app;
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)
:
StoredSearchDocumentApi(rtr),
: StoredSearchDocumentApi(rtr),
m_nrf_app(nrf_app_inst),
m_address(address) {
}
m_address(address) {}
void StoredSearchDocumentApiImpl::retrieve_stored_search(
const std::string &searchId, Pistache::Http::ResponseWriter &response) {
Logger::nrf_sbi().info("Got a request to retrieve a stored search with ID %s",
searchId.c_str());
const std::string& searchId, Pistache::Http::ResponseWriter& response) {
Logger::nrf_sbi().info(
"Got a request to retrieve a stored search with ID %s", searchId.c_str());
nlohmann::json sr_json = { };
nlohmann::json json_data = { };
nlohmann::json sr_json = {};
nlohmann::json json_data = {};
json_data["nfInstances"] = nlohmann::json::array();
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);
// convert the profile to Json
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"];
}
Logger::nrf_sbi().debug("Json data: %s", json_data.dump().c_str());
// content type
response.headers().add < Pistache::Http::Header::ContentType
> (Pistache::Http::Mime::MediaType(content_type));
//TODO: add headers: Cache-Control, ETag
response.send(Pistache::Http::Code(HTTP_STATUS_CODE_200_OK),
json_data.dump().c_str());
}
response.headers().add<Pistache::Http::Header::ContentType>(
Pistache::Http::Mime::MediaType(content_type));
// TODO: add headers: Cache-Control, ETag
}
}
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. © 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
*
*
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
* Do not edit the class manually.
* NOTE: This class is auto generated by OpenAPI Generator
* (https://openapi-generator.tech). https://openapi-generator.tech Do not edit
* the class manually.
*/
/*
......@@ -39,23 +40,24 @@ namespace api {
using namespace oai::nrf::model;
using namespace oai::nrf::app;
class StoredSearchDocumentApiImpl :
public oai::nrf::api::StoredSearchDocumentApi {
class StoredSearchDocumentApiImpl
: public oai::nrf::api::StoredSearchDocumentApi {
public:
StoredSearchDocumentApiImpl(std::shared_ptr<Pistache::Rest::Router>,
nrf_app *nrf_app_inst, std::string address);
~StoredSearchDocumentApiImpl() {
}
StoredSearchDocumentApiImpl(
std::shared_ptr<Pistache::Rest::Router>, nrf_app* nrf_app_inst,
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:
nrf_app *m_nrf_app;
nrf_app* m_nrf_app;
std::string m_address;
};
}
}
}
} // namespace api
} // namespace nrf
} // namespace oai
#endif
......@@ -22,23 +22,23 @@ using namespace oai::nrf::model;
using namespace oai::nrf::app;
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)
: SubscriptionIDDocumentApi(rtr),
m_nrf_app(nrf_app_inst),
m_address(address) {}
void SubscriptionIDDocumentApiImpl::remove_subscription(
const std::string &subscriptionID,
Pistache::Http::ResponseWriter &response) {
const std::string& subscriptionID,
Pistache::Http::ResponseWriter& response) {
Logger::nrf_sbi().info(
"Got a request to remove an existing subscription, subscription ID %s",
subscriptionID.c_str());
int http_code = 0;
ProblemDetails problem_details = {};
m_nrf_app->handle_remove_subscription(subscriptionID, http_code, 1,
problem_details);
m_nrf_app->handle_remove_subscription(
subscriptionID, http_code, 1, problem_details);
nlohmann::json json_data = {};
std::string content_type = "application/json";
......@@ -58,8 +58,8 @@ void SubscriptionIDDocumentApiImpl::remove_subscription(
}
}
void SubscriptionIDDocumentApiImpl::update_subscription(
const std::string &subscriptionID, const std::vector<PatchItem> &patchItem,
Pistache::Http::ResponseWriter &response) {
const std::string& subscriptionID, const std::vector<PatchItem>& patchItem,
Pistache::Http::ResponseWriter& response) {
Logger::nrf_sbi().info(
"Got a request to update of subscription to NF instances, subscription "
"ID %s",
......@@ -67,8 +67,8 @@ void SubscriptionIDDocumentApiImpl::update_subscription(
int http_code = 0;
ProblemDetails problem_details = {};
m_nrf_app->handle_update_subscription(subscriptionID, patchItem, http_code, 1,
problem_details);
m_nrf_app->handle_update_subscription(
subscriptionID, patchItem, http_code, 1, problem_details);
// 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
......
/**
* 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
*
*
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
* Do not edit the class manually.
* NOTE: This class is auto generated by OpenAPI Generator
* (https://openapi-generator.tech). https://openapi-generator.tech Do not edit
* the class manually.
*/
/*
......@@ -42,26 +43,29 @@ namespace api {
using namespace oai::nrf::model;
using namespace oai::nrf::app;
class SubscriptionIDDocumentApiImpl :
public oai::nrf::api::SubscriptionIDDocumentApi {
class SubscriptionIDDocumentApiImpl
: public oai::nrf::api::SubscriptionIDDocumentApi {
public:
SubscriptionIDDocumentApiImpl(std::shared_ptr<Pistache::Rest::Router>,
nrf_app *nrf_app_inst, std::string address);
~SubscriptionIDDocumentApiImpl() {
}
SubscriptionIDDocumentApiImpl(
std::shared_ptr<Pistache::Rest::Router>, 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);
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:
nrf_app *m_nrf_app;
nrf_app* m_nrf_app;
std::string m_address;
};
}
}
}
} // namespace api
} // namespace nrf
} // namespace oai
#endif
......@@ -28,15 +28,15 @@ using namespace oai::nrf::model;
using namespace oai::nrf::app;
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)
: SubscriptionsCollectionApi(rtr),
m_nrf_app(nrf_app_inst),
m_address(address) {}
void SubscriptionsCollectionApiImpl::create_subscription(
const SubscriptionData &subscriptionData,
Pistache::Http::ResponseWriter &response) {
const SubscriptionData& subscriptionData,
Pistache::Http::ResponseWriter& response) {
Logger::nrf_sbi().info("Got a request to create a new subscription");
int http_code = 0;
......@@ -46,8 +46,8 @@ void SubscriptionsCollectionApiImpl::create_subscription(
to_json(json_sub, subscriptionData);
Logger::nrf_sbi().debug("Subscription data %s", json_sub.dump().c_str());
m_nrf_app->handle_create_subscription(subscriptionData, sub_id, http_code, 1,
problem_details);
m_nrf_app->handle_create_subscription(
subscriptionData, sub_id, http_code, 1, problem_details);
nlohmann::json json_data = {};
std::string content_type = "application/json";
......
/**
* 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
*
*
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
* Do not edit the class manually.
* NOTE: This class is auto generated by OpenAPI Generator
* (https://openapi-generator.tech). https://openapi-generator.tech Do not edit
* the class manually.
*/
/*
......@@ -39,23 +40,25 @@ namespace api {
using namespace oai::nrf::model;
using namespace oai::nrf::app;
class SubscriptionsCollectionApiImpl :
public oai::nrf::api::SubscriptionsCollectionApi {
class SubscriptionsCollectionApiImpl
: public oai::nrf::api::SubscriptionsCollectionApi {
public:
SubscriptionsCollectionApiImpl(std::shared_ptr<Pistache::Rest::Router>,
nrf_app *nrf_app_inst, std::string address);
~SubscriptionsCollectionApiImpl() {
}
SubscriptionsCollectionApiImpl(
std::shared_ptr<Pistache::Rest::Router>, nrf_app* nrf_app_inst,
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:
nrf_app *m_nrf_app;
nrf_app* m_nrf_app;
std::string m_address;
};
}
}
}
} // namespace api
} // namespace nrf
} // namespace oai
#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