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

code cleanup

parent db6b092a
......@@ -71,18 +71,6 @@ void spgwu_nrf_task(void* args_p) {
std::shared_ptr<itti_msg> shared_msg = itti_inst->receive_msg(task_id);
auto* msg = shared_msg.get();
switch (msg->msg_type) {
case NRF_REGISTER_NF_INSTANCE_REQUEST:
spgwu_nrf_inst->register_nf_instance(
std::static_pointer_cast<itti_nrf_register_nf_instance_request>(
shared_msg));
break;
case NRF_DEREGISTER_NF_INSTANCE:
spgwu_nrf_inst->deregister_nf_instance(
std::static_pointer_cast<itti_nrf_deregister_nf_instance>(
shared_msg));
break;
case TIME_OUT:
if (itti_msg_timeout* to = dynamic_cast<itti_msg_timeout*>(msg)) {
Logger::spgwu_app().info("TIME-OUT event timer id %d", to->timer_id);
......@@ -178,9 +166,7 @@ void spgwu_nrf::send_register_nf_instance(std::string& url) {
"Response from NRF, Json data: \n %s", response_data.dump().c_str());
// Update NF profile
upf_profile.from_json(response_data);
Logger::spgwu_app().debug("Updated UPF profile");
upf_profile.display();
......@@ -250,103 +236,9 @@ void spgwu_nrf::send_update_nf_instance(
}
//-----------------------------------------------------------------------------------------------------
void spgwu_nrf::register_nf_instance(
std::shared_ptr<itti_nrf_register_nf_instance_request> msg) {
Logger::spgwu_app().debug(
"Send NF Instance Registration to NRF (HTTP version %d)",
msg->http_version);
nlohmann::json json_data = {};
msg->profile.to_json(json_data);
std::string url = "192.168.1.23:8080";
// std::string(inet_ntoa(*((struct in_addr
// *)&smf_cfg.nrf_addr.ipv4_addr))) +
// ":" + std::to_string(smf_cfg.nrf_addr.port)
url = url + NNRF_NFM_BASE + "v1" + NNRF_NF_REGISTER_URL +
msg->profile.get_nf_instance_id();
void spgwu_nrf::send_deregister_nf_instance(std::string& url) {
Logger::spgwu_app().debug("Send NF De-register to NRF");
Logger::spgwu_app().debug(
"Send NF Instance Registration to NRF (NRF URL %s)", url.c_str());
std::string body = json_data.dump();
Logger::spgwu_app().debug(
"Send NF Instance Registration to NRF, msg body: \n %s", body.c_str());
curl_global_init(CURL_GLOBAL_ALL);
CURL* curl = curl = curl_easy_init();
if (curl) {
CURLcode res = {};
struct curl_slist* headers = nullptr;
// headers = curl_slist_append(headers, "charsets: utf-8");
headers = curl_slist_append(headers, "content-type: application/json");
curl_easy_setopt(curl, CURLOPT_HTTPHEADER, headers);
curl_easy_setopt(curl, CURLOPT_URL, url.c_str());
curl_easy_setopt(curl, CURLOPT_HTTPGET, 1);
curl_easy_setopt(curl, CURLOPT_CUSTOMREQUEST, "PUT");
curl_easy_setopt(curl, CURLOPT_TIMEOUT_MS, NRF_CURL_TIMEOUT_MS);
// Response information.
long httpCode = {0};
std::unique_ptr<std::string> httpData(new std::string());
curl_easy_setopt(curl, CURLOPT_WRITEFUNCTION, &callback);
curl_easy_setopt(curl, CURLOPT_WRITEDATA, httpData.get());
curl_easy_setopt(curl, CURLOPT_POSTFIELDSIZE, body.length());
curl_easy_setopt(curl, CURLOPT_POSTFIELDS, body.c_str());
res = curl_easy_perform(curl);
curl_easy_getinfo(curl, CURLINFO_RESPONSE_CODE, &httpCode);
Logger::spgwu_app().debug("Response from NRF, Http Code: %d", httpCode);
if (httpCode == 201) {
json response_data = {};
try {
response_data = json::parse(*httpData.get());
} catch (json::exception& e) {
Logger::spgwu_app().warn("Could not parse json from the NRF response");
}
Logger::spgwu_app().debug(
"Response from NRF, Json data: \n %s", response_data.dump().c_str());
// send response to APP to process
std::shared_ptr<itti_nrf_register_nf_instance_response> itti_msg =
std::make_shared<itti_nrf_register_nf_instance_response>(
TASK_SPGWU_NRF, TASK_SPGWU_APP);
itti_msg->http_response_code = httpCode;
itti_msg->http_version = msg->http_version;
Logger::spgwu_app().debug("Registered SMF profile (from NRF)");
itti_msg->profile.from_json(response_data);
int ret = itti_inst->send_msg(itti_msg);
if (RETURNok != ret) {
Logger::spgwu_app().error(
"Could not send ITTI message %s to task TASK_SPGWU_APP",
itti_msg->get_msg_name());
}
} else {
Logger::spgwu_app().warn("Could not get response from NRF");
}
curl_slist_free_all(headers);
curl_easy_cleanup(curl);
}
curl_global_cleanup();
}
//-----------------------------------------------------------------------------------------------------
void spgwu_nrf::deregister_nf_instance(
std::shared_ptr<itti_nrf_deregister_nf_instance> msg) {
Logger::spgwu_app().debug(
"Send NF De-register to NRF (HTTP version %d)", msg->http_version);
std::string url;
/*=
std::string(inet_ntoa(*((struct in_addr *)&smf_cfg.nrf_addr.ipv4_addr))) +
":" + std::to_string(smf_cfg.nrf_addr.port) + NNRF_NFM_BASE +
smf_cfg.nrf_addr.api_version + NNRF_NF_REGISTER_URL +
msg->smf_instance_id;
*/
Logger::spgwu_app().debug(
"Send NF De-register to NRF (NRF URL %s)", url.c_str());
......@@ -384,6 +276,7 @@ void spgwu_nrf::deregister_nf_instance(
void spgwu_nrf::generate_upf_profile() {
// generate UUID
generate_uuid();
//TODO: get hardcoded values from configuration file
upf_profile.set_nf_instance_id(upf_instance_id);
upf_profile.set_nf_instance_name("OAI-SMF");
upf_profile.set_nf_type("SMF");
......@@ -392,23 +285,19 @@ void spgwu_nrf::generate_upf_profile() {
upf_profile.set_nf_priority(1);
upf_profile.set_nf_capacity(100);
upf_profile.add_nf_ipv4_addresses(spgwu_cfg.s1_up.addr4);
/*
// SNSSAIS
// TODO: get SNSSAIS from Configuration file
snssai_t snssai = {};
snssai.sD = s.single_nssai.sD;
snssai.sST = s.single_nssai.sST;
snssai.sD = "123";
snssai.sST = 222;
upf_profile.add_snssai(snssai);
// SMF info
dnn_upf_info_item_t dnn_item = {.dnn = s.dnn};
// TODO: get UPF info from configuration file
dnn_upf_info_item_t dnn_item = {.dnn = "default"};
snssai_upf_info_item_t upf_info_item = {};
upf_info_item.dnn_upf_info_list.push_back(dnn_item);
upf_info_item.snssai.sD = s.single_nssai.sD;
upf_info_item.snssai.sST = s.single_nssai.sST;
upf_info_item.snssai.sD = "123";
upf_info_item.snssai.sST = 222;
upf_profile.add_upf_info_item(upf_info_item);
*/
// Display the profile
upf_profile.display();
}
......@@ -418,13 +307,11 @@ void spgwu_nrf::register_to_nrf() {
// create a NF profile to this instance
generate_upf_profile();
// register to NRF
//TODO: get NRF Addr from configuration file
std::string url = "192.168.1.23:8080";
// std::string(inet_ntoa(*((struct in_addr
// *)&smf_cfg.nrf_addr.ipv4_addr))) +
// ":" + std::to_string(smf_cfg.nrf_addr.port)
url = url + NNRF_NFM_BASE + "v1" + NNRF_NF_REGISTER_URL + upf_instance_id;
std::string url =
std::string(
inet_ntoa(*((struct in_addr*) &spgwu_cfg.nrf_addr.ipv4_addr))) +
":" + std::to_string(spgwu_cfg.nrf_addr.port) + NNRF_NFM_BASE +
spgwu_cfg.nrf_addr.api_version + NNRF_NF_REGISTER_URL + upf_instance_id;
send_register_nf_instance(url);
}
......@@ -433,40 +320,6 @@ void spgwu_nrf::generate_uuid() {
upf_instance_id = to_string(boost::uuids::random_generator()());
}
//------------------------------------------------------------------------------
void spgwu_nrf::trigger_nf_registration_request() {
Logger::spgwu_app().debug(
"Send ITTI msg to N11 task to trigger the registration request to NRF");
std::shared_ptr<itti_nrf_register_nf_instance_request> itti_msg =
std::make_shared<itti_nrf_register_nf_instance_request>(
TASK_SPGWU_APP, TASK_SPGWU_NRF);
itti_msg->profile = upf_profile;
int ret = itti_inst->send_msg(itti_msg);
if (RETURNok != ret) {
Logger::spgwu_app().error(
"Could not send ITTI message %s to task TASK_SPGWU_NRF",
itti_msg->get_msg_name());
}
}
//------------------------------------------------------------------------------
void spgwu_nrf::trigger_nf_deregistration() {
Logger::spgwu_app().debug(
"Send ITTI msg to N11 task to trigger the deregistration request to NRF");
std::shared_ptr<itti_nrf_deregister_nf_instance> itti_msg =
std::make_shared<itti_nrf_deregister_nf_instance>(
TASK_SPGWU_APP, TASK_SPGWU_NRF);
itti_msg->upf_instance_id = upf_instance_id;
int ret = itti_inst->send_msg(itti_msg);
if (RETURNok != ret) {
Logger::spgwu_app().error(
"Could not send ITTI message %s to task TASK_SPGWU_NRF",
itti_msg->get_msg_name());
}
}
//---------------------------------------------------------------------------------------------
void spgwu_nrf::timer_nrf_heartbeat_timeout(
timer_id_t timer_id, uint64_t arg2_user) {
......@@ -482,12 +335,11 @@ void spgwu_nrf::timer_nrf_heartbeat_timeout(
nlohmann::json item = patch_item.to_json();
json_data.push_back(item);
// TODO: to be updated to get NRF from configuration file
std::string url = "192.168.1.23:8080";
// std::string(inet_ntoa(*((struct in_addr
// *)&smf_cfg.nrf_addr.ipv4_addr))) +
// ":" + std::to_string(smf_cfg.nrf_addr.port)
url = url + NNRF_NFM_BASE + "v1" + NNRF_NF_REGISTER_URL + upf_instance_id;
std::string url =
std::string(
inet_ntoa(*((struct in_addr*) &spgwu_cfg.nrf_addr.ipv4_addr))) +
":" + std::to_string(spgwu_cfg.nrf_addr.port) + NNRF_NFM_BASE +
spgwu_cfg.nrf_addr.api_version + NNRF_NF_REGISTER_URL + upf_instance_id;
Logger::spgwu_app().debug(
"Set a timer to the next Heart-beat (%d)",
......@@ -503,7 +355,12 @@ void spgwu_nrf::timer_nrf_heartbeat_timeout(
//---------------------------------------------------------------------------------------------
void spgwu_nrf::timer_nrf_deregistration(
timer_id_t timer_id, uint64_t arg2_user) {
Logger::spgwu_app().debug(
"Send ITTI msg to N11 task to trigger NRF Deregistratino");
trigger_nf_deregistration();
Logger::spgwu_app().debug("Send NF De-registration to NRF");
std::string url =
std::string(
inet_ntoa(*((struct in_addr*) &spgwu_cfg.nrf_addr.ipv4_addr))) +
":" + std::to_string(spgwu_cfg.nrf_addr.port) + NNRF_NFM_BASE +
spgwu_cfg.nrf_addr.api_version + NNRF_NF_REGISTER_URL + upf_instance_id;
send_deregister_nf_instance(url);
}
......@@ -43,7 +43,6 @@ namespace spgwu {
#define TASK_SPGWU_NRF_TIMEOUT_NRF_HEARTBEAT (1)
#define TASK_SPGWU_NRF_TIMEOUT_NRF_DEREGISTRATION (2)
class spgwu_nrf {
private:
std::thread::id thread_id;
......@@ -55,40 +54,30 @@ class spgwu_nrf {
public:
spgwu_nrf();
spgwu_nrf(spgwu_nrf const &) = delete;
void operator=(spgwu_nrf const &) = delete;
spgwu_nrf(spgwu_nrf const&) = delete;
void operator=(spgwu_nrf const&) = delete;
/*
* Send NF instance registration to NRF
* @param [std::shared_ptr<itti_nrf_register_nf_instance_request>] msg:
* Content of message to be sent
* @param [std::string &] url: NRF's URL
* @return void
*/
void register_nf_instance(
std::shared_ptr<itti_nrf_register_nf_instance_request> msg);
void send_register_nf_instance(std::string &url);
void send_update_nf_instance(std::string &url, nlohmann::json &data);
void send_register_nf_instance(std::string& url);
/*
* Send NF instance update to NRF
* @param [std::shared_ptr<itti_nrf_update_nf_instance_request>] msg: Content
* of message to be sent
* Send NF instance registration to NRF
* @param [std::string &] url: NRF's URL
* @param [nlohmann::json &] data: Json data to be sent
* @return void
*/
void send_update_nf_instance(std::string& url, nlohmann::json& data);
/*
* Send NF deregister to NRF
* @param [std::shared_ptr<itti_nrf_deregister_nf_instance>] msg: Content
* of message to be sent
* @param [std::string &] url: NRF's URL
* @return void
*/
void deregister_nf_instance(
std::shared_ptr<itti_nrf_deregister_nf_instance> msg);
void send_deregister_nf_instance(std::string& url);
/*
* Trigger NF instance registration to NRF
......@@ -98,32 +87,26 @@ class spgwu_nrf {
void register_to_nrf();
/*
* Generate a random UUID for SMF instance
* Generate a random UUID for UPF instance
* @param [void]
* @return void
*/
void generate_uuid();
/*
* Generate a SMF profile for this instance
* Generate a UPF profile for this instance
* @param [void]
* @return void
*/
void generate_upf_profile();
/*
* Send request to N11 task to trigger NF instance registration to NRF
* @param [void]
* @return void
*/
void trigger_nf_registration_request();
/*
* Send request to N11 task to trigger NF instance deregistration to NRF
* @param [void]
* will be executed when NRF Heartbeat timer expires
* @param [timer_id_t] timer_id
* @param [uint64_t] arg2_user
* @return void
*/
void trigger_nf_deregistration();
void timer_nrf_heartbeat_timeout(timer_id_t timer_id, uint64_t arg2_user);
/*
* will be executed when NRF Heartbeat timer expires
......@@ -131,9 +114,7 @@ class spgwu_nrf {
* @param [uint64_t] arg2_user
* @return void
*/
void timer_nrf_heartbeat_timeout(timer_id_t timer_id, uint64_t arg2_user);
void timer_nrf_deregistration(timer_id_t timer_id, uint64_t arg2_user);
};
} // namespace smf
} // namespace spgwu
#endif /* FILE_SPGWU_NRF_HPP_SEEN */
......@@ -38,25 +38,27 @@ using namespace std;
using namespace spgwu;
//------------------------------------------------------------------------------
void spgwu_profile::set_nf_instance_id(const std::string &instance_id) {
void spgwu_profile::set_nf_instance_id(const std::string& instance_id) {
nf_instance_id = instance_id;
}
//------------------------------------------------------------------------------
void spgwu_profile::get_nf_instance_id(std::string &instance_id) const {
void spgwu_profile::get_nf_instance_id(std::string& instance_id) const {
instance_id = nf_instance_id;
}
//------------------------------------------------------------------------------
std::string spgwu_profile::get_nf_instance_id() const { return nf_instance_id; }
std::string spgwu_profile::get_nf_instance_id() const {
return nf_instance_id;
}
//------------------------------------------------------------------------------
void spgwu_profile::set_nf_instance_name(const std::string &instance_name) {
void spgwu_profile::set_nf_instance_name(const std::string& instance_name) {
nf_instance_name = instance_name;
}
//------------------------------------------------------------------------------
void spgwu_profile::get_nf_instance_name(std::string &instance_name) const {
void spgwu_profile::get_nf_instance_name(std::string& instance_name) const {
instance_name = nf_instance_name;
}
......@@ -66,90 +68,118 @@ std::string spgwu_profile::get_nf_instance_name() const {
}
//------------------------------------------------------------------------------
void spgwu_profile::set_nf_type(const std::string &type) { nf_type = type; }
void spgwu_profile::set_nf_type(const std::string& type) {
nf_type = type;
}
//------------------------------------------------------------------------------
std::string spgwu_profile::get_nf_type() const { return nf_type; }
std::string spgwu_profile::get_nf_type() const {
return nf_type;
}
//------------------------------------------------------------------------------
void spgwu_profile::set_nf_status(const std::string &status) {
void spgwu_profile::set_nf_status(const std::string& status) {
nf_status = status;
}
//------------------------------------------------------------------------------
void spgwu_profile::get_nf_status(std::string &status) const {
void spgwu_profile::get_nf_status(std::string& status) const {
status = nf_status;
}
//------------------------------------------------------------------------------
std::string spgwu_profile::get_nf_status() const { return nf_status; }
std::string spgwu_profile::get_nf_status() const {
return nf_status;
}
//------------------------------------------------------------------------------
void spgwu_profile::set_nf_heartBeat_timer(const int32_t &timer) {
void spgwu_profile::set_nf_heartBeat_timer(const int32_t& timer) {
heartBeat_timer = timer;
}
//------------------------------------------------------------------------------
void spgwu_profile::get_nf_heartBeat_timer(int32_t &timer) const {
void spgwu_profile::get_nf_heartBeat_timer(int32_t& timer) const {
timer = heartBeat_timer;
}
//------------------------------------------------------------------------------
int32_t spgwu_profile::get_nf_heartBeat_timer() const { return heartBeat_timer; }
int32_t spgwu_profile::get_nf_heartBeat_timer() const {
return heartBeat_timer;
}
//------------------------------------------------------------------------------
void spgwu_profile::set_nf_priority(const uint16_t &p) { priority = p; }
void spgwu_profile::set_nf_priority(const uint16_t& p) {
priority = p;
}
//------------------------------------------------------------------------------
void spgwu_profile::get_nf_priority(uint16_t &p) const { p = priority; }
void spgwu_profile::get_nf_priority(uint16_t& p) const {
p = priority;
}
//------------------------------------------------------------------------------
uint16_t spgwu_profile::get_nf_priority() const { return priority; }
uint16_t spgwu_profile::get_nf_priority() const {
return priority;
}
//------------------------------------------------------------------------------
void spgwu_profile::set_nf_capacity(const uint16_t &c) { capacity = c; }
void spgwu_profile::set_nf_capacity(const uint16_t& c) {
capacity = c;
}
//------------------------------------------------------------------------------
void spgwu_profile::get_nf_capacity(uint16_t &c) const { c = capacity; }
void spgwu_profile::get_nf_capacity(uint16_t& c) const {
c = capacity;
}
//------------------------------------------------------------------------------
uint16_t spgwu_profile::get_nf_capacity() const { return capacity; }
uint16_t spgwu_profile::get_nf_capacity() const {
return capacity;
}
//------------------------------------------------------------------------------
void spgwu_profile::set_nf_snssais(const std::vector<snssai_t> &s) {
void spgwu_profile::set_nf_snssais(const std::vector<snssai_t>& s) {
snssais = s;
}
//------------------------------------------------------------------------------
void spgwu_profile::get_nf_snssais(std::vector<snssai_t> &s) const {
void spgwu_profile::get_nf_snssais(std::vector<snssai_t>& s) const {
s = snssais;
}
//------------------------------------------------------------------------------
void spgwu_profile::add_snssai(const snssai_t &s) { snssais.push_back(s); }
void spgwu_profile::add_snssai(const snssai_t& s) {
snssais.push_back(s);
}
//------------------------------------------------------------------------------
void spgwu_profile::set_nf_ipv4_addresses(const std::vector<struct in_addr> &a) {
void spgwu_profile::set_nf_ipv4_addresses(
const std::vector<struct in_addr>& a) {
ipv4_addresses = a;
}
//------------------------------------------------------------------------------
void spgwu_profile::add_nf_ipv4_addresses(const struct in_addr &a) {
void spgwu_profile::add_nf_ipv4_addresses(const struct in_addr& a) {
ipv4_addresses.push_back(a);
}
//------------------------------------------------------------------------------
void spgwu_profile::get_nf_ipv4_addresses(std::vector<struct in_addr> &a) const {
void spgwu_profile::get_nf_ipv4_addresses(
std::vector<struct in_addr>& a) const {
a = ipv4_addresses;
}
//------------------------------------------------------------------------------
void spgwu_profile::set_upf_info(const upf_info_t &s) { upf_info = s; }
void spgwu_profile::set_upf_info(const upf_info_t& s) {
upf_info = s;
}
//------------------------------------------------------------------------------
void spgwu_profile::add_upf_info_item(const snssai_upf_info_item_t &s) {
void spgwu_profile::add_upf_info_item(const snssai_upf_info_item_t& s) {
upf_info.snssai_upf_info_list.push_back(s);
}
//------------------------------------------------------------------------------
void spgwu_profile::get_upf_info(upf_info_t &s) const { s = upf_info; }
void spgwu_profile::get_upf_info(upf_info_t& s) const {
s = upf_info;
}
//------------------------------------------------------------------------------
void spgwu_profile::display() const {
......@@ -185,8 +215,8 @@ void spgwu_profile::display() const {
}
for (auto s : upf_info.snssai_upf_info_list) {
Logger::spgwu_app().debug("\t\tParameters supported by the UPF:");
Logger::spgwu_app().debug("\t\t\tSNSSAI (SST %d, SD %s)", s.snssai.sST,
s.snssai.sD.c_str());
Logger::spgwu_app().debug(
"\t\t\tSNSSAI (SST %d, SD %s)", s.snssai.sST, s.snssai.sD.c_str());
for (auto d : s.dnn_upf_info_list) {
Logger::spgwu_app().debug("\t\t\tDNN %s", d.dnn.c_str());
}
......@@ -194,7 +224,7 @@ void spgwu_profile::display() const {
}
//------------------------------------------------------------------------------
void spgwu_profile::to_json(nlohmann::json &data) const {
void spgwu_profile::to_json(nlohmann::json& data) const {
data["nfInstanceId"] = nf_instance_id;
data["nfInstanceName"] = nf_instance_name;
data["nfType"] = nf_type;
......@@ -239,7 +269,7 @@ void spgwu_profile::to_json(nlohmann::json &data) const {
}
//------------------------------------------------------------------------------
void spgwu_profile::from_json(const nlohmann::json &data) {
void spgwu_profile::from_json(const nlohmann::json& data) {
if (data.find("nfInstanceId") != data.end()) {
nf_instance_id = data["nfInstanceId"].get<std::string>();
}
......@@ -281,8 +311,8 @@ void spgwu_profile::from_json(const nlohmann::json &data) {
if (inet_pton(AF_INET, util::trim(address).c_str(), buf_in_addr) == 1) {
memcpy(&addr4, buf_in_addr, sizeof(struct in_addr));
} else {
Logger::spgwu_app().warn("Address conversion: Bad value %s",
util::trim(address).c_str());
Logger::spgwu_app().warn(
"Address conversion: Bad value %s", util::trim(address).c_str());
}
// Logger::spgwu_app().debug("\tIPv4 Addr: %s", address.c_str());
add_nf_ipv4_addresses(addr4);
......@@ -333,7 +363,8 @@ void spgwu_profile::from_json(const nlohmann::json &data) {
//------------------------------------------------------------------------------
void spgwu_profile::handle_heartbeart_timeout(uint64_t ms) {
Logger::spgwu_app().info("Handle heartbeart timeout profile %s, time %d",
nf_instance_id.c_str(), ms);
Logger::spgwu_app().info(
"Handle heartbeart timeout profile %s, time %d", nf_instance_id.c_str(),
ms);
set_nf_status("SUSPENDED");
}
......@@ -44,7 +44,7 @@
namespace spgwu {
//using namespace std;
// using namespace std;
class spgwu_profile : public std::enable_shared_from_this<spgwu_profile> {
public:
......@@ -59,7 +59,7 @@ class spgwu_profile : public std::enable_shared_from_this<spgwu_profile> {
nf_status = "";
}
spgwu_profile(const std::string &id)
spgwu_profile(const std::string& id)
: nf_instance_id(id),
heartBeat_timer(0),
snssais(),
......@@ -71,7 +71,7 @@ class spgwu_profile : public std::enable_shared_from_this<spgwu_profile> {
nf_status = "";
}
spgwu_profile &operator=(const spgwu_profile &s) {
spgwu_profile& operator=(const spgwu_profile& s) {
nf_instance_id = s.nf_instance_id;
heartBeat_timer = s.heartBeat_timer;
snssais = s.snssais;
......@@ -94,13 +94,13 @@ class spgwu_profile : public std::enable_shared_from_this<spgwu_profile> {
* @param [const std::string &] instance_id: instance id
* @return void
*/
void set_nf_instance_id(const std::string &instance_id);
void set_nf_instance_id(const std::string& instance_id);
/*
* Get NF instance ID
* @param [std::string &] instance_id: store instance id
* @return void:
*/
void get_nf_instance_id(std::string &instance_id) const;
void get_nf_instance_id(std::string& instance_id) const;
/*
* Get NF instance ID
......@@ -114,14 +114,14 @@ class spgwu_profile : public std::enable_shared_from_this<spgwu_profile> {
* @param [const std::string &] instance_name: instance name
* @return void
*/
void set_nf_instance_name(const std::string &instance_name);
void set_nf_instance_name(const std::string& instance_name);
/*
* Get NF instance ID
* @param [std::string &] instance_name: store instance name
* @return void:
*/
void get_nf_instance_name(std::string &instance_name) const;
void get_nf_instance_name(std::string& instance_name) const;
/*
* Get NF instance name
......@@ -135,14 +135,14 @@ class spgwu_profile : public std::enable_shared_from_this<spgwu_profile> {
* @param [const std::string &] status: instance status
* @return void
*/
void set_nf_status(const std::string &status);
void set_nf_status(const std::string& status);
/*
* Get NF instance status
* @param [std::string &] status: store instance status
* @return void:
*/
void get_nf_status(std::string &status) const;
void get_nf_status(std::string& status) const;
/*
* Get NF status
......@@ -163,21 +163,21 @@ class spgwu_profile : public std::enable_shared_from_this<spgwu_profile> {
* @param [const nf_type_t &] type: nf type
* @return void
*/
void set_nf_type(const std::string &type);
void set_nf_type(const std::string& type);
/*
* Set NF instance heartBeat_timer
* @param [const std::string &] timer: heartBeat_timer
* @return void
*/
void set_nf_heartBeat_timer(const int32_t &timer);
void set_nf_heartBeat_timer(const int32_t& timer);
/*
* Get NF instance heartBeat_timer
* @param [std::string &] timer: store heartBeat_timer
* @return void:
*/
void get_nf_heartBeat_timer(int32_t &timer) const;
void get_nf_heartBeat_timer(int32_t& timer) const;
/*
* Get NF heartBeat_timer
......@@ -191,14 +191,14 @@ class spgwu_profile : public std::enable_shared_from_this<spgwu_profile> {
* @param [const uint16_t] p: instance priority
* @return void
*/
void set_nf_priority(const uint16_t &p);
void set_nf_priority(const uint16_t& p);
/*
* Get NF instance priority
* @param [uint16_t] p: store instance priority
* @return void:
*/
void get_nf_priority(uint16_t &p) const;
void get_nf_priority(uint16_t& p) const;
/*
* Get NF instance priority
......@@ -212,14 +212,14 @@ class spgwu_profile : public std::enable_shared_from_this<spgwu_profile> {
* @param [const uint16_t] c: instance capacity
* @return void
*/
void set_nf_capacity(const uint16_t &c);
void set_nf_capacity(const uint16_t& c);
/*
* Get NF instance priority
* @param [uint16_t ] c: store instance capacity
* @return void:
*/
void get_nf_capacity(uint16_t &c) const;
void get_nf_capacity(uint16_t& c) const;
/*
* Get NF instance priority
......@@ -233,63 +233,63 @@ class spgwu_profile : public std::enable_shared_from_this<spgwu_profile> {
* @param [std::vector<snssai_t> &] s: SNSSAIs
* @return void
*/
void set_nf_snssais(const std::vector<snssai_t> &s);
void set_nf_snssais(const std::vector<snssai_t>& s);
/*
* Add SNSSAI
* @param [snssai_t &] s: SNSSAI
* @return void
*/
void add_snssai(const snssai_t &s);
void add_snssai(const snssai_t& s);
/*
* Get NF instance SNSSAIs
* @param [std::vector<snssai_t> &] s: store instance's SNSSAIs
* @return void:
*/
void get_nf_snssais(std::vector<snssai_t> &s) const;
void get_nf_snssais(std::vector<snssai_t>& s) const;
/*
* Set NF instance ipv4_addresses
* @param [std::vector<struct in_addr> &] a: ipv4_addresses
* @return void
*/
void set_nf_ipv4_addresses(const std::vector<struct in_addr> &a);
void set_nf_ipv4_addresses(const std::vector<struct in_addr>& a);
/*
* Add an IPv4 address to the list of addresses
* @param [const struct in_addr &] a: ipv4_address
* @return void
*/
void add_nf_ipv4_addresses(const struct in_addr &a);
void add_nf_ipv4_addresses(const struct in_addr& a);
/*
* Get NF instance ipv4_addresses
* @param [std::vector<struct in_addr> &] a: store instance's ipv4_addresses
* @return void:
*/
void get_nf_ipv4_addresses(std::vector<struct in_addr> &a) const;
void get_nf_ipv4_addresses(std::vector<struct in_addr>& a) const;
/*
* Set upf info
* @param [upf_info_t &] s: upf info
* @return void
*/
void set_upf_info(const upf_info_t &s);
void set_upf_info(const upf_info_t& s);
/*
* Add an snssai_upf_info_item to the upf info
* @param [const snssai_upf_info_item_t &] s: snssai_smf_info_item
* @return void
*/
void add_upf_info_item(const snssai_upf_info_item_t &s);
void add_upf_info_item(const snssai_upf_info_item_t& s);
/*
* Get NF instance smf info
* @param [smf_info_t &] s: store instance's smf info
* @return void:
*/
void get_upf_info(upf_info_t &s) const;
void get_upf_info(upf_info_t& s) const;
/*
* Print related-information for NF profile
......@@ -303,14 +303,14 @@ class spgwu_profile : public std::enable_shared_from_this<spgwu_profile> {
* @param [nlohmann::json &] data: Json data
* @return void
*/
void to_json(nlohmann::json &data) const;
void to_json(nlohmann::json& data) const;
/*
* Covert from a json represetation to SMF profile
* @param [nlohmann::json &] data: Json data
* @return void
*/
void from_json(const nlohmann::json &data);
void from_json(const nlohmann::json& data);
/*
* Handle heartbeart timeout event
......
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