Commit 7973c3e7 authored by Tien-Thinh Nguyen's avatar Tien-Thinh Nguyen

add both service NFManagement and NFDiscovery

parent c4ccac02
This diff is collapsed.
This diff is collapsed.
......@@ -13,6 +13,7 @@
#include "NFInstancesStoreApi.h"
#include "Helpers.h"
#include "nrf_config.hpp"
#include "logger.hpp"
extern oai::nrf::nrf_config nrf_cfg;
......@@ -45,10 +46,10 @@ void NFInstancesStoreApi::get_nf_instances_handler(const Pistache::Rest::Request
// Getting the query params
auto nfTypeQuery = request.query().get("nf-type");
Pistache::Optional<NFType> nfType;
Pistache::Optional<std::string> nfType;
if(!nfTypeQuery.isEmpty()){
NFType valueQuery_instance;
if(fromStringValue(nfTypeQuery.get(), valueQuery_instance)){
std::string valueQuery_instance;
if(helpers::fromStringValue(nfTypeQuery.get(), valueQuery_instance)){
nfType = Pistache::Some(valueQuery_instance);
}
}
......@@ -56,7 +57,7 @@ void NFInstancesStoreApi::get_nf_instances_handler(const Pistache::Rest::Request
Pistache::Optional<int32_t> limit;
if(!limitQuery.isEmpty()){
int32_t valueQuery_instance;
if(fromStringValue(limitQuery.get(), valueQuery_instance)){
if(helpers::fromStringValue(limitQuery.get(), valueQuery_instance)){
limit = Pistache::Some(valueQuery_instance);
}
}
......
......@@ -76,7 +76,7 @@ private:
/// </remarks>
/// <param name="nfType">Type of NF (optional, default to NFType())</param>
/// <param name="limit">How many items to return at one time (optional, default to 0)</param>
virtual void get_nf_instances(const Pistache::Optional<NFType> &nfType, const Pistache::Optional<int32_t> &limit, Pistache::Http::ResponseWriter &response) = 0;
virtual void get_nf_instances(const Pistache::Optional<std::string> &nfType, const Pistache::Optional<int32_t> &limit, Pistache::Http::ResponseWriter &response) = 0;
/// <summary>
/// Discover communication options supported by NRF for NF Instances
......
/**
* NRF NFDiscovery Service
* 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.
*/
* NRF NFDiscovery Service
* 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.
*/
/*
* CompleteStoredSearchDocumentApiImpl.h
*
*
*/
* CompleteStoredSearchDocumentApiImpl.h
*
*
*/
#ifndef COMPLETE_STORED_SEARCH_DOCUMENT_API_IMPL_H_
#define COMPLETE_STORED_SEARCH_DOCUMENT_API_IMPL_H_
#include <pistache/endpoint.h>
#include <pistache/http.h>
#include <pistache/router.h>
......@@ -33,7 +32,6 @@
#include "nrf_app.hpp"
#include <string>
namespace oai {
namespace nrf {
namespace api {
......@@ -60,6 +58,4 @@ class CompleteStoredSearchDocumentApiImpl :
}
}
#endif
/**
* NRF NFDiscovery Service
* 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.
*/
#include "DiscNFInstancesStoreApiImpl.h"
#include <set>
namespace oai {
namespace nrf {
namespace api {
using namespace oai::nrf::model;
DiscNFInstancesStoreApiImpl::DiscNFInstancesStoreApiImpl(
std::shared_ptr<Pistache::Rest::Router> rtr,
oai::nrf::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) {
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.
*
* 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.
*/
/*
* NFInstancesStoreApiImpl.h
*
*
*/
#ifndef DISC_NF_INSTANCES_STORE_API_IMPL_H_
#define DISC_NF_INSTANCES_STORE_API_IMPL_H_
#include <pistache/endpoint.h>
#include <pistache/http.h>
#include <pistache/router.h>
#include <memory>
#include <DiscNFInstancesStoreApi.h>
#include <pistache/optional.h>
#include "AccessType.h"
#include "AtsssCapability.h"
#include "ComplexQuery.h"
#include "DataSetId.h"
#include "EventId.h"
#include "Guami.h"
#include "Ipv6Prefix.h"
#include "NFType.h"
#include "NwdafEvent.h"
#include "PduSessionType.h"
#include "PlmnId.h"
#include "PlmnSnssai.h"
#include "ProblemDetails.h"
#include "SearchResult.h"
#include "ServiceName.h"
#include "Snssai.h"
#include "Tai.h"
#include "nrf_app.hpp"
#include <string>
#include <set>
namespace oai {
namespace nrf {
namespace api {
using namespace oai::nrf::model;
class DiscNFInstancesStoreApiImpl : public oai::nrf::api::DiscNFInstancesStoreApi {
public:
DiscNFInstancesStoreApiImpl(std::shared_ptr<Pistache::Rest::Router>,
oai::nrf::nrf_app *nrf_app_inst, std::string address);
~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);
private:
oai::nrf::nrf_app *m_nrf_app;
std::string m_address;
};
}
}
}
#endif
......@@ -26,7 +26,7 @@ NFInstancesStoreApiImpl::NFInstancesStoreApiImpl(
m_nrf_app(nrf_app_inst),
m_address(address) {
}
void NFInstancesStoreApiImpl::get_nf_instances(const Pistache::Optional<NFType> &nfType, const Pistache::Optional<int32_t> &limit, Pistache::Http::ResponseWriter &response) {
void NFInstancesStoreApiImpl::get_nf_instances(const Pistache::Optional<std::string> &nfType, const Pistache::Optional<int32_t> &limit, Pistache::Http::ResponseWriter &response) {
response.send(Pistache::Http::Code::Ok, "Do some magic\n");
}
void NFInstancesStoreApiImpl::options_nf_instances(Pistache::Http::ResponseWriter &response) {
......
......@@ -64,7 +64,7 @@ public:
std::string address);
~NFInstancesStoreApiImpl() {}
void get_nf_instances(const Pistache::Optional<NFType> &nfType, const Pistache::Optional<int32_t> &limit, 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:
oai::nrf::nrf_app *m_nrf_app;
......
......@@ -134,6 +134,24 @@ bool fromStringValue(const std::string &inStr, oai::nrf::model::AtsssCapability
return true;
}
bool fromStringValue(const std::string &inStr, oai::nrf::model::Tai &value) {
//TODO
return true;
}
bool fromStringValue(const std::string &inStr, oai::nrf::model::Guami &value) {
//TODO
return true;
}
bool fromStringValue(const std::string &inStr, oai::nrf::model::Ipv6Prefix &value) {
//TODO
return true;
}
bool fromStringValue(const std::string &inStr, oai::nrf::model::DataSetId &value) {
//TODO
return true;
}
}
}
}
......@@ -33,6 +33,10 @@
#include "AccessType.h"
#include "ComplexQuery.h"
#include "AtsssCapability.h"
#include "Tai.h"
#include "Guami.h"
#include "DataSetId.h"
#include "Ipv6Prefix.h"
namespace oai {
namespace nrf {
......@@ -61,6 +65,12 @@ namespace helpers {
bool fromStringValue(const std::string &inStr, oai::nrf::model::AccessType &value);
bool fromStringValue(const std::string &inStr, oai::nrf::model::ComplexQuery &value);
bool fromStringValue(const std::string &inStr, oai::nrf::model::AtsssCapability &value);
bool fromStringValue(const std::string &inStr, oai::nrf::model::Tai &value);
bool fromStringValue(const std::string &inStr, oai::nrf::model::Guami &value);
bool fromStringValue(const std::string &inStr, oai::nrf::model::Ipv6Prefix &value);
bool fromStringValue(const std::string &inStr, oai::nrf::model::DataSetId &value);
template<typename T>
bool fromStringValue(const std::vector<std::string> &inStr, std::vector<T> &value){
......
......@@ -639,11 +639,11 @@ void NFProfile::unsetAllowedPlmns()
{
m_AllowedPlmnsIsSet = false;
}
std::vector<NFType>& NFProfile::getAllowedNfTypes()
std::vector<std::string>& NFProfile::getAllowedNfTypes()
{
return m_AllowedNfTypes;
}
void NFProfile::setAllowedNfTypes(std::vector<NFType> const& value)
void NFProfile::setAllowedNfTypes(std::vector<std::string> const& value)
{
m_AllowedNfTypes = value;
m_AllowedNfTypesIsSet = true;
......@@ -758,23 +758,6 @@ void NFProfile::unsetLocality()
{
m_LocalityIsSet = false;
}
int32_t NFProfile::getPriority() const
{
return m_Priority;
}
void NFProfile::setPriority(int32_t const value)
{
m_Priority = value;
m_PriorityIsSet = true;
}
bool NFProfile::priorityIsSet() const
{
return m_PriorityIsSet;
}
void NFProfile::unsetPriority()
{
m_PriorityIsSet = false;
}
UdrInfo NFProfile::getUdrInfo() const
{
return m_UdrInfo;
......
......@@ -156,8 +156,8 @@ public:
/// <summary>
///
/// </summary>
std::vector<NFType>& getAllowedNfTypes();
void setAllowedNfTypes(std::vector<NFType> const& value);
std::vector<std::string>& getAllowedNfTypes();
void setAllowedNfTypes(std::vector<std::string> const& value);
bool allowedNfTypesIsSet() const;
void unsetAllowedNfTypes();
/// <summary>
......@@ -204,12 +204,6 @@ public:
void unsetLocality();
/// <summary>
///
/// </summary>
int32_t getPriority() const;
void setPriority(int32_t const value);
bool priorityIsSet() const;
void unsetPriority();
/// <summary>
///
/// </summary>
UdrInfo getUdrInfo() const;
......@@ -430,14 +424,12 @@ protected:
bool m_Ipv6AddressesIsSet;
std::vector<PlmnId> m_AllowedPlmns;
bool m_AllowedPlmnsIsSet;
std::vector<NFType> m_AllowedNfTypes;
std::vector<std::string> m_AllowedNfTypes;
bool m_AllowedNfTypesIsSet;
std::vector<std::string> m_AllowedNfDomains;
bool m_AllowedNfDomainsIsSet;
std::vector<Snssai> m_AllowedNssais;
bool m_AllowedNssaisIsSet;
int32_t m_Priority;
bool m_PriorityIsSet;
int32_t m_Capacity;
bool m_CapacityIsSet;
int32_t m_Load;
......
......@@ -330,11 +330,11 @@ void NFService::unsetAllowedPlmns()
{
m_AllowedPlmnsIsSet = false;
}
std::vector<NFType>& NFService::getAllowedNfTypes()
std::vector<std::string>& NFService::getAllowedNfTypes()
{
return m_AllowedNfTypes;
}
void NFService::setAllowedNfTypes(std::vector<NFType> const& value)
void NFService::setAllowedNfTypes(std::vector<std::string> const& value)
{
m_AllowedNfTypes = value;
m_AllowedNfTypesIsSet = true;
......@@ -432,23 +432,7 @@ void NFService::unsetLoad()
{
m_LoadIsSet = false;
}
int32_t NFService::getPriority() const
{
return m_Priority;
}
void NFService::setPriority(int32_t const value)
{
m_Priority = value;
m_PriorityIsSet = true;
}
bool NFService::priorityIsSet() const
{
return m_PriorityIsSet;
}
void NFService::unsetPriority()
{
m_PriorityIsSet = false;
}
std::string NFService::getRecoveryTime() const
{
return m_RecoveryTime;
......
......@@ -120,8 +120,8 @@ public:
/// <summary>
///
/// </summary>
std::vector<NFType>& getAllowedNfTypes();
void setAllowedNfTypes(std::vector<NFType> const& value);
std::vector<std::string>& getAllowedNfTypes();
void setAllowedNfTypes(std::vector<std::string> const& value);
bool allowedNfTypesIsSet() const;
void unsetAllowedNfTypes();
/// <summary>
......@@ -140,12 +140,6 @@ public:
void unsetAllowedNssais();
/// <summary>
///
/// </summary>
int32_t getPriority() const;
void setPriority(int32_t const value);
bool priorityIsSet() const;
void unsetPriority();
/// <summary>
///
/// </summary>
int32_t getCapacity() const;
......@@ -213,7 +207,7 @@ protected:
bool m_DefaultNotificationSubscriptionsIsSet;
std::vector<PlmnId> m_AllowedPlmns;
bool m_AllowedPlmnsIsSet;
std::vector<NFType> m_AllowedNfTypes;
std::vector<std::string> m_AllowedNfTypes;
bool m_AllowedNfTypesIsSet;
std::vector<std::string> m_AllowedNfDomains;
bool m_AllowedNfDomainsIsSet;
......@@ -225,8 +219,6 @@ protected:
bool m_CapacityIsSet;
int32_t m_Load;
bool m_LoadIsSet;
int32_t m_Priority;
bool m_PriorityIsSet;
std::string m_RecoveryTime;
bool m_RecoveryTimeIsSet;
ChfServiceInfo m_ChfServiceInfo;
......
......@@ -86,6 +86,7 @@ void NRFApiServer::init(size_t thr) {
m_nfInstanceIDDocumentApiImpl->init();
m_subscriptionIDDocumentApiImpl->init();
m_subscriptionsCollectionApiImpl->init();
m_discNFInstancesStoreApiImpl->init();
}
void NRFApiServer::start() {
Logger::nrf_sbi().info("HTTP1 server started");
......
......@@ -46,10 +46,10 @@
#include "CompleteStoredSearchDocumentApiImpl.h"
#include "NFInstancesStoreApiImpl.h"
#include "StoredSearchDocumentApiImpl.h"
#include "NFInstanceIDDocumentApiImpl.h"
#include "SubscriptionIDDocumentApiImpl.h"
#include "SubscriptionsCollectionApiImpl.h"
#include "DiscNFInstancesStoreApiImpl.h"
#include "nrf_app.hpp"
using namespace oai::nrf::api;
......@@ -73,6 +73,9 @@ class NRFApiServer {
SubscriptionIDDocumentApiImpl>(m_router, nrf_app_inst, m_address);
m_subscriptionsCollectionApiImpl = std::make_shared<
SubscriptionsCollectionApiImpl>(m_router, nrf_app_inst, m_address);
m_discNFInstancesStoreApiImpl = std::make_shared<
DiscNFInstancesStoreApiImpl>(m_router, nrf_app_inst, m_address);
}
void init(size_t thr = 1);
void start();
......@@ -87,6 +90,7 @@ class NRFApiServer {
std::shared_ptr<NFInstanceIDDocumentApiImpl> m_nfInstanceIDDocumentApiImpl;
std::shared_ptr<SubscriptionIDDocumentApiImpl> m_subscriptionIDDocumentApiImpl;
std::shared_ptr<SubscriptionsCollectionApiImpl> m_subscriptionsCollectionApiImpl;
std::shared_ptr<DiscNFInstancesStoreApiImpl> m_discNFInstancesStoreApiImpl;
std::string m_address;
};
......
......@@ -61,7 +61,7 @@ class nrf_profile : public std::enable_shared_from_this<nrf_profile> {
std::string nf_status;
/*
std::vector<PlmnId> m_PlmnList;
bool m_PlmnListIsSet;
std::vector<Snssai> m_SNssais;
......@@ -130,7 +130,7 @@ class nrf_profile : public std::enable_shared_from_this<nrf_profile> {
bool m_NfServicesIsSet;
std::vector<DefaultNotificationSubscription> m_DefaultNotificationSubscriptions;
bool m_DefaultNotificationSubscriptionsIsSet;
*/
};
}
......
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