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,24 +48,24 @@ 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)");
Logger::nrf_sbi().info("request body %s", request.body().c_str());
int http_code = 0;
ProblemDetails problem_details = {};
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),
m_nrf_app(nrf_app_inst),
m_address(address) {
}
: CompleteStoredSearchDocumentApi(rtr),
m_nrf_app(nrf_app_inst),
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,
std::string address);
~CompleteStoredSearchDocumentApiImpl() {
}
void retrieve_complete_search(const std::string &searchId,
Pistache::Http::ResponseWriter &response);
CompleteStoredSearchDocumentApiImpl(
std::shared_ptr<Pistache::Rest::Router>, nrf_app* nrf_app_inst,
std::string address);
~CompleteStoredSearchDocumentApiImpl() {}
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
......@@ -11,6 +11,27 @@
* 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 "DiscNFInstancesStoreApiImpl.h"
#include <set>
#include "3gpp_29.500.h"
......@@ -24,61 +45,61 @@ using namespace oai::nrf::model;
using namespace oai::nrf::app;
DiscNFInstancesStoreApiImpl::DiscNFInstancesStoreApiImpl(
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)
: DiscNFInstancesStoreApi(rtr),
m_nrf_app(nrf_app_inst),
m_address(address) {}
void DiscNFInstancesStoreApiImpl::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) {
Logger::nrf_sbi().info(
"Got a request to discover the set of NF instances that satisfies a "
"number of input query parameters");
......@@ -92,33 +113,33 @@ void DiscNFInstancesStoreApiImpl::search_nf_instances(
std::string requester_nf_type = {};
if (!requesterNfType.isEmpty()) {
requester_nf_type = requesterNfType.get();
Logger::nrf_sbi().debug("\tRequested NF type: %s",
requester_nf_type.c_str());
Logger::nrf_sbi().debug(
"\tRequested NF type: %s", requester_nf_type.c_str());
}
std::string requester_nf_instance_id = {};
if (!requesterNfInstanceId.isEmpty()) {
requester_nf_instance_id = requesterNfInstanceId.get();
Logger::nrf_sbi().debug("\tRequested NF instance id: %s",
requester_nf_instance_id.c_str());
Logger::nrf_sbi().debug(
"\tRequested NF instance id: %s", requester_nf_instance_id.c_str());
}
uint32_t limit_nfs = 0;
uint32_t limit_nfs = 0;
if (!limit.isEmpty()) {
limit_nfs = limit.get();
Logger::nrf_sbi().debug("\tMaximum number of NFProfiles to be returned in the response: %d",
limit_nfs);
Logger::nrf_sbi().debug(
"\tMaximum number of NFProfiles to be returned in the response: %d",
limit_nfs);
}
// TODO: other query parameters
int http_code = 0;
int http_code = 0;
ProblemDetails problem_details = {};
std::string search_id = {};
m_nrf_app->handle_search_nf_instances(target_nf_type, requester_nf_type,
requester_nf_instance_id, limit_nfs, search_id,
http_code, 1, problem_details);
std::string search_id = {};
m_nrf_app->handle_search_nf_instances(
target_nf_type, requester_nf_type, requester_nf_instance_id, limit_nfs,
search_id, http_code, 1, problem_details);
nlohmann::json json_data = {};
std::string content_type = "application/json";
......@@ -131,19 +152,20 @@ void DiscNFInstancesStoreApiImpl::search_nf_instances(
content_type = "application/problem+json";
} else {
// convert the profile to Json
if (search_result != nullptr) search_result.get()->to_json(json_data, limit_nfs);
if (search_result != nullptr)
search_result.get()->to_json(json_data, limit_nfs);
}
//TODO: applying client restrictions in terms of the number of
//instances to be returned (i.e. "limit" or "max-
//payload-size" query parameters) .
// TODO: applying client restrictions in terms of the number of
// instances to be returned (i.e. "limit" or "max-
// payload-size" query parameters) .
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
// TODO: add headers: Cache-Control, ETag
response.send(Pistache::Http::Code(http_code), json_data.dump().c_str());
}
......
/**
* 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;
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,17 +68,17 @@ 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",
nfInstanceID.c_str());
int http_code = 0;
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);
ProblemDetails 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,18 +98,18 @@ 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",
nfInstanceID.c_str());
int http_code = 0;
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";
......@@ -120,11 +120,11 @@ void NFInstanceIDDocumentApiImpl::register_nf_instance(
to_json(json_data, problem_details);
content_type = "application/problem+json";
} else {
std::shared_ptr<nrf_profile> profile =
m_nrf_app->find_nf_profile(nfInstanceID);
if (profile.get()!=nullptr) {
profile.get()->to_json(json_data);
//to_json(json_data, nFProfile);
std::shared_ptr<nrf_profile> profile =
m_nrf_app->find_nf_profile(nfInstanceID);
if (profile.get() != nullptr) {
profile.get()->to_json(json_data);
// to_json(json_data, nFProfile);
}
// Location header
......@@ -141,17 +141,17 @@ 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",
nfInstanceID.c_str());
int http_code = 0;
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.
*/
/*
* NFInstanceIDDocumentApiImpl.h
*
*
*
*/
#ifndef NF_INSTANCE_ID_DOCUMENT_API_IMPL_H_
......@@ -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");
......@@ -45,11 +45,11 @@ void NFInstancesStoreApiImpl::get_nf_instances(
Logger::nrf_sbi().debug("\tLimit number of items: %d", limit_item);
}
int http_code = 0;
std::vector<std::string> uris = {};
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";
......@@ -64,7 +64,7 @@ void NFInstancesStoreApiImpl::get_nf_instances(
json_data["_links"]["self"] = "";
for (auto u : uris) {
nlohmann::json json_item = {};
json_item["href"] = u;
json_item["href"] = u;
json_data["_links"]["item"].push_back(json_item);
}
}
......@@ -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.
*/
/*
* NFInstancesStoreApiImpl.h
*
*
*
*/
#ifndef NF_INSTANCES_STORE_API_IMPL_H_
......@@ -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),
m_nrf_app(nrf_app_inst),
m_address(address) {
}
: StoredSearchDocumentApi(rtr),
m_nrf_app(nrf_app_inst),
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.
*/
/*
* StoredSearchDocumentApiImpl.h
*
*
*
*/
#ifndef STORED_SEARCH_DOCUMENT_API_IMPL_H_
......@@ -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;
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,17 +58,17 @@ 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",
subscriptionID.c_str());
int http_code = 0;
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.
*/
/*
* SubscriptionIDDocumentApiImpl.h
*
*
*
*/
#ifndef SUBSCRIPTION_ID_DOCUMENT_API_IMPL_H_
......@@ -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,26 +28,26 @@ 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;
int http_code = 0;
ProblemDetails problem_details = {};
std::string sub_id;
nlohmann::json json_sub = {};
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.
*/
/*
* SubscriptionsCollectionApiImpl.h
*
*
*
*/
#ifndef SUBSCRIPTIONS_COLLECTION_API_IMPL_H_
......@@ -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