[NRF] Implemented PLMN list update handling in nrf_nnrf_handle_nf_update (#3566)

- Added functionality to parse and validate the plmnList JSON array
  during a PATCH request.
- Updated the nf_instance structure with new PLMN data from the request.
- Ensured robust error handling for invalid PLMN entries
  and excessive PLMN counts.
- Responded with appropriate HTTP status codes for success and error scenarios.
This commit is contained in:
Sukchan Lee 2024-12-26 14:36:00 +09:00
parent 2ce9f2b27e
commit 33960bbb66
4 changed files with 185 additions and 6 deletions

View file

@ -1205,6 +1205,35 @@ void ogs_sbi_free_plmn_list(OpenAPI_list_t *PlmnList)
OpenAPI_list_free(PlmnList);
}
/**
* Compares an ogs_plmn_id_t structure with an OpenAPI_plmn_id_t structure.
*
* @param plmn_list The PLMN-ID in ogs_plmn_id_t format.
* @param PlmnList The PLMN-ID in OpenAPI_plmn_id_t format.
* @return true if the PLMN-IDs are equal; otherwise, false.
*/
bool ogs_sbi_compare_plmn_list(
ogs_plmn_id_t *plmn_id, OpenAPI_plmn_id_t *PlmnId)
{
ogs_plmn_id_t temp_plmn_id;
ogs_assert(plmn_id);
ogs_assert(PlmnId);
ogs_assert(PlmnId->mcc);
ogs_assert(PlmnId->mnc);
/* Convert OpenAPI_plmn_id_t to ogs_plmn_id_t */
ogs_sbi_parse_plmn_id(&temp_plmn_id, PlmnId);
/* Compare MCC and MNC values */
if (ogs_plmn_id_mcc(plmn_id) == ogs_plmn_id_mcc(&temp_plmn_id) &&
ogs_plmn_id_mnc(plmn_id) == ogs_plmn_id_mnc(&temp_plmn_id)) {
return true;
}
return false;
}
OpenAPI_plmn_id_nid_t *ogs_sbi_build_plmn_id_nid(ogs_plmn_id_t *plmn_id)
{
OpenAPI_plmn_id_nid_t *PlmnIdNid = NULL;