Commit 5f78fa6e authored by Sakthivel Velumani's avatar Sakthivel Velumani

NGAP: put mcc, mnc, nssai inside new plmn struct

parent f381e932
......@@ -423,6 +423,14 @@ typedef enum ngap_paging_ind_present_s {
NGAP_PAGING_IND_PAGING_PRIORITY = (1 << 1),
} ngap_paging_ind_present_t;
typedef struct {
uint16_t mcc;
uint16_t mnc;
uint8_t mnc_digit_length;
uint8_t num_nssai;
nssai_t s_nssai[8];
} ngap_plmn_t;
//-------------------------------------------------------------------------------------------//
// gNB application layer -> NGAP messages
typedef struct ngap_register_gnb_req_s {
......@@ -447,13 +455,8 @@ typedef struct ngap_register_gnb_req_s {
/* Mobile Country Code
* Mobile Network Code
*/
uint16_t mcc[PLMN_LIST_MAX_SIZE];
uint16_t mnc[PLMN_LIST_MAX_SIZE];
uint8_t mnc_digit_length[PLMN_LIST_MAX_SIZE];
uint8_t num_plmn;
uint16_t num_nssai[PLMN_LIST_MAX_SIZE];
nssai_t s_nssai[PLMN_LIST_MAX_SIZE][8];
ngap_plmn_t plmn[PLMN_LIST_MAX_SIZE];
/* Default Paging DRX of the gNB as defined in TS 38.304 */
ngap_paging_drx_t default_drx;
......
......@@ -1750,21 +1750,22 @@ int RCconfig_NR_NG(MessageDef *msg_p, uint32_t i) {
sprintf(snssaistr, "%s.[%i].%s.[%i]", GNB_CONFIG_STRING_GNB_LIST, k, GNB_CONFIG_STRING_PLMN_LIST, l);
config_getlist(&SNSSAIParamList, SNSSAIParams, sizeof(SNSSAIParams)/sizeof(paramdef_t), snssaistr);
NGAP_REGISTER_GNB_REQ (msg_p).mcc[l] = *PLMNParamList.paramarray[l][GNB_MOBILE_COUNTRY_CODE_IDX].uptr;
NGAP_REGISTER_GNB_REQ (msg_p).mnc[l] = *PLMNParamList.paramarray[l][GNB_MOBILE_NETWORK_CODE_IDX].uptr;
NGAP_REGISTER_GNB_REQ (msg_p).mnc_digit_length[l] = *PLMNParamList.paramarray[l][GNB_MNC_DIGIT_LENGTH].u8ptr;
NGAP_REGISTER_GNB_REQ(msg_p).plmn[l].mcc = *PLMNParamList.paramarray[l][GNB_MOBILE_COUNTRY_CODE_IDX].uptr;
NGAP_REGISTER_GNB_REQ(msg_p).plmn[l].mnc = *PLMNParamList.paramarray[l][GNB_MOBILE_NETWORK_CODE_IDX].uptr;
NGAP_REGISTER_GNB_REQ(msg_p).plmn[l].mnc_digit_length = *PLMNParamList.paramarray[l][GNB_MNC_DIGIT_LENGTH].u8ptr;
NGAP_REGISTER_GNB_REQ (msg_p).default_drx = 0;
AssertFatal((NGAP_REGISTER_GNB_REQ (msg_p).mnc_digit_length[l] == 2) ||
(NGAP_REGISTER_GNB_REQ (msg_p).mnc_digit_length[l] == 3),
AssertFatal((NGAP_REGISTER_GNB_REQ(msg_p).plmn[l].mnc_digit_length == 2)
|| (NGAP_REGISTER_GNB_REQ(msg_p).plmn[l].mnc_digit_length == 3),
"BAD MNC DIGIT LENGTH %d",
NGAP_REGISTER_GNB_REQ (msg_p).mnc_digit_length[l]);
NGAP_REGISTER_GNB_REQ (msg_p).num_nssai[l] = SNSSAIParamList.numelt;
NGAP_REGISTER_GNB_REQ(msg_p).plmn[l].mnc_digit_length);
NGAP_REGISTER_GNB_REQ(msg_p).plmn[l].num_nssai = SNSSAIParamList.numelt;
for (int s = 0; s < SNSSAIParamList.numelt; ++s) {
NGAP_REGISTER_GNB_REQ(msg_p).s_nssai[l][s].sst = *SNSSAIParamList.paramarray[s][GNB_SLICE_SERVICE_TYPE_IDX].uptr;
NGAP_REGISTER_GNB_REQ(msg_p).plmn[l].s_nssai[s].sst =
*SNSSAIParamList.paramarray[s][GNB_SLICE_SERVICE_TYPE_IDX].uptr;
// SD is optional
// 0xffffff is "no SD", see 23.003 Sec 28.4.2
NGAP_REGISTER_GNB_REQ(msg_p).s_nssai[l][s].sd =
NGAP_REGISTER_GNB_REQ(msg_p).plmn[l].s_nssai[s].sd =
(*SNSSAIParamList.paramarray[s][GNB_SLICE_DIFFERENTIATOR_IDX].uptr & 0xffffff);
}
}
......
......@@ -156,9 +156,14 @@ void ngap_gNB_handle_register_gNB(instance_t instance, ngap_register_gnb_req_t *
DevCheck(new_instance->tac == ngap_register_gNB->tac, new_instance->tac, ngap_register_gNB->tac, 0);
for (int i = 0; i < new_instance->num_plmn; i++) {
DevCheck(new_instance->mcc[i] == ngap_register_gNB->mcc[i], new_instance->mcc[i], ngap_register_gNB->mcc[i], 0);
DevCheck(new_instance->mnc[i] == ngap_register_gNB->mnc[i], new_instance->mnc[i], ngap_register_gNB->mnc[i], 0);
DevCheck(new_instance->mnc_digit_length[i] == ngap_register_gNB->mnc_digit_length[i], new_instance->mnc_digit_length[i], ngap_register_gNB->mnc_digit_length[i], 0);
ngap_plmn_t *exist_plmn = &new_instance->plmn[i];
ngap_plmn_t *new_plmn = &ngap_register_gNB->plmn[i];
DevCheck(exist_plmn->mcc == new_plmn->mcc, exist_plmn->mcc, new_plmn->mcc, 0);
DevCheck(exist_plmn->mnc == new_plmn->mnc, exist_plmn->mnc, new_plmn->mnc, 0);
DevCheck(exist_plmn->mnc_digit_length == new_plmn->mnc_digit_length,
exist_plmn->mnc_digit_length,
new_plmn->mnc_digit_length,
0);
}
DevCheck(new_instance->default_drx == ngap_register_gNB->default_drx, new_instance->default_drx, ngap_register_gNB->default_drx, 0);
......@@ -178,18 +183,17 @@ void ngap_gNB_handle_register_gNB(instance_t instance, ngap_register_gnb_req_t *
sizeof(ngap_register_gNB->gnb_ip_address));
for (int i = 0; i < ngap_register_gNB->num_plmn; i++) {
new_instance->mcc[i] = ngap_register_gNB->mcc[i];
new_instance->mnc[i] = ngap_register_gNB->mnc[i];
new_instance->mnc_digit_length[i] = ngap_register_gNB->mnc_digit_length[i];
new_instance->num_nssai[i] = ngap_register_gNB->num_nssai[i];
new_instance->plmn[i].mcc = ngap_register_gNB->plmn[i].mcc;
new_instance->plmn[i].mnc = ngap_register_gNB->plmn[i].mnc;
new_instance->plmn[i].mnc_digit_length = ngap_register_gNB->plmn[i].mnc_digit_length;
new_instance->plmn[i].num_nssai = ngap_register_gNB->plmn[i].num_nssai;
memcpy(&new_instance->plmn[i].s_nssai, &ngap_register_gNB->plmn[i].s_nssai, sizeof(ngap_register_gNB->plmn[i].s_nssai));
}
new_instance->num_plmn = ngap_register_gNB->num_plmn;
new_instance->default_drx = ngap_register_gNB->default_drx;
memcpy(new_instance->s_nssai, ngap_register_gNB->s_nssai, sizeof(ngap_register_gNB->s_nssai));
/* Add the new instance to the list of gNB (meaningfull in virtual mode) */
ngap_gNB_insert_new_instance(new_instance);
NGAP_INFO("Registered new gNB[%ld] and %s gNB id %u\n",
......@@ -410,9 +414,9 @@ static int ngap_gNB_generate_ng_setup_request(
ie->value.present = NGAP_NGSetupRequestIEs__value_PR_GlobalRANNodeID;
ie->value.choice.GlobalRANNodeID.present = NGAP_GlobalRANNodeID_PR_globalGNB_ID;
ie->value.choice.GlobalRANNodeID.choice.globalGNB_ID = CALLOC(1, sizeof(struct NGAP_GlobalGNB_ID));
MCC_MNC_TO_PLMNID(instance_p->mcc[ngap_amf_data_p->broadcast_plmn_index[0]],
instance_p->mnc[ngap_amf_data_p->broadcast_plmn_index[0]],
instance_p->mnc_digit_length[ngap_amf_data_p->broadcast_plmn_index[0]],
MCC_MNC_TO_PLMNID(instance_p->plmn[ngap_amf_data_p->broadcast_plmn_index[0]].mcc,
instance_p->plmn[ngap_amf_data_p->broadcast_plmn_index[0]].mnc,
instance_p->plmn[ngap_amf_data_p->broadcast_plmn_index[0]].mnc_digit_length,
&(ie->value.choice.GlobalRANNodeID.choice.globalGNB_ID->pLMNIdentity));
ie->value.choice.GlobalRANNodeID.choice.globalGNB_ID->gNB_ID.present = NGAP_GNB_ID_PR_gNB_ID;
MACRO_GNB_ID_TO_BIT_STRING(instance_p->gNB_id,
......@@ -446,16 +450,14 @@ static int ngap_gNB_generate_ng_setup_request(
{
for (int i = 0; i < ngap_amf_data_p->broadcast_plmn_num; ++i) {
plmn = (NGAP_BroadcastPLMNItem_t *)calloc(1, sizeof(NGAP_BroadcastPLMNItem_t));
MCC_MNC_TO_TBCD(instance_p->mcc[ngap_amf_data_p->broadcast_plmn_index[i]],
instance_p->mnc[ngap_amf_data_p->broadcast_plmn_index[i]],
instance_p->mnc_digit_length[ngap_amf_data_p->broadcast_plmn_index[i]],
&plmn->pLMNIdentity);
ngap_plmn_t *plmn_req = &instance_p->plmn[ngap_amf_data_p->broadcast_plmn_index[i]];
MCC_MNC_TO_TBCD(plmn_req->mcc, plmn_req->mnc, plmn_req->mnc_digit_length, &plmn->pLMNIdentity);
for(int si = 0; si < instance_p->num_nssai[i]; si++) {
for (int si = 0; si < plmn_req->num_nssai; si++) {
ssi = (NGAP_SliceSupportItem_t *)calloc(1, sizeof(NGAP_SliceSupportItem_t));
INT8_TO_OCTET_STRING(instance_p->s_nssai[i][si].sst, &ssi->s_NSSAI.sST);
INT8_TO_OCTET_STRING(plmn_req->s_nssai[si].sst, &ssi->s_NSSAI.sST);
const uint32_t sd = instance_p->s_nssai[i][si].sd;
const uint32_t sd = plmn_req->s_nssai[si].sd;
if (sd != 0xffffff) {
ssi->s_NSSAI.sD = calloc(1, sizeof(NGAP_SD_t));
ssi->s_NSSAI.sD->buf = calloc(3, sizeof(uint8_t));
......@@ -467,7 +469,7 @@ static int ngap_gNB_generate_ng_setup_request(
asn1cSeqAdd(&plmn->tAISliceSupportList.list, ssi);
}
asn1cSeqAdd(&ta->broadcastPLMNList.list, plmn);
}
}
......
......@@ -31,6 +31,7 @@
#include "queue.h"
#include "tree.h"
#include "openair2/COMMON/ngap_messages_types.h"
#ifndef NGAP_GNB_DEFS_H_
#define NGAP_GNB_DEFS_H_
......@@ -253,13 +254,8 @@ typedef struct ngap_gNB_instance_s {
/* Mobile Country Code
* Mobile Network Code
*/
uint16_t mcc[PLMN_LIST_MAX_SIZE];
uint16_t mnc[PLMN_LIST_MAX_SIZE];
uint8_t mnc_digit_length[PLMN_LIST_MAX_SIZE];
uint8_t num_plmn;
uint16_t num_nssai[PLMN_LIST_MAX_SIZE];
nssai_t s_nssai[PLMN_LIST_MAX_SIZE][8];
uint8_t num_plmn;
ngap_plmn_t plmn[PLMN_LIST_MAX_SIZE];
/* Default Paging DRX of the gNB as defined in TS 38.304 */
ngap_paging_drx_t default_drx;
......
......@@ -114,14 +114,15 @@ int ngap_gNB_handle_nas_first_req(instance_t instance, ngap_nas_first_req_t *UEf
amf_desc_p = ngap_gNB_nnsf_select_amf_by_amf_setid(instance_p, UEfirstReq->establishment_cause, UEfirstReq->selected_plmn_identity, UEfirstReq->ue_identity.s_tmsi.amf_set_id);
if (amf_desc_p) {
NGAP_INFO("[gNB %ld] Chose AMF '%s' (assoc_id %d) through S-TMSI AMFSI %d and selected PLMN Identity index %d MCC %d MNC %d\n",
instance,
amf_desc_p->amf_name,
amf_desc_p->assoc_id,
UEfirstReq->ue_identity.s_tmsi.amf_set_id,
UEfirstReq->selected_plmn_identity,
instance_p->mcc[UEfirstReq->selected_plmn_identity],
instance_p->mnc[UEfirstReq->selected_plmn_identity]);
NGAP_INFO(
"[gNB %ld] Chose AMF '%s' (assoc_id %d) through S-TMSI AMFSI %d and selected PLMN Identity index %d MCC %d MNC %d\n",
instance,
amf_desc_p->amf_name,
amf_desc_p->assoc_id,
UEfirstReq->ue_identity.s_tmsi.amf_set_id,
UEfirstReq->selected_plmn_identity,
instance_p->plmn[UEfirstReq->selected_plmn_identity].mcc,
instance_p->plmn[UEfirstReq->selected_plmn_identity].mnc);
}
}
}
......@@ -138,8 +139,8 @@ int ngap_gNB_handle_nas_first_req(instance_t instance, ngap_nas_first_req_t *UEf
amf_desc_p->amf_name,
amf_desc_p->assoc_id,
UEfirstReq->selected_plmn_identity,
instance_p->mcc[UEfirstReq->selected_plmn_identity],
instance_p->mnc[UEfirstReq->selected_plmn_identity]);
instance_p->plmn[UEfirstReq->selected_plmn_identity].mcc,
instance_p->plmn[UEfirstReq->selected_plmn_identity].mnc);
}
}
......@@ -212,16 +213,16 @@ int ngap_gNB_handle_nas_first_req(instance_t instance, ngap_nas_first_req_t *UEf
MACRO_GNB_ID_TO_CELL_IDENTITY(instance_p->gNB_id,
0, // Cell ID
&userinfo_nr_p->nR_CGI.nRCellIdentity);
MCC_MNC_TO_TBCD(instance_p->mcc[ue_desc_p->selected_plmn_identity],
instance_p->mnc[ue_desc_p->selected_plmn_identity],
instance_p->mnc_digit_length[ue_desc_p->selected_plmn_identity],
MCC_MNC_TO_TBCD(instance_p->plmn[ue_desc_p->selected_plmn_identity].mcc,
instance_p->plmn[ue_desc_p->selected_plmn_identity].mnc,
instance_p->plmn[ue_desc_p->selected_plmn_identity].mnc_digit_length,
&userinfo_nr_p->nR_CGI.pLMNIdentity);
/* Set TAI */
INT24_TO_OCTET_STRING(instance_p->tac, &userinfo_nr_p->tAI.tAC);
MCC_MNC_TO_PLMNID(instance_p->mcc[ue_desc_p->selected_plmn_identity],
instance_p->mnc[ue_desc_p->selected_plmn_identity],
instance_p->mnc_digit_length[ue_desc_p->selected_plmn_identity],
MCC_MNC_TO_PLMNID(instance_p->plmn[ue_desc_p->selected_plmn_identity].mcc,
instance_p->plmn[ue_desc_p->selected_plmn_identity].mnc,
instance_p->plmn[ue_desc_p->selected_plmn_identity].mnc_digit_length,
&userinfo_nr_p->tAI.pLMNIdentity);
}
......@@ -444,16 +445,16 @@ int ngap_gNB_nas_uplink(instance_t instance, ngap_uplink_nas_t *ngap_uplink_nas_
MACRO_GNB_ID_TO_CELL_IDENTITY(ngap_gNB_instance_p->gNB_id,
0, // Cell ID
&userinfo_nr_p->nR_CGI.nRCellIdentity);
MCC_MNC_TO_TBCD(ngap_gNB_instance_p->mcc[ue_context_p->selected_plmn_identity],
ngap_gNB_instance_p->mnc[ue_context_p->selected_plmn_identity],
ngap_gNB_instance_p->mnc_digit_length[ue_context_p->selected_plmn_identity],
MCC_MNC_TO_TBCD(ngap_gNB_instance_p->plmn[ue_context_p->selected_plmn_identity].mcc,
ngap_gNB_instance_p->plmn[ue_context_p->selected_plmn_identity].mnc,
ngap_gNB_instance_p->plmn[ue_context_p->selected_plmn_identity].mnc_digit_length,
&userinfo_nr_p->nR_CGI.pLMNIdentity);
/* Set TAI */
INT24_TO_OCTET_STRING(ngap_gNB_instance_p->tac, &userinfo_nr_p->tAI.tAC);
MCC_MNC_TO_PLMNID(ngap_gNB_instance_p->mcc[ue_context_p->selected_plmn_identity],
ngap_gNB_instance_p->mnc[ue_context_p->selected_plmn_identity],
ngap_gNB_instance_p->mnc_digit_length[ue_context_p->selected_plmn_identity],
MCC_MNC_TO_PLMNID(ngap_gNB_instance_p->plmn[ue_context_p->selected_plmn_identity].mcc,
ngap_gNB_instance_p->plmn[ue_context_p->selected_plmn_identity].mnc,
ngap_gNB_instance_p->plmn[ue_context_p->selected_plmn_identity].mnc_digit_length,
&userinfo_nr_p->tAI.pLMNIdentity);
}
if (ngap_gNB_encode_pdu(&pdu, &buffer, &length) < 0) {
......
......@@ -139,8 +139,8 @@ ngap_gNB_nnsf_select_amf_by_plmn_id(ngap_gNB_instance_t *instance_p,
/* Looking for served GUAMI PLMN Identity selected matching the one provided by the UE */
STAILQ_FOREACH(guami_p, &amf_data_p->served_guami, next) {
STAILQ_FOREACH(served_plmn_p, &guami_p->served_plmns, next) {
if ((served_plmn_p->mcc == instance_p->mcc[selected_plmn_identity]) &&
(served_plmn_p->mnc == instance_p->mnc[selected_plmn_identity])) {
if ((served_plmn_p->mcc == instance_p->plmn[selected_plmn_identity].mcc)
&& (served_plmn_p->mnc == instance_p->plmn[selected_plmn_identity].mnc)) {
break;
}
}
......@@ -211,8 +211,8 @@ ngap_gNB_nnsf_select_amf_by_amf_setid(ngap_gNB_instance_t *instance_p,
struct plmn_identity_s *served_plmn_p = NULL;
STAILQ_FOREACH(served_plmn_p, &guami_p->served_plmns, next) {
if ((served_plmn_p->mcc == instance_p->mcc[selected_plmn_identity]) &&
(served_plmn_p->mnc == instance_p->mnc[selected_plmn_identity])) {
if ((served_plmn_p->mcc == instance_p->plmn[selected_plmn_identity].mcc)
&& (served_plmn_p->mnc == instance_p->plmn[selected_plmn_identity].mnc)) {
break;
}
}
......
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