Commit 13c9b4e5 authored by Tien-Thinh Nguyen's avatar Tien-Thinh Nguyen

Get AuthorizedNetworkSliceInfo from NSSF

parent 48e724fc
......@@ -3718,18 +3718,21 @@ bool amf_n1::reroute_registration_request(std::shared_ptr<nas_context>& nc) {
return false;
}
// Process NS selection to select the appropriate AMF
// TODO: use from OpenAPI
authorized_network_slice_info_t authorized_network_slice_info = {};
oai::amf::model::SliceInfoForRegistration slice_info = {};
oai::amf::model::AuthorizedNetworkSliceInfo authorized_network_slice_info =
{};
if (!get_network_slice_selection(
nc, amf_app_inst->get_nf_instance(), slice_info,
authorized_network_slice_info)) {
return false;
}
// if get_target_amf();
std::string target_amf = {};
// Send N1MessageNotify to the Target AMF
send_n1_message_notity(nc, target_amf);
if (get_target_amf(nc, target_amf, authorized_network_slice_info)) {
// Send N1MessageNotify to the Target AMF
send_n1_message_notity(nc, target_amf);
}
return true;
}
......@@ -3816,9 +3819,10 @@ bool amf_n1::get_slice_selection_subscription_data_from_conf_file(
//------------------------------------------------------------------------------
bool amf_n1::get_network_slice_selection(
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) {
const std::shared_ptr<nas_context>& nc, const std::string& nf_instance_id,
const oai::amf::model::SliceInfoForRegistration& slice_info,
oai::amf::model::AuthorizedNetworkSliceInfo&
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)) {
......@@ -3828,7 +3832,6 @@ bool amf_n1::get_network_slice_selection(
if (amf_cfg.support_features.enable_external_nssf) {
// Get Authorized Network Slice Info from an external NSSF
std::shared_ptr<itti_n11_network_slice_selection_information> itti_msg =
std::make_shared<itti_n11_network_slice_selection_information>(
TASK_AMF_N1, TASK_AMF_N11);
......@@ -3856,8 +3859,8 @@ bool amf_n1::get_network_slice_selection(
itti_msg->get_msg_name());
}
bool result = false;
boost::future_status status;
bool result = false;
boost::future_status status = {};
// wait for timeout or ready
status = f.wait_for(boost::chrono::milliseconds(FUTURE_STATUS_TIMEOUT_MS));
if (status == boost::future_status::ready) {
......@@ -3870,11 +3873,16 @@ bool amf_n1::get_network_slice_selection(
Logger::ngap().debug(
"Got Authorized Network Slice Info from NSSF: %s",
network_slice_info.dump().c_str());
from_json(network_slice_info, authorized_network_slice_info);
} else {
Logger::ngap().debug(
"Could not get Authorized Network Slice Info from NSSF");
return false;
}
} else {
Logger::ngap().debug(
"Could not get Authorized Network Slice Info from NSSF");
return false;
}
......@@ -3889,13 +3897,23 @@ bool amf_n1::get_network_slice_selection(
//------------------------------------------------------------------------------
bool amf_n1::get_network_slice_selection_from_conf_file(
const std::string& nf_instance_id,
oai::amf::model::SliceInfoForRegistration& slice_info,
authorized_network_slice_info_t& authorized_network_slice_info) const {
const oai::amf::model::SliceInfoForRegistration& slice_info,
oai::amf::model::AuthorizedNetworkSliceInfo& authorized_network_slice_info)
const {
// TODO: Get Authorized Network Slice Info from local configuration file
return true;
}
//------------------------------------------------------------------------------
bool amf_n1::get_target_amf(
const std::shared_ptr<nas_context>& nc, std::string& target_amf,
const oai::amf::model::AuthorizedNetworkSliceInfo&
authorized_network_slice_info) {
// Get Target AMF from AuthorizedNetworkSliceInfo
return true;
}
//------------------------------------------------------------------------------
void amf_n1::send_n1_message_notity(
const std::shared_ptr<nas_context>& nc,
......
......@@ -51,6 +51,7 @@
#include "ue_context.hpp"
#include "itti.hpp"
#include "SliceInfoForRegistration.h"
#include "AuthorizedNetworkSliceInfo.h"
namespace amf_application {
......@@ -228,13 +229,20 @@ class amf_n1 {
bool check_requested_nssai(
const std::shared_ptr<nas_context>& nc, const nssai_t& nssai) const;
bool get_network_slice_selection(
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);
const std::shared_ptr<nas_context>& nc, const std::string& nf_instance_id,
const oai::amf::model::SliceInfoForRegistration& slice_info,
oai::amf::model::AuthorizedNetworkSliceInfo&
authorized_network_slice_info);
bool get_network_slice_selection_from_conf_file(
const std::string& nf_instance_id,
oai::amf::model::SliceInfoForRegistration& slice_info,
authorized_network_slice_info_t& authorized_network_slice_info) const;
const oai::amf::model::SliceInfoForRegistration& slice_info,
oai::amf::model::AuthorizedNetworkSliceInfo&
authorized_network_slice_info) const;
bool get_target_amf(
const std::shared_ptr<nas_context>& nc, std::string& target_amf,
const oai::amf::model::AuthorizedNetworkSliceInfo&
authorized_network_slice_info);
void send_n1_message_notity(
const std::shared_ptr<nas_context>& nc,
......
......@@ -618,6 +618,7 @@ void amf_n11::handle_itti_message(
return;
}
//------------------------------------------------------------------------------
void amf_n11::handle_itti_message(
itti_n11_network_slice_selection_information& itti_msg) {
Logger::amf_n11().debug(
......
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.
*/
/*
* AuthorizedNetworkSliceInfo.h
*
*
*/
#ifndef AuthorizedNetworkSliceInfo_H_
#define AuthorizedNetworkSliceInfo_H_
#include "AllowedNssai.h"
#include "ConfiguredSnssai.h"
#include "NsiInformation.h"
#include "Snssai.h"
#include <nlohmann/json.hpp>
#include <string>
#include <vector>
namespace oai {
namespace amf {
namespace model {
/// <summary>
///
/// </summary>
class AuthorizedNetworkSliceInfo {
public:
AuthorizedNetworkSliceInfo();
virtual ~AuthorizedNetworkSliceInfo() = 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 AuthorizedNetworkSliceInfo& rhs) const;
bool operator!=(const AuthorizedNetworkSliceInfo& rhs) const;
/////////////////////////////////////////////
/// AuthorizedNetworkSliceInfo members
/// <summary>
///
/// </summary>
std::vector<AllowedNssai> getAllowedNssaiList() const;
void setAllowedNssaiList(std::vector<AllowedNssai> const& value);
bool allowedNssaiListIsSet() const;
void unsetAllowedNssaiList();
/// <summary>
///
/// </summary>
std::vector<ConfiguredSnssai> getConfiguredNssai() const;
void setConfiguredNssai(std::vector<ConfiguredSnssai> const& value);
bool configuredNssaiIsSet() const;
void unsetConfiguredNssai();
/// <summary>
///
/// </summary>
std::string getTargetAmfSet() const;
void setTargetAmfSet(std::string const& value);
bool targetAmfSetIsSet() const;
void unsetTargetAmfSet();
/// <summary>
///
/// </summary>
std::vector<std::string> getCandidateAmfList() const;
void setCandidateAmfList(std::vector<std::string> const& value);
bool candidateAmfListIsSet() const;
void unsetCandidateAmfList();
/// <summary>
///
/// </summary>
std::vector<Snssai> getRejectedNssaiInPlmn() const;
void setRejectedNssaiInPlmn(std::vector<Snssai> const& value);
bool rejectedNssaiInPlmnIsSet() const;
void unsetRejectedNssaiInPlmn();
/// <summary>
///
/// </summary>
std::vector<Snssai> getRejectedNssaiInTa() const;
void setRejectedNssaiInTa(std::vector<Snssai> const& value);
bool rejectedNssaiInTaIsSet() const;
void unsetRejectedNssaiInTa();
/// <summary>
///
/// </summary>
NsiInformation getNsiInformation() const;
void setNsiInformation(NsiInformation const& value);
bool nsiInformationIsSet() const;
void unsetNsiInformation();
/// <summary>
///
/// </summary>
std::string getSupportedFeatures() const;
void setSupportedFeatures(std::string const& value);
bool supportedFeaturesIsSet() const;
void unsetSupportedFeatures();
/// <summary>
///
/// </summary>
std::string getNrfAmfSet() const;
void setNrfAmfSet(std::string const& value);
bool nrfAmfSetIsSet() const;
void unsetNrfAmfSet();
/// <summary>
///
/// </summary>
std::string getNrfAmfSetNfMgtUri() const;
void setNrfAmfSetNfMgtUri(std::string const& value);
bool nrfAmfSetNfMgtUriIsSet() const;
void unsetNrfAmfSetNfMgtUri();
/// <summary>
///
/// </summary>
std::string getNrfAmfSetAccessTokenUri() const;
void setNrfAmfSetAccessTokenUri(std::string const& value);
bool nrfAmfSetAccessTokenUriIsSet() const;
void unsetNrfAmfSetAccessTokenUri();
/// <summary>
///
/// </summary>
std::string getTargetAmfServiceSet() const;
void setTargetAmfServiceSet(std::string const& value);
bool targetAmfServiceSetIsSet() const;
void unsetTargetAmfServiceSet();
friend void to_json(nlohmann::json& j, const AuthorizedNetworkSliceInfo& o);
friend void from_json(const nlohmann::json& j, AuthorizedNetworkSliceInfo& o);
protected:
std::vector<AllowedNssai> m_AllowedNssaiList;
bool m_AllowedNssaiListIsSet;
std::vector<ConfiguredSnssai> m_ConfiguredNssai;
bool m_ConfiguredNssaiIsSet;
std::string m_TargetAmfSet;
bool m_TargetAmfSetIsSet;
std::vector<std::string> m_CandidateAmfList;
bool m_CandidateAmfListIsSet;
std::vector<Snssai> m_RejectedNssaiInPlmn;
bool m_RejectedNssaiInPlmnIsSet;
std::vector<Snssai> m_RejectedNssaiInTa;
bool m_RejectedNssaiInTaIsSet;
NsiInformation m_NsiInformation;
bool m_NsiInformationIsSet;
std::string m_SupportedFeatures;
bool m_SupportedFeaturesIsSet;
std::string m_NrfAmfSet;
bool m_NrfAmfSetIsSet;
std::string m_NrfAmfSetNfMgtUri;
bool m_NrfAmfSetNfMgtUriIsSet;
std::string m_NrfAmfSetAccessTokenUri;
bool m_NrfAmfSetAccessTokenUriIsSet;
std::string m_TargetAmfServiceSet;
bool m_TargetAmfServiceSetIsSet;
};
} // namespace model
} // namespace amf
} // namespace oai
#endif /* AuthorizedNetworkSliceInfo_H_ */
......@@ -12,6 +12,9 @@
*/
#include "ConfiguredSnssai.h"
#include "Helpers.h"
#include <sstream>
namespace oai {
namespace amf {
......@@ -21,10 +24,41 @@ ConfiguredSnssai::ConfiguredSnssai() {
m_MappedHomeSnssaiIsSet = false;
}
ConfiguredSnssai::~ConfiguredSnssai() {}
void ConfiguredSnssai::validate() const {
std::stringstream msg;
// if (!validate(msg))
// {
// throw oai::nssf_server::helpers::ValidationException(msg.str());
// }
}
bool ConfiguredSnssai::validate(std::stringstream& msg) const {
return validate(msg, "");
}
bool ConfiguredSnssai::validate(
std::stringstream& msg, const std::string& pathPrefix) const {
bool success = true;
const std::string _pathPrefix =
pathPrefix.empty() ? "ConfiguredSnssai" : pathPrefix;
return success;
}
bool ConfiguredSnssai::operator==(const ConfiguredSnssai& rhs) const {
return
(getConfiguredSnssai() == rhs.getConfiguredSnssai()) &&
((!mappedHomeSnssaiIsSet() && !rhs.mappedHomeSnssaiIsSet()) ||
(mappedHomeSnssaiIsSet() && rhs.mappedHomeSnssaiIsSet() &&
getMappedHomeSnssai() == rhs.getMappedHomeSnssai()))
;
}
void ConfiguredSnssai::validate() {
// TODO: implement validation
bool ConfiguredSnssai::operator!=(const ConfiguredSnssai& rhs) const {
return !(*this == rhs);
}
void to_json(nlohmann::json& j, const ConfiguredSnssai& o) {
......
......@@ -32,9 +32,28 @@ namespace model {
class ConfiguredSnssai {
public:
ConfiguredSnssai();
virtual ~ConfiguredSnssai();
virtual ~ConfiguredSnssai() = 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 ConfiguredSnssai& rhs) const;
bool operator!=(const ConfiguredSnssai& rhs) const;
/////////////////////////////////////////////
/// ConfiguredSnssai members
......
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