Commit 48e724fc authored by Tien-Thinh Nguyen's avatar Tien-Thinh Nguyen

Get NetworkSlice from NSSF (code cleanup)

parent b1e2e4ea
......@@ -87,6 +87,9 @@ amf_app::amf_app(const amf_config& amf_cfg)
throw;
}
// Generate an AMF profile (including NF instance)
generate_amf_profile();
// Register to NRF if needed
if (amf_cfg.support_features.enable_nf_registration) register_to_nrf();
......@@ -604,11 +607,6 @@ void amf_app::handle_itti_message(itti_sbi_n1_message_notification& itti_msg) {
return;
}
// AMF Client response handlers
//------------------------------------------------------------------------------
void amf_app::handle_post_sm_context_response_error_400() {
Logger::amf_app().error("Post SM context response error 400");
}
//------------------------------------------------------------------------------
uint32_t amf_app::generate_tmsi() {
......@@ -820,10 +818,13 @@ void amf_app::generate_amf_profile() {
nf_instance_profile.display();
}
//---------------------------------------------------------------------------------------------
std::string amf_app::get_nf_instance() const {
return amf_instance_id;
}
//---------------------------------------------------------------------------------------------
void amf_app::register_to_nrf() {
// create a NF profile to this instance
generate_amf_profile();
// send request to N11 to send NF registration to NRF
trigger_nf_registration_request();
}
......
......@@ -75,6 +75,22 @@ class amf_app {
util::uint_generator<uint32_t> tmsi_generator;
std::map<long, std::shared_ptr<ue_context>> amf_ue_ngap_id2ue_ctx;
mutable std::shared_mutex m_amf_ue_ngap_id2ue_ctx;
std::map<std::string, std::shared_ptr<ue_context>> ue_ctx_key;
mutable std::shared_mutex m_ue_ctx_key;
std::map<std::string, std::shared_ptr<ue_context>> supi2ue_ctx;
mutable std::shared_mutex m_supi2ue_ctx;
mutable std::shared_mutex m_curl_handle_responses_n2_sm;
std::map<uint32_t, boost::shared_ptr<boost::promise<std::string>>>
curl_handle_responses_n2_sm;
mutable std::shared_mutex m_curl_handle_responses_n11;
std::map<uint32_t, boost::shared_ptr<boost::promise<nlohmann::json>>>
curl_handle_responses_n11;
public:
explicit amf_app(const amf_config& amf_cfg);
amf_app(amf_app const&) = delete;
......@@ -114,9 +130,7 @@ class amf_app {
bool get_pdu_sessions_context(
const string& supi,
std::vector<std::shared_ptr<pdu_session_context>>& sessions_ctx);
// SMF Client response handlers
void handle_post_sm_context_response_error_400();
// others
uint32_t generate_tmsi();
bool generate_5g_guti(
uint32_t ranid, long amfid, std::string& mcc, std::string& mnc,
......@@ -277,22 +291,7 @@ class amf_app {
void trigger_process_response(uint32_t pid, std::string n2_sm);
void trigger_process_response(uint32_t pid, nlohmann::json& json_data);
private:
std::map<long, std::shared_ptr<ue_context>> amf_ue_ngap_id2ue_ctx;
mutable std::shared_mutex m_amf_ue_ngap_id2ue_ctx;
std::map<std::string, std::shared_ptr<ue_context>> ue_ctx_key;
mutable std::shared_mutex m_ue_ctx_key;
std::map<std::string, std::shared_ptr<ue_context>> supi2ue_ctx;
mutable std::shared_mutex m_supi2ue_ctx;
mutable std::shared_mutex m_curl_handle_responses_n2_sm;
std::map<uint32_t, boost::shared_ptr<boost::promise<std::string>>>
curl_handle_responses_n2_sm;
mutable std::shared_mutex m_curl_handle_responses_n11;
std::map<uint32_t, boost::shared_ptr<boost::promise<nlohmann::json>>>
curl_handle_responses_n11;
std::string get_nf_instance() const;
};
} // namespace amf_application
......
......@@ -3718,11 +3718,13 @@ bool amf_n1::reroute_registration_request(std::shared_ptr<nas_context>& nc) {
return false;
}
// Process NS selection to select the appropriate AMF
std::string nf_instance_id = {};
slice_info_for_registration_t slice_info = {};
// TODO: use from OpenAPI
authorized_network_slice_info_t authorized_network_slice_info = {};
oai::amf::model::SliceInfoForRegistration slice_info = {};
if (!get_network_slice_selection(
nf_instance_id, slice_info, authorized_network_slice_info)) {
nc, amf_app_inst->get_nf_instance(), slice_info,
authorized_network_slice_info)) {
return false;
}
std::string target_amf = {};
......@@ -3814,9 +3816,16 @@ bool amf_n1::get_slice_selection_subscription_data_from_conf_file(
//------------------------------------------------------------------------------
bool amf_n1::get_network_slice_selection(
const std::string& nf_instance_id,
slice_info_for_registration_t& slice_info,
authorized_network_slice_info_t& authorized_network_slice_info) const {
std::shared_ptr<nas_context>& nc, const std::string& nf_instance_id,
oai::amf::model::SliceInfoForRegistration& slice_info,
authorized_network_slice_info_t& authorized_network_slice_info) {
std::shared_ptr<ue_context> uc = {};
if (!find_ue_context(
nc.get()->ran_ue_ngap_id, nc.get()->amf_ue_ngap_id, uc)) {
Logger::amf_n1().warn("Cannot find the UE context");
return false;
}
if (amf_cfg.support_features.enable_external_nssf) {
// Get Authorized Network Slice Info from an external NSSF
......@@ -3837,6 +3846,8 @@ bool amf_n1::get_network_slice_selection(
itti_msg->nf_instance_id = nf_instance_id;
itti_msg->slice_info = slice_info;
itti_msg->promise_id = promise_id;
itti_msg->plmn.mcc = uc.get()->cgi.mcc;
itti_msg->plmn.mnc = uc.get()->cgi.mnc;
int ret = itti_inst->send_msg(itti_msg);
if (0 != ret) {
......@@ -3878,7 +3889,7 @@ bool amf_n1::get_network_slice_selection(
//------------------------------------------------------------------------------
bool amf_n1::get_network_slice_selection_from_conf_file(
const std::string& nf_instance_id,
slice_info_for_registration_t& slice_info,
oai::amf::model::SliceInfoForRegistration& slice_info,
authorized_network_slice_info_t& authorized_network_slice_info) const {
// TODO: Get Authorized Network Slice Info from local configuration file
......
......@@ -50,6 +50,7 @@
#include "RegistrationAccept.hpp"
#include "ue_context.hpp"
#include "itti.hpp"
#include "SliceInfoForRegistration.h"
namespace amf_application {
......@@ -227,12 +228,12 @@ class amf_n1 {
bool check_requested_nssai(
const std::shared_ptr<nas_context>& nc, const nssai_t& nssai) const;
bool get_network_slice_selection(
const std::string& nf_instance_id,
slice_info_for_registration_t& slice_info,
authorized_network_slice_info_t& authorized_network_slice_info) const;
std::shared_ptr<nas_context>& nc, const std::string& nf_instance_id,
oai::amf::model::SliceInfoForRegistration& slice_info,
authorized_network_slice_info_t& authorized_network_slice_info);
bool get_network_slice_selection_from_conf_file(
const std::string& nf_instance_id,
slice_info_for_registration_t& slice_info,
oai::amf::model::SliceInfoForRegistration& slice_info,
authorized_network_slice_info_t& authorized_network_slice_info) const;
void send_n1_message_notity(
......
This diff is collapsed.
......@@ -70,7 +70,6 @@ class amf_n11 {
bool smf_selection_from_configuration(
std::string& smf_addr, std::string& smf_api_version);
void handle_post_sm_context_response_error_400();
void handle_post_sm_context_response_error(
long code, std::string cause, bstring n1sm, std::string supi,
uint8_t pdu_session_id);
......
......@@ -29,6 +29,7 @@
#include "bstrlib.h"
#include "itti_msg.hpp"
#include "3gpp_29.531.h"
#include "SliceInfoForRegistration.h"
class itti_msg_n11 : public itti_msg {
public:
......@@ -222,7 +223,8 @@ class itti_n11_network_slice_selection_information : public itti_msg_n11 {
uint8_t http_version;
std::string nf_instance_id;
slice_info_for_registration_t slice_info;
oai::amf::model::SliceInfoForRegistration slice_info;
plmn_t plmn;
uint32_t promise_id;
};
......
......@@ -12,6 +12,9 @@
*/
#include "AllowedNssai.h"
#include "Helpers.h"
#include <sstream>
namespace oai {
namespace amf {
......@@ -19,10 +22,63 @@ namespace model {
AllowedNssai::AllowedNssai() {}
AllowedNssai::~AllowedNssai() {}
void AllowedNssai::validate() const {
std::stringstream msg;
// if (!validate(msg))
// {
// throw oai::nssf_server::helpers::ValidationException(msg.str());
// }
}
bool AllowedNssai::validate(std::stringstream& msg) const {
return validate(msg, "");
}
bool AllowedNssai::validate(
std::stringstream& msg, const std::string& pathPrefix) const {
bool success = true;
const std::string _pathPrefix =
pathPrefix.empty() ? "AllowedNssai" : pathPrefix;
/* AllowedSnssaiList */ {
const std::vector<AllowedSnssai>& value = m_AllowedSnssaiList;
const std::string currentValuePath = _pathPrefix + ".allowedSnssaiList";
if (value.size() < 1) {
success = false;
msg << currentValuePath << ": must have at least 1 elements;";
}
{ // Recursive validation of array elements
const std::string oldValuePath = currentValuePath;
int i = 0;
for (const AllowedSnssai& value : value) {
const std::string currentValuePath =
oldValuePath + "[" + std::to_string(i) + "]";
success =
value.validate(msg, currentValuePath + ".allowedSnssaiList") &&
success;
i++;
}
}
}
void AllowedNssai::validate() {
// TODO: implement validation
return success;
}
bool AllowedNssai::operator==(const AllowedNssai& rhs) const {
return
(getAllowedSnssaiList() == rhs.getAllowedSnssaiList()) // &&
// (getAccessType() == rhs.getAccessType())
;
}
bool AllowedNssai::operator!=(const AllowedNssai& rhs) const {
return !(*this == rhs);
}
void to_json(nlohmann::json& j, const AllowedNssai& o) {
......@@ -36,9 +92,13 @@ void from_json(const nlohmann::json& j, AllowedNssai& o) {
j.at("accessType").get_to(o.m_AccessType);
}
std::vector<AllowedSnssai>& AllowedNssai::getAllowedSnssaiList() {
std::vector<AllowedSnssai> AllowedNssai::getAllowedSnssaiList() const {
return m_AllowedSnssaiList;
}
void AllowedNssai::setAllowedSnssaiList(
std::vector<AllowedSnssai> const& value) {
m_AllowedSnssaiList = value;
}
AccessType AllowedNssai::getAccessType() const {
return m_AccessType;
}
......
......@@ -34,9 +34,28 @@ namespace model {
class AllowedNssai {
public:
AllowedNssai();
virtual ~AllowedNssai();
virtual ~AllowedNssai() = default;
void validate();
/// <summary>
/// Validate the current data in the model. Throws a ValidationException on
/// failure.
/// </summary>
void validate() const;
/// <summary>
/// Validate the current data in the model. Returns false on error and writes
/// an error message into the given stringstream.
/// </summary>
bool validate(std::stringstream& msg) const;
/// <summary>
/// Helper overload for validate. Used when one model stores another model and
/// calls it's validate. Not meant to be called outside that case.
/// </summary>
bool validate(std::stringstream& msg, const std::string& pathPrefix) const;
bool operator==(const AllowedNssai& rhs) const;
bool operator!=(const AllowedNssai& rhs) const;
/////////////////////////////////////////////
/// AllowedNssai members
......@@ -44,7 +63,8 @@ class AllowedNssai {
/// <summary>
///
/// </summary>
std::vector<AllowedSnssai>& getAllowedSnssaiList();
std::vector<AllowedSnssai> getAllowedSnssaiList() const;
void setAllowedSnssaiList(std::vector<AllowedSnssai> const& value);
/// <summary>
///
/// </summary>
......
......@@ -12,6 +12,9 @@
*/
#include "AllowedSnssai.h"
#include "Helpers.h"
#include <sstream>
namespace oai {
namespace amf {
......@@ -22,16 +25,75 @@ AllowedSnssai::AllowedSnssai() {
m_MappedHomeSnssaiIsSet = false;
}
AllowedSnssai::~AllowedSnssai() {}
void AllowedSnssai::validate() const {
std::stringstream msg;
// if (!validate(msg))
// {
// throw oai::nssf_server::helpers::ValidationException(msg.str());
// }
}
bool AllowedSnssai::validate(std::stringstream& msg) const {
return validate(msg, "");
}
bool AllowedSnssai::validate(
std::stringstream& msg, const std::string& pathPrefix) const {
bool success = true;
const std::string _pathPrefix =
pathPrefix.empty() ? "AllowedSnssai" : pathPrefix;
if (nsiInformationListIsSet()) {
const std::vector<NsiInformation>& value = m_NsiInformationList;
const std::string currentValuePath = _pathPrefix + ".nsiInformationList";
if (value.size() < 1) {
success = false;
msg << currentValuePath << ": must have at least 1 elements;";
}
{ // Recursive validation of array elements
const std::string oldValuePath = currentValuePath;
int i = 0;
for (const NsiInformation& value : value) {
const std::string currentValuePath =
oldValuePath + "[" + std::to_string(i) + "]";
success =
value.validate(msg, currentValuePath + ".nsiInformationList") &&
success;
i++;
}
}
}
void AllowedSnssai::validate() {
// TODO: implement validation
return success;
}
bool AllowedSnssai::operator==(const AllowedSnssai& rhs) const {
return
(getAllowedSnssai() == rhs.getAllowedSnssai()) &&
((!nsiInformationListIsSet() && !rhs.nsiInformationListIsSet()) ||
(nsiInformationListIsSet() && rhs.nsiInformationListIsSet() &&
getNsiInformationList() == rhs.getNsiInformationList())) &&
((!mappedHomeSnssaiIsSet() && !rhs.mappedHomeSnssaiIsSet()) ||
(mappedHomeSnssaiIsSet() && rhs.mappedHomeSnssaiIsSet() &&
getMappedHomeSnssai() == rhs.getMappedHomeSnssai()))
;
}
bool AllowedSnssai::operator!=(const AllowedSnssai& rhs) const {
return !(*this == rhs);
}
void to_json(nlohmann::json& j, const AllowedSnssai& o) {
j = nlohmann::json();
j["allowedSnssai"] = o.m_AllowedSnssai;
if (o.nsiInformationListIsSet())
if (o.nsiInformationListIsSet() || !o.m_NsiInformationList.empty())
j["nsiInformationList"] = o.m_NsiInformationList;
if (o.mappedHomeSnssaiIsSet()) j["mappedHomeSnssai"] = o.m_MappedHomeSnssai;
}
......@@ -54,9 +116,14 @@ Snssai AllowedSnssai::getAllowedSnssai() const {
void AllowedSnssai::setAllowedSnssai(Snssai const& value) {
m_AllowedSnssai = value;
}
std::vector<NsiInformation>& AllowedSnssai::getNsiInformationList() {
std::vector<NsiInformation> AllowedSnssai::getNsiInformationList() const {
return m_NsiInformationList;
}
void AllowedSnssai::setNsiInformationList(
std::vector<NsiInformation> const& value) {
m_NsiInformationList = value;
m_NsiInformationListIsSet = true;
}
bool AllowedSnssai::nsiInformationListIsSet() const {
return m_NsiInformationListIsSet;
}
......
......@@ -34,9 +34,28 @@ namespace model {
class AllowedSnssai {
public:
AllowedSnssai();
virtual ~AllowedSnssai();
virtual ~AllowedSnssai() = default;
void validate();
/// <summary>
/// Validate the current data in the model. Throws a ValidationException on
/// failure.
/// </summary>
void validate() const;
/// <summary>
/// Validate the current data in the model. Returns false on error and writes
/// an error message into the given stringstream.
/// </summary>
bool validate(std::stringstream& msg) const;
/// <summary>
/// Helper overload for validate. Used when one model stores another model and
/// calls it's validate. Not meant to be called outside that case.
/// </summary>
bool validate(std::stringstream& msg, const std::string& pathPrefix) const;
bool operator==(const AllowedSnssai& rhs) const;
bool operator!=(const AllowedSnssai& rhs) const;
/////////////////////////////////////////////
/// AllowedSnssai members
......@@ -49,7 +68,8 @@ class AllowedSnssai {
/// <summary>
///
/// </summary>
std::vector<NsiInformation>& getNsiInformationList();
std::vector<NsiInformation> getNsiInformationList() const;
void setNsiInformationList(std::vector<NsiInformation> const& value);
bool nsiInformationListIsSet() const;
void unsetNsiInformationList();
/// <summary>
......
/**
* NSSF NS Selection
* NSSF Network Slice Selection Service. © 2021, 3GPP Organizational Partners
* (ARIB, ATIS, CCSA, ETSI, TSDSI, TTA, TTC). All rights reserved.
*
* The version of the OpenAPI document: 2.1.2
*
*
* NOTE: This class is auto generated by OpenAPI Generator
* (https://openapi-generator.tech). https://openapi-generator.tech Do not edit
* the class manually.
*/
#include "MappingOfSnssai.h"
#include "Helpers.h"
#include <sstream>
namespace oai {
namespace amf {
namespace model {
MappingOfSnssai::MappingOfSnssai() {}
void MappingOfSnssai::validate() const {
std::stringstream msg;
// if (!validate(msg))
// {
// throw oai::nssf_server::helpers::ValidationException(msg.str());
// }
}
bool MappingOfSnssai::validate(std::stringstream& msg) const {
return validate(msg, "");
}
bool MappingOfSnssai::validate(
std::stringstream& msg, const std::string& pathPrefix) const {
bool success = true;
const std::string _pathPrefix =
pathPrefix.empty() ? "MappingOfSnssai" : pathPrefix;
return success;
}
bool MappingOfSnssai::operator==(const MappingOfSnssai& rhs) const {
return
(getServingSnssai() == rhs.getServingSnssai()) &&
(getHomeSnssai() == rhs.getHomeSnssai())
;
}
bool MappingOfSnssai::operator!=(const MappingOfSnssai& rhs) const {
return !(*this == rhs);
}
void to_json(nlohmann::json& j, const MappingOfSnssai& o) {
j = nlohmann::json();
j["servingSnssai"] = o.m_ServingSnssai;
j["homeSnssai"] = o.m_HomeSnssai;
}
void from_json(const nlohmann::json& j, MappingOfSnssai& o) {
j.at("servingSnssai").get_to(o.m_ServingSnssai);
j.at("homeSnssai").get_to(o.m_HomeSnssai);
}
Snssai MappingOfSnssai::getServingSnssai() const {
return m_ServingSnssai;
}
void MappingOfSnssai::setServingSnssai(Snssai const& value) {
m_ServingSnssai = value;
}
Snssai MappingOfSnssai::getHomeSnssai() const {
return m_HomeSnssai;
}
void MappingOfSnssai::setHomeSnssai(Snssai const& value) {
m_HomeSnssai = value;
}
} // namespace model
} // namespace amf
} // namespace oai
/**
* NSSF NS Selection
* NSSF Network Slice Selection Service. © 2021, 3GPP Organizational Partners
* (ARIB, ATIS, CCSA, ETSI, TSDSI, TTA, TTC). All rights reserved.
*
* The version of the OpenAPI document: 2.1.2
*
*
* NOTE: This class is auto generated by OpenAPI Generator
* (https://openapi-generator.tech). https://openapi-generator.tech Do not edit
* the class manually.
*/
/*
* MappingOfSnssai.h
*
*
*/
#ifndef MappingOfSnssai_H_
#define MappingOfSnssai_H_
#include "Snssai.h"
#include <nlohmann/json.hpp>
namespace oai {
namespace amf {
namespace model {
/// <summary>
///
/// </summary>
class MappingOfSnssai {
public:
MappingOfSnssai();
virtual ~MappingOfSnssai() = default;
/// <summary>
/// Validate the current data in the model. Throws a ValidationException on
/// failure.
/// </summary>
void validate() const;
/// <summary>
/// Validate the current data in the model. Returns false on error and writes
/// an error message into the given stringstream.
/// </summary>
bool validate(std::stringstream& msg) const;
/// <summary>
/// Helper overload for validate. Used when one model stores another model and
/// calls it's validate. Not meant to be called outside that case.
/// </summary>
bool validate(std::stringstream& msg, const std::string& pathPrefix) const;
bool operator==(const MappingOfSnssai& rhs) const;
bool operator!=(const MappingOfSnssai& rhs) const;
/////////////////////////////////////////////
/// MappingOfSnssai members
/// <summary>
///
/// </summary>
Snssai getServingSnssai() const;
void setServingSnssai(Snssai const& value);
/// <summary>
///
/// </summary>
Snssai getHomeSnssai() const;
void setHomeSnssai(Snssai const& value);
friend void to_json(nlohmann::json& j, const MappingOfSnssai& o);
friend void from_json(const nlohmann::json& j, MappingOfSnssai& o);
protected:
Snssai m_ServingSnssai;
Snssai m_HomeSnssai;
};
} // namespace model
} // namespace amf
} // namespace oai
#endif /* MappingOfSnssai_H_ */
......@@ -12,27 +12,75 @@
*/
#include "NsiInformation.h"
#include "Helpers.h"
#include <sstream>
namespace oai {
namespace amf {
namespace model {
NsiInformation::NsiInformation() {
m_NrfId = "";
m_NsiId = "";
m_NsiIdIsSet = false;
m_NrfId = "";
m_NsiId = "";
m_NsiIdIsSet = false;
m_NrfNfMgtUri = "";
m_NrfNfMgtUriIsSet = false;
m_NrfAccessTokenUri = "";
m_NrfAccessTokenUriIsSet = false;
}
void NsiInformation::validate() const {
std::stringstream msg;
// if (!validate(msg))
// {
// throw oai::nssf_server::helpers::ValidationException(msg.str());
// }
}
NsiInformation::~NsiInformation() {}
bool NsiInformation::validate(std::stringstream& msg) const {
return validate(msg, "");
}
bool NsiInformation::validate(
std::stringstream& msg, const std::string& pathPrefix) const {
bool success = true;
const std::string _pathPrefix =
pathPrefix.empty() ? "NsiInformation" : pathPrefix;
return success;
}
bool NsiInformation::operator==(const NsiInformation& rhs) const {
return
(getNrfId() == rhs.getNrfId()) &&
((!nsiIdIsSet() && !rhs.nsiIdIsSet()) ||
(nsiIdIsSet() && rhs.nsiIdIsSet() && getNsiId() == rhs.getNsiId())) &&
((!nrfNfMgtUriIsSet() && !rhs.nrfNfMgtUriIsSet()) ||
(nrfNfMgtUriIsSet() && rhs.nrfNfMgtUriIsSet() &&
getNrfNfMgtUri() == rhs.getNrfNfMgtUri())) &&
((!nrfAccessTokenUriIsSet() && !rhs.nrfAccessTokenUriIsSet()) ||
(nrfAccessTokenUriIsSet() && rhs.nrfAccessTokenUriIsSet() &&
getNrfAccessTokenUri() == rhs.getNrfAccessTokenUri()))
void NsiInformation::validate() {
// TODO: implement validation
;
}
bool NsiInformation::operator!=(const NsiInformation& rhs) const {
return !(*this == rhs);
}
void to_json(nlohmann::json& j, const NsiInformation& o) {
j = nlohmann::json();
j["nrfId"] = o.m_NrfId;
if (o.nsiIdIsSet()) j["nsiId"] = o.m_NsiId;
if (o.nrfNfMgtUriIsSet()) j["nrfNfMgtUri"] = o.m_NrfNfMgtUri;
if (o.nrfAccessTokenUriIsSet())
j["nrfAccessTokenUri"] = o.m_NrfAccessTokenUri;
}
void from_json(const nlohmann::json& j, NsiInformation& o) {
......@@ -41,6 +89,14 @@ void from_json(const nlohmann::json& j, NsiInformation& o) {
j.at("nsiId").get_to(o.m_NsiId);
o.m_NsiIdIsSet = true;
}
if (j.find("nrfNfMgtUri") != j.end()) {
j.at("nrfNfMgtUri").get_to(o.m_NrfNfMgtUri);
o.m_NrfNfMgtUriIsSet = true;
}
if (j.find("nrfAccessTokenUri") != j.end()) {
j.at("nrfAccessTokenUri").get_to(o.m_NrfAccessTokenUri);
o.m_NrfAccessTokenUriIsSet = true;
}
}
std::string NsiInformation::getNrfId() const {
......@@ -62,6 +118,32 @@ bool NsiInformation::nsiIdIsSet() const {
void NsiInformation::unsetNsiId() {
m_NsiIdIsSet = false;
}
std::string NsiInformation::getNrfNfMgtUri() const {
return m_NrfNfMgtUri;
}
void NsiInformation::setNrfNfMgtUri(std::string const& value) {
m_NrfNfMgtUri = value;
m_NrfNfMgtUriIsSet = true;
}
bool NsiInformation::nrfNfMgtUriIsSet() const {
return m_NrfNfMgtUriIsSet;
}
void NsiInformation::unsetNrfNfMgtUri() {
m_NrfNfMgtUriIsSet = false;
}
std::string NsiInformation::getNrfAccessTokenUri() const {
return m_NrfAccessTokenUri;
}
void NsiInformation::setNrfAccessTokenUri(std::string const& value) {
m_NrfAccessTokenUri = value;
m_NrfAccessTokenUriIsSet = true;
}
bool NsiInformation::nrfAccessTokenUriIsSet() const {
return m_NrfAccessTokenUriIsSet;
}
void NsiInformation::unsetNrfAccessTokenUri() {
m_NrfAccessTokenUriIsSet = false;
}
} // namespace model
} // namespace amf
......
......@@ -32,9 +32,28 @@ namespace model {
class NsiInformation {
public:
NsiInformation();
virtual ~NsiInformation();
virtual ~NsiInformation() = default;
void validate();
/// <summary>
/// Validate the current data in the model. Throws a ValidationException on
/// failure.
/// </summary>
void validate() const;
/// <summary>
/// Validate the current data in the model. Returns false on error and writes
/// an error message into the given stringstream.
/// </summary>
bool validate(std::stringstream& msg) const;
/// <summary>
/// Helper overload for validate. Used when one model stores another model and
/// calls it's validate. Not meant to be called outside that case.
/// </summary>
bool validate(std::stringstream& msg, const std::string& pathPrefix) const;
bool operator==(const NsiInformation& rhs) const;
bool operator!=(const NsiInformation& rhs) const;
/////////////////////////////////////////////
/// NsiInformation members
......@@ -51,6 +70,20 @@ class NsiInformation {
void setNsiId(std::string const& value);
bool nsiIdIsSet() const;
void unsetNsiId();
/// <summary>
///
/// </summary>
std::string getNrfNfMgtUri() const;
void setNrfNfMgtUri(std::string const& value);
bool nrfNfMgtUriIsSet() const;
void unsetNrfNfMgtUri();
/// <summary>
///
/// </summary>
std::string getNrfAccessTokenUri() const;
void setNrfAccessTokenUri(std::string const& value);
bool nrfAccessTokenUriIsSet() const;
void unsetNrfAccessTokenUri();
friend void to_json(nlohmann::json& j, const NsiInformation& o);
friend void from_json(const nlohmann::json& j, NsiInformation& o);
......@@ -60,6 +93,10 @@ class NsiInformation {
std::string m_NsiId;
bool m_NsiIdIsSet;
std::string m_NrfNfMgtUri;
bool m_NrfNfMgtUriIsSet;
std::string m_NrfAccessTokenUri;
bool m_NrfAccessTokenUriIsSet;
};
} // namespace model
......
This diff is collapsed.
/**
* NSSF NS Selection
* NSSF Network Slice Selection Service. © 2021, 3GPP Organizational Partners
* (ARIB, ATIS, CCSA, ETSI, TSDSI, TTA, TTC). All rights reserved.
*
* The version of the OpenAPI document: 2.1.2
*
*
* NOTE: This class is auto generated by OpenAPI Generator
* (https://openapi-generator.tech). https://openapi-generator.tech Do not edit
* the class manually.
*/
/*
* SliceInfoForRegistration.h
*
*
*/
#ifndef SliceInfoForRegistration_H_
#define SliceInfoForRegistration_H_
#include "AllowedNssai.h"
#include "MappingOfSnssai.h"
#include "Snssai.h"
#include "SubscribedSnssai.h"
#include <nlohmann/json.hpp>
#include <vector>
namespace oai {
namespace amf {
namespace model {
/// <summary>
///
/// </summary>
class SliceInfoForRegistration {
public:
SliceInfoForRegistration();
virtual ~SliceInfoForRegistration() = default;
/// <summary>
/// Validate the current data in the model. Throws a ValidationException on
/// failure.
/// </summary>
void validate() const;
/// <summary>
/// Validate the current data in the model. Returns false on error and writes
/// an error message into the given stringstream.
/// </summary>
bool validate(std::stringstream& msg) const;
/// <summary>
/// Helper overload for validate. Used when one model stores another model and
/// calls it's validate. Not meant to be called outside that case.
/// </summary>
bool validate(std::stringstream& msg, const std::string& pathPrefix) const;
bool operator==(const SliceInfoForRegistration& rhs) const;
bool operator!=(const SliceInfoForRegistration& rhs) const;
/////////////////////////////////////////////
/// SliceInfoForRegistration members
/// <summary>
///
/// </summary>
std::vector<SubscribedSnssai> getSubscribedNssai() const;
void setSubscribedNssai(std::vector<SubscribedSnssai> const& value);
bool subscribedNssaiIsSet() const;
void unsetSubscribedNssai();
/// <summary>
///
/// </summary>
AllowedNssai getAllowedNssaiCurrentAccess() const;
void setAllowedNssaiCurrentAccess(AllowedNssai const& value);
bool allowedNssaiCurrentAccessIsSet() const;
void unsetAllowedNssaiCurrentAccess();
/// <summary>
///
/// </summary>
AllowedNssai getAllowedNssaiOtherAccess() const;
void setAllowedNssaiOtherAccess(AllowedNssai const& value);
bool allowedNssaiOtherAccessIsSet() const;
void unsetAllowedNssaiOtherAccess();
/// <summary>
///
/// </summary>
std::vector<Snssai> getSNssaiForMapping() const;
void setSNssaiForMapping(std::vector<Snssai> const& value);
bool sNssaiForMappingIsSet() const;
void unsetSNssaiForMapping();
/// <summary>
///
/// </summary>
std::vector<Snssai> getRequestedNssai() const;
void setRequestedNssai(std::vector<Snssai> const& value);
bool requestedNssaiIsSet() const;
void unsetRequestedNssai();
/// <summary>
///
/// </summary>
bool isDefaultConfiguredSnssaiInd() const;
void setDefaultConfiguredSnssaiInd(bool const value);
bool defaultConfiguredSnssaiIndIsSet() const;
void unsetDefaultConfiguredSnssaiInd();
/// <summary>
///
/// </summary>
std::vector<MappingOfSnssai> getMappingOfNssai() const;
void setMappingOfNssai(std::vector<MappingOfSnssai> const& value);
bool mappingOfNssaiIsSet() const;
void unsetMappingOfNssai();
/// <summary>
///
/// </summary>
bool isRequestMapping() const;
void setRequestMapping(bool const value);
bool requestMappingIsSet() const;
void unsetRequestMapping();
friend void to_json(nlohmann::json& j, const SliceInfoForRegistration& o);
friend void from_json(const nlohmann::json& j, SliceInfoForRegistration& o);
protected:
std::vector<SubscribedSnssai> m_SubscribedNssai;
bool m_SubscribedNssaiIsSet;
AllowedNssai m_AllowedNssaiCurrentAccess;
bool m_AllowedNssaiCurrentAccessIsSet;
AllowedNssai m_AllowedNssaiOtherAccess;
bool m_AllowedNssaiOtherAccessIsSet;
std::vector<Snssai> m_SNssaiForMapping;
bool m_SNssaiForMappingIsSet;
std::vector<Snssai> m_RequestedNssai;
bool m_RequestedNssaiIsSet;
bool m_DefaultConfiguredSnssaiInd;
bool m_DefaultConfiguredSnssaiIndIsSet;
std::vector<MappingOfSnssai> m_MappingOfNssai;
bool m_MappingOfNssaiIsSet;
bool m_RequestMapping;
bool m_RequestMappingIsSet;
};
} // namespace model
} // namespace amf
} // namespace oai
#endif /* SliceInfoForRegistration_H_ */
......@@ -12,6 +12,9 @@
*/
#include "Snssai.h"
#include "Helpers.h"
#include <sstream>
namespace oai {
namespace amf {
......@@ -23,10 +26,58 @@ Snssai::Snssai() {
m_SdIsSet = false;
}
Snssai::~Snssai() {}
void Snssai::validate() const {
std::stringstream msg;
// if (!validate(msg))
// {
// throw oai::nssf_server::helpers::ValidationException(msg.str());
// }
}
bool Snssai::validate(std::stringstream& msg) const {
return validate(msg, "");
}
bool Snssai::validate(
std::stringstream& msg, const std::string& pathPrefix) const {
bool success = true;
const std::string _pathPrefix = pathPrefix.empty() ? "Snssai" : pathPrefix;
/* Sst */ {
const int32_t& value = m_Sst;
const std::string currentValuePath = _pathPrefix + ".sst";
if (value < 0) {
success = false;
msg << currentValuePath << ": must be greater than or equal to 0;";
}
if (value > 255) {
success = false;
msg << currentValuePath << ": must be less than or equal to 255;";
}
}
if (sdIsSet()) {
const std::string& value = m_Sd;
const std::string currentValuePath = _pathPrefix + ".sd";
}
return success;
}
bool Snssai::operator==(const Snssai& rhs) const {
return
(getSst() == rhs.getSst()) &&
((!sdIsSet() && !rhs.sdIsSet()) ||
(sdIsSet() && rhs.sdIsSet() && getSd() == rhs.getSd()))
;
}
void Snssai::validate() {
// TODO: implement validation
bool Snssai::operator!=(const Snssai& rhs) const {
return !(*this == rhs);
}
void to_json(nlohmann::json& j, const Snssai& o) {
......
......@@ -32,9 +32,28 @@ namespace model {
class Snssai {
public:
Snssai();
virtual ~Snssai();
virtual ~Snssai() = default;
void validate();
/// <summary>
/// Validate the current data in the model. Throws a ValidationException on
/// failure.
/// </summary>
void validate() const;
/// <summary>
/// Validate the current data in the model. Returns false on error and writes
/// an error message into the given stringstream.
/// </summary>
bool validate(std::stringstream& msg) const;
/// <summary>
/// Helper overload for validate. Used when one model stores another model and
/// calls it's validate. Not meant to be called outside that case.
/// </summary>
bool validate(std::stringstream& msg, const std::string& pathPrefix) const;
bool operator==(const Snssai& rhs) const;
bool operator!=(const Snssai& rhs) const;
/////////////////////////////////////////////
/// Snssai members
......
/**
* NSSF NS Selection
* NSSF Network Slice Selection Service. © 2021, 3GPP Organizational Partners
* (ARIB, ATIS, CCSA, ETSI, TSDSI, TTA, TTC). All rights reserved.
*
* The version of the OpenAPI document: 2.1.2
*
*
* NOTE: This class is auto generated by OpenAPI Generator
* (https://openapi-generator.tech). https://openapi-generator.tech Do not edit
* the class manually.
*/
#include "SubscribedSnssai.h"
#include "Helpers.h"
#include <sstream>
namespace oai {
namespace amf {
namespace model {
SubscribedSnssai::SubscribedSnssai() {
m_DefaultIndication = false;
m_DefaultIndicationIsSet = false;
}
void SubscribedSnssai::validate() const {
std::stringstream msg;
// if (!validate(msg))
// {
// throw oai::nssf_server::helpers::ValidationException(msg.str());
// }
}
bool SubscribedSnssai::validate(std::stringstream& msg) const {
return validate(msg, "");
}
bool SubscribedSnssai::validate(
std::stringstream& msg, const std::string& pathPrefix) const {
bool success = true;
const std::string _pathPrefix =
pathPrefix.empty() ? "SubscribedSnssai" : pathPrefix;
return success;
}
bool SubscribedSnssai::operator==(const SubscribedSnssai& rhs) const {
return
(getSubscribedSnssai() == rhs.getSubscribedSnssai()) &&
((!defaultIndicationIsSet() && !rhs.defaultIndicationIsSet()) ||
(defaultIndicationIsSet() && rhs.defaultIndicationIsSet() &&
isDefaultIndication() == rhs.isDefaultIndication()))
;
}
bool SubscribedSnssai::operator!=(const SubscribedSnssai& rhs) const {
return !(*this == rhs);
}
void to_json(nlohmann::json& j, const SubscribedSnssai& o) {
j = nlohmann::json();
j["subscribedSnssai"] = o.m_SubscribedSnssai;
if (o.defaultIndicationIsSet())
j["defaultIndication"] = o.m_DefaultIndication;
}
void from_json(const nlohmann::json& j, SubscribedSnssai& o) {
j.at("subscribedSnssai").get_to(o.m_SubscribedSnssai);
if (j.find("defaultIndication") != j.end()) {
j.at("defaultIndication").get_to(o.m_DefaultIndication);
o.m_DefaultIndicationIsSet = true;
}
}
Snssai SubscribedSnssai::getSubscribedSnssai() const {
return m_SubscribedSnssai;
}
void SubscribedSnssai::setSubscribedSnssai(Snssai const& value) {
m_SubscribedSnssai = value;
}
bool SubscribedSnssai::isDefaultIndication() const {
return m_DefaultIndication;
}
void SubscribedSnssai::setDefaultIndication(bool const value) {
m_DefaultIndication = value;
m_DefaultIndicationIsSet = true;
}
bool SubscribedSnssai::defaultIndicationIsSet() const {
return m_DefaultIndicationIsSet;
}
void SubscribedSnssai::unsetDefaultIndication() {
m_DefaultIndicationIsSet = false;
}
} // namespace model
} // namespace amf
} // namespace oai
/**
* NSSF NS Selection
* NSSF Network Slice Selection Service. © 2021, 3GPP Organizational Partners
* (ARIB, ATIS, CCSA, ETSI, TSDSI, TTA, TTC). All rights reserved.
*
* The version of the OpenAPI document: 2.1.2
*
*
* NOTE: This class is auto generated by OpenAPI Generator
* (https://openapi-generator.tech). https://openapi-generator.tech Do not edit
* the class manually.
*/
/*
* SubscribedSnssai.h
*
*
*/
#ifndef SubscribedSnssai_H_
#define SubscribedSnssai_H_
#include "Snssai.h"
#include <nlohmann/json.hpp>
namespace oai {
namespace amf {
namespace model {
/// <summary>
///
/// </summary>
class SubscribedSnssai {
public:
SubscribedSnssai();
virtual ~SubscribedSnssai() = default;
/// <summary>
/// Validate the current data in the model. Throws a ValidationException on
/// failure.
/// </summary>
void validate() const;
/// <summary>
/// Validate the current data in the model. Returns false on error and writes
/// an error message into the given stringstream.
/// </summary>
bool validate(std::stringstream& msg) const;
/// <summary>
/// Helper overload for validate. Used when one model stores another model and
/// calls it's validate. Not meant to be called outside that case.
/// </summary>
bool validate(std::stringstream& msg, const std::string& pathPrefix) const;
bool operator==(const SubscribedSnssai& rhs) const;
bool operator!=(const SubscribedSnssai& rhs) const;
/////////////////////////////////////////////
/// SubscribedSnssai members
/// <summary>
///
/// </summary>
Snssai getSubscribedSnssai() const;
void setSubscribedSnssai(Snssai const& value);
/// <summary>
///
/// </summary>
bool isDefaultIndication() const;
void setDefaultIndication(bool const value);
bool defaultIndicationIsSet() const;
void unsetDefaultIndication();
friend void to_json(nlohmann::json& j, const SubscribedSnssai& o);
friend void from_json(const nlohmann::json& j, SubscribedSnssai& o);
protected:
Snssai m_SubscribedSnssai;
bool m_DefaultIndication;
bool m_DefaultIndicationIsSet;
};
} // namespace model
} // namespace amf
} // namespace oai
#endif /* SubscribedSnssai_H_ */
......@@ -168,7 +168,7 @@ SMContextsCollectionApi::postSmContexts(
// 4xx - client error : not OK
// 5xx - client error : not OK
if (localVarResponse.status_code() >= 400) {
amf_n11_inst->handle_post_sm_context_response_error_400();
// amf_n11_inst->handle_post_sm_context_response_error_400();
throw ApiException(
localVarResponse.status_code(),
utility::conversions::to_string_t(
......
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