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

add function to generate NRF UUID

parent 97a1cf75
......@@ -34,6 +34,8 @@
#include <boost/algorithm/string/split.hpp>
#include <boost/date_time/posix_time/posix_time_types.hpp>
#include <boost/date_time/posix_time/time_formatters.hpp>
#include <boost/uuid/random_generator.hpp>
#include <boost/uuid/uuid_io.hpp>
#include <chrono>
#include "3gpp_29.500.h"
......@@ -77,6 +79,11 @@ nrf_app::nrf_app(const std::string &config_file, nrf_event &ev)
Logger::nrf_app().startup("Started");
}
//------------------------------------------------------------------------------
void nrf_app::generate_uuid() {
instance_id = to_string(boost::uuids::random_generator()());
}
//------------------------------------------------------------------------------
void nrf_app::handle_register_nf_instance(
const std::string &nf_instance_id,
......
......@@ -31,18 +31,17 @@
#define FILE_NRF_APP_HPP_SEEN
#include <string>
#include "AccessTokenRsp.h"
#include "NFProfile.h"
#include "PatchItem.h"
#include "ProblemDetails.h"
#include "SubscriptionData.h"
#include "AccessTokenRsp.h"
#include "nrf_event.hpp"
#include "nrf_profile.hpp"
#include "nrf_search_result.hpp"
#include "nrf_subscription.hpp"
#include "uint_generator.hpp"
namespace oai {
namespace nrf {
namespace app {
......@@ -62,6 +61,13 @@ class nrf_app {
}
}
/*
* Generate a random UUID for NRF instance
* @param [void]
* @return void
*/
void generate_uuid();
/*
* Handle a Register NF Instance request
* @param [const std::string &] nf_instance_id: Instance ID
......@@ -181,7 +187,8 @@ class nrf_app {
* @param [const std::string &] requester_nf_type: Requester NF type
* @param [const std::string &] requester_nf_instance_id: Requester NF
* instance id
* @param [uint32_t &] limit_nfs: Maximum number of NFProfiles to be returned in the response:
* @param [uint32_t &] limit_nfs: Maximum number of NFProfiles to be returned
* in the response:
* @param [std::string &] search_id: Store search result ID
* @param [int &] http_code: HTTP code used to return to the consumer
* @param [const uint8_t] http_version: HTTP version
......@@ -416,7 +423,8 @@ class nrf_app {
/*
* Add a search result to the DB
* @param [const std::string &] id: Search ID
* @param [const std::shared_ptr<nrf_search_result> &] s: Pointer to the search result
* @param [const std::shared_ptr<nrf_search_result> &] s: Pointer to the
* search result
* @return void
*/
bool add_search_result(const std::string &id,
......@@ -425,13 +433,15 @@ class nrf_app {
/*
* Find a search result with its ID
* @param [const std::string &] search_id: Search ID
* @param [std::shared_ptr<nrf_search_result> &] s: Pointer to the search result
* @param [std::shared_ptr<nrf_search_result> &] s: Pointer to the search
* result
* @return true if found, otherwise false
*/
bool find_search_result(const std::string &search_id,
std::shared_ptr<nrf_search_result> &p) const;
private:
std::string instance_id; // NRF instance id
std::map<std::string, std::shared_ptr<nrf_profile>> instance_id2nrf_profile;
mutable std::shared_mutex m_instance_id2nrf_profile;
......
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