Commit 8520dd2f authored by Raphael Defosseux's avatar Raphael Defosseux

Merge branch 'profile_update' into 'develop'

nf profile updated to support UDM and UDR

See merge request oai/cn5g/oai-cn5g-nrf!23
parents d29131cc c01c4001
......@@ -148,10 +148,4 @@ typedef struct guami_s {
std::string amf_id;
} guami_t;
typedef struct supi_range_s {
std::string start;
std::string end;
std::string pattern;
} supi_range_t;
#endif
......@@ -87,16 +87,59 @@ typedef struct upf_info_s {
std::vector<interface_upf_info_item_t> interface_upf_info_list;
} upf_info_t;
typedef struct supi_range_ausf_info_item_s {
typedef struct supi_range_s {
std::string start;
std::string end;
std::string pattern;
} supi_range_t;
typedef struct supi_range_info_item_s {
supi_range_t supi_range;
} supi_range_ausf_info_item_t;
} supi_range_info_item_t;
typedef struct identity_range_s {
std::string start;
std::string end;
std::string pattern;
} identity_range_t;
typedef struct identity_range_info_item_s {
identity_range_t identity_range;
} identity_range_info_item_t;
typedef struct internal_grpid_range_s {
std::string start;
std::string end;
std::string pattern;
} internal_grpid_range_t;
typedef struct internal_grpid_range_info_item_s {
internal_grpid_range_t int_grpid_range;
} internal_grpid_range_info_item_t;
typedef struct ausf_info_s {
std::string groupid;
std::vector<supi_range_ausf_info_item_t> supi_ranges;
std::vector<supi_range_info_item_t> supi_ranges;
std::vector<std::string> routing_indicator;
} ausf_info_t;
typedef struct udm_info_s {
std::string groupid;
std::vector<supi_range_info_item_t> supi_ranges;
std::vector<identity_range_info_item_t> gpsi_ranges;
std::vector<identity_range_info_item_t> ext_grp_id_ranges;
std::vector<std::string> routing_indicator;
std::vector<internal_grpid_range_info_item_t> int_grp_id_ranges;
} udm_info_t;
typedef struct udr_info_s {
std::string groupid;
std::vector<supi_range_info_item_t> supi_ranges;
std::vector<identity_range_info_item_t> gpsi_ranges;
std::vector<identity_range_info_item_t> ext_grp_id_ranges;
std::vector<std::string> data_set_id;
} udr_info_t;
enum subscr_condition_type_e { // TODO: use enum class
UNKNOWN_CONDITION = 0,
NF_INSTANCE_ID_COND = 1,
......
......@@ -28,30 +28,31 @@
typedef enum nf_type_s {
NF_TYPE_NRF = 0,
NF_TYPE_AMF = 1,
NF_TYPE_SMF = 2,
NF_TYPE_AUSF = 3,
NF_TYPE_NEF = 4,
NF_TYPE_PCF = 5,
NF_TYPE_SMSF = 6,
NF_TYPE_NSSF = 7,
NF_TYPE_UDR = 8,
NF_TYPE_LMF = 9,
NF_TYPE_GMLC = 10,
NF_TYPE_5G_EIR = 11,
NF_TYPE_SEPP = 12,
NF_TYPE_UPF = 13,
NF_TYPE_N3IWF = 14,
NF_TYPE_AF = 15,
NF_TYPE_UDSF = 16,
NF_TYPE_BSF = 17,
NF_TYPE_CHF = 18,
NF_TYPE_NWDAF = 19,
NF_TYPE_UNKNOWN = 20
NF_TYPE_UDM = 1,
NF_TYPE_AMF = 2,
NF_TYPE_SMF = 3,
NF_TYPE_AUSF = 4,
NF_TYPE_NEF = 5,
NF_TYPE_PCF = 6,
NF_TYPE_SMSF = 7,
NF_TYPE_NSSF = 8,
NF_TYPE_UDR = 9,
NF_TYPE_LMF = 10,
NF_TYPE_GMLC = 11,
NF_TYPE_5G_EIR = 12,
NF_TYPE_SEPP = 13,
NF_TYPE_UPF = 14,
NF_TYPE_N3IWF = 15,
NF_TYPE_AF = 16,
NF_TYPE_UDSF = 17,
NF_TYPE_BSF = 18,
NF_TYPE_CHF = 19,
NF_TYPE_NWDAF = 20,
NF_TYPE_UNKNOWN = 21
} nf_type_t;
static const std::vector<std::string> nf_type_e2str = {
"NRF", "AMF", "SMF", "AUSF", "NEF", "PCF", "SMSF",
"NRF", "UDM", "AMF", "SMF", "AUSF", "NEF", "PCF", "SMSF",
"NSSF", "UDR", "LMF", "GMLC", "5G_EIR", "SEPP", "UPF",
"N3IWF", "AF", "UDSF", "BSF", "CHF", "NWDAF", "UNKNOWN"};
......
......@@ -294,17 +294,23 @@ bool api_conv::profile_api_to_nrf_profile(
->add_upf_info(info);
} break;
case NF_TYPE_AUSF: {
Logger::nrf_app().debug("\tAUSF profile, AUSFF Info");
Logger::nrf_app().debug("\tAUSF profile, AUSF Info");
profile.get()->set_nf_type(NF_TYPE_AUSF);
ausf_info_t info = {};
AusfInfo ausf_info_api = api_profile.getAusfInfo();
info.groupid = ausf_info_api.getGroupId();
Logger::nrf_app().debug("\t\t GroupId - %s", info.groupid.c_str());
for (auto s : ausf_info_api.getSupiRanges()) {
supi_range_ausf_info_item_t supiRange = {};
supiRange.supi_range.start = s.getStart();
supiRange.supi_range.end = s.getEnd();
supiRange.supi_range.pattern = s.getPattern();
supi_range_info_item_t supiRange = {};
supiRange.supi_range.start = s.getStart();
supiRange.supi_range.end = s.getEnd();
supiRange.supi_range.pattern = s.getPattern();
info.supi_ranges.push_back(supiRange);
Logger::nrf_app().debug(
"\t\t SupiRanges: Start - %s, End - %s, Pattern - %s",
supiRange.supi_range.start.c_str(),
supiRange.supi_range.end.c_str(),
supiRange.supi_range.pattern.c_str());
}
for (auto s : ausf_info_api.getRoutingIndicators()) {
info.routing_indicator.push_back(s);
......@@ -314,6 +320,129 @@ bool api_conv::profile_api_to_nrf_profile(
->add_ausf_info(info);
} break;
case NF_TYPE_UDM: {
Logger::nrf_app().debug("\tUDM profile, UDM Info");
profile.get()->set_nf_type(NF_TYPE_UDM);
udm_info_t info = {};
UdmInfo udm_info_api = api_profile.getUdmInfo();
info.groupid = udm_info_api.getGroupId();
Logger::nrf_app().debug("\t\t GroupId - %s", info.groupid.c_str());
if (udm_info_api.supiRangesIsSet()) {
for (auto s : udm_info_api.getSupiRanges()) {
supi_range_info_item_t supiRange = {};
supiRange.supi_range.start = s.getStart();
supiRange.supi_range.end = s.getEnd();
supiRange.supi_range.pattern = s.getPattern();
info.supi_ranges.push_back(supiRange);
Logger::nrf_app().debug(
"\t\t SupiRanges: Start - %s, End - %s, Pattern - %s",
supiRange.supi_range.start.c_str(),
supiRange.supi_range.end.c_str(),
supiRange.supi_range.pattern.c_str());
}
}
if (udm_info_api.gpsiRangesIsSet()) {
for (auto s : udm_info_api.getGpsiRanges()) {
identity_range_info_item_t gpsiRange = {};
gpsiRange.identity_range.start = s.getStart();
gpsiRange.identity_range.end = s.getEnd();
gpsiRange.identity_range.pattern = s.getPattern();
info.gpsi_ranges.push_back(gpsiRange);
Logger::nrf_app().debug(
"\t\t GpsiRanges: Start - %s, End - %s, Pattern - %s",
gpsiRange.identity_range.start.c_str(),
gpsiRange.identity_range.end.c_str(),
gpsiRange.identity_range.pattern.c_str());
}
}
if (udm_info_api.externalGroupIdentifiersRangesIsSet()) {
for (auto s : udm_info_api.getExternalGroupIdentifiersRanges()) {
identity_range_info_item_t ExtGrpId = {};
ExtGrpId.identity_range.start = s.getStart();
ExtGrpId.identity_range.end = s.getEnd();
ExtGrpId.identity_range.pattern = s.getPattern();
info.ext_grp_id_ranges.push_back(ExtGrpId);
Logger::nrf_app().debug(
"\t\t Ext_Id_Ranges: Start - %s, End - %s, Pattern - %s",
ExtGrpId.identity_range.start.c_str(),
ExtGrpId.identity_range.end.c_str(),
ExtGrpId.identity_range.pattern.c_str());
}
}
if (udm_info_api.routingIndicatorsIsSet()) {
for (auto s : udm_info_api.getRoutingIndicators()) {
info.routing_indicator.push_back(s);
Logger::nrf_app().debug("\t\t Routing Indicators: %s", s.c_str());
}
}
// ToDo:- InternalGroupIdentifiersRanges
// for (auto s : udm_info_api.getInternalGroupIdentifiersRanges()) {
// internal_grpid_range_info_item_t IntGrpId = {};
// IntGrpId.int_grpid_range.start = s.getStart();
// IntGrpId.int_grpid_range.end = s.getEnd();
// IntGrpId.int_grpid_range.pattern = s.getPattern();
// info.ext_grp_id_ranges.push_back(IntGrpId);
// }
(std::static_pointer_cast<udm_profile>(profile))
.get()
->add_udm_info(info);
} break;
case NF_TYPE_UDR: {
Logger::nrf_app().debug("\tUDR profile, UDR Info");
profile.get()->set_nf_type(NF_TYPE_UDR);
udr_info_t info = {};
UdrInfo udr_info_api = api_profile.getUdrInfo();
if (udr_info_api.supiRangesIsSet()) {
for (auto s : udr_info_api.getSupiRanges()) {
supi_range_info_item_t supiRange = {};
supiRange.supi_range.start = s.getStart();
supiRange.supi_range.end = s.getEnd();
supiRange.supi_range.pattern = s.getPattern();
info.supi_ranges.push_back(supiRange);
Logger::nrf_app().debug(
"\t\t SupiRanges: Start - %s, End - %s, Pattern - %s",
supiRange.supi_range.start.c_str(),
supiRange.supi_range.end.c_str(),
supiRange.supi_range.pattern.c_str());
}
}
if (udr_info_api.gpsiRangesIsSet()) {
for (auto s : udr_info_api.getGpsiRanges()) {
identity_range_info_item_t gpsiRange = {};
gpsiRange.identity_range.start = s.getStart();
gpsiRange.identity_range.end = s.getEnd();
gpsiRange.identity_range.pattern = s.getPattern();
info.gpsi_ranges.push_back(gpsiRange);
Logger::nrf_app().debug(
"\t\t GpsiRanges: Start - %s, End - %s, Pattern - %s",
gpsiRange.identity_range.start.c_str(),
gpsiRange.identity_range.end.c_str(),
gpsiRange.identity_range.pattern.c_str());
}
}
if (udr_info_api.externalGroupIdentifiersRangesIsSet()) {
for (auto s : udr_info_api.getExternalGroupIdentifiersRanges()) {
identity_range_info_item_t ExtGrpId = {};
ExtGrpId.identity_range.start = s.getStart();
ExtGrpId.identity_range.end = s.getEnd();
ExtGrpId.identity_range.pattern = s.getPattern();
info.ext_grp_id_ranges.push_back(ExtGrpId);
Logger::nrf_app().debug(
"\t\t Ext_Grp_Id_Ranges: Start - %s, End - %s, Pattern - %s",
ExtGrpId.identity_range.start.c_str(),
ExtGrpId.identity_range.end.c_str(),
ExtGrpId.identity_range.pattern.c_str());
}
}
// ToDo:- s.getInterfaceType() Not Implemented
// for (auto s : udr_info_api.getSupportedDataSets()) {
// info.data_set_id.push_back(s);
// Logger::nrf_app().debug("\t\t Supported Data Sets: %s", s.c_str());
// }
(std::static_pointer_cast<udr_profile>(profile))
.get()
->add_udr_info(info);
} break;
default: {
}
}
......@@ -502,6 +631,7 @@ bool api_conv::subscription_api_to_nrf_subscription(
//------------------------------------------------------------------------------
nf_type_t api_conv::string_to_nf_type(const std::string& str) {
if (str.compare("NRF") == 0) return NF_TYPE_NRF;
if (str.compare("UDM") == 0) return NF_TYPE_UDM;
if (str.compare("AMF") == 0) return NF_TYPE_AMF;
if (str.compare("SMF") == 0) return NF_TYPE_SMF;
if (str.compare("AUSF") == 0) return NF_TYPE_AUSF;
......
......@@ -140,6 +140,14 @@ void nrf_app::handle_register_nf_instance(
sn = std::make_shared<ausf_profile>(m_event_sub);
} break;
case NF_TYPE_UDM: {
sn = std::make_shared<udm_profile>(m_event_sub);
} break;
case NF_TYPE_UDR: {
sn = std::make_shared<udr_profile>(m_event_sub);
} break;
default: {
sn = std::make_shared<nrf_profile>(m_event_sub);
}
......
This diff is collapsed.
......@@ -847,6 +847,140 @@ class ausf_profile : public nrf_profile {
ausf_info_t ausf_info;
};
class udm_profile : public nrf_profile {
public:
udm_profile(nrf_event& ev) : nrf_profile(ev, NF_TYPE_UDM) { udm_info = {}; }
udm_profile(nrf_event& ev, const std::string& id) : nrf_profile(ev, id) {
nf_type = NF_TYPE_UDM;
udm_info = {};
}
udm_profile(udm_profile& b) = delete;
/*
* Add a UDM info
* @param [const udm_info_t &] info: UDM info
* @return void
*/
void add_udm_info(const udm_info_t& info);
/*
* Get list of UDM infos a UDM info
* @param [const udm_info_t &] info: UDM info
* @return void
*/
void get_udm_info(udm_info_t& infos) const;
/*
* Print related-information for a UDM profile
* @param void
* @return void:
*/
void display();
/*
* Update a new value for a member of UDM profile
* @param [const std::string &] path: member name
* @param [const std::string &] value: new value
* @return void
*/
bool replace_profile_info(const std::string& path, const std::string& value);
/*
* Add a new value for a member of UDM profile
* @param [const std::string &] path: member name
* @param [const std::string &] value: new value
* @return true if success, otherwise false
*/
bool add_profile_info(const std::string& path, const std::string& value);
/*
* Remove value of a member of UDM profile
* @param [const std::string &] path: member name
* @param [const std::string &] value: new value
* @return true if success, otherwise false
*/
bool remove_profile_info(const std::string& path);
/*
* Represent UDM profile as json object
* @param [nlohmann::json &] data: Json data
* @return void
*/
void to_json(nlohmann::json& data) const;
private:
udm_info_t udm_info;
};
class udr_profile : public nrf_profile {
public:
udr_profile(nrf_event& ev) : nrf_profile(ev, NF_TYPE_UDR) { udr_info = {}; }
udr_profile(nrf_event& ev, const std::string& id) : nrf_profile(ev, id) {
nf_type = NF_TYPE_UDR;
udr_info = {};
}
udr_profile(udr_profile& b) = delete;
/*
* Add a UDR info
* @param [const udr_info_t &] info: UDR info
* @return void
*/
void add_udr_info(const udr_info_t& info);
/*
* Get list of UDR infos a UDR info
* @param [const udr_info_t &] info: UDR info
* @return void
*/
void get_udr_info(udr_info_t& infos) const;
/*
* Print related-information for a UDR profile
* @param void
* @return void:
*/
void display();
/*
* Update a new value for a member of UDR profile
* @param [const std::string &] path: member name
* @param [const std::string &] value: new value
* @return void
*/
bool replace_profile_info(const std::string& path, const std::string& value);
/*
* Add a new value for a member of UDR profile
* @param [const std::string &] path: member name
* @param [const std::string &] value: new value
* @return true if success, otherwise false
*/
bool add_profile_info(const std::string& path, const std::string& value);
/*
* Remove value of a member of UDR profile
* @param [const std::string &] path: member name
* @param [const std::string &] value: new value
* @return true if success, otherwise false
*/
bool remove_profile_info(const std::string& path);
/*
* Represent UDR profile as json object
* @param [nlohmann::json &] data: Json data
* @return void
*/
void to_json(nlohmann::json& data) const;
private:
udr_info_t udr_info;
};
} // namespace app
} // namespace nrf
} // namespace oai
......
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