Commit dc8694ce authored by Sreeshma Shiv's avatar Sreeshma Shiv

cleaning-xnsetup

parent b633b497
......@@ -95,6 +95,11 @@ typedef struct xnap_tdd_info_t {
xnap_transmission_bandwidth_t tbw;
} xnap_tdd_info_t;
typedef struct xnap_snssai_s {
uint8_t sst;
uint8_t sd;
} xnap_snssai_t;
typedef struct xnap_served_cell_info_t {
// NR CGI
xnap_plmn_t plmn;
......@@ -120,9 +125,8 @@ typedef struct xnap_setup_req_s {
uint32_t tai_support;
xnap_plmn_t plmn_support;
// Number of slide support items
uint16_t num_ssi;
uint8_t sst;
uint8_t sd;
uint16_t num_snssai;
xnap_snssai_t snssai[2];
xnap_amf_regioninfo_t amf_region_info;
uint8_t num_cells_available;
xnap_served_cell_info_t info;
......
......@@ -127,13 +127,9 @@ void gNB_app_register_xn(uint32_t gnb_id_num)
LOG_I(XNAP, "GNB_ID: %d \n", gnb_id);
uint64_t id;
char *name = NULL;
xnap_served_cell_info_t info;
read_xn_cell_info (&id, &name, &info);
//read_xn_cell_info (&id, &name, &XNAP_REGISTER_GNB_REQ(msg).setup_req);
//XNAP_REGISTER_GNB_REQ(msg).setup_req = Read_setup_req_Xn (&id, &name, &info, &XNAP_REGISTER_GNB_REQ(msg).setup_req);
Read_setup_req_Xn (&id, &name, &info, &XNAP_REGISTER_GNB_REQ(msg).setup_req);
XNAP_REGISTER_GNB_REQ(msg).net_config = Read_IPconfig_Xn ();
//F1AP_DU_REGISTER_REQ(msg).net_config = read_DU_IP_config(&RC.nrmac[0]->eth_params_n);
read_xn_setup(&id, &name, &XNAP_REGISTER_GNB_REQ(msg).setup_req);
XNAP_REGISTER_GNB_REQ(msg).net_config = Read_IPconfig_Xn();
XNAP_REGISTER_GNB_REQ(msg).gNB_name = name;
itti_send_msg_to_task(TASK_XNAP, GNB_MODULE_ID_TO_INSTANCE(gnb_id), msg);
}
}
......
This diff is collapsed.
......@@ -108,8 +108,7 @@ int RCconfig_NR_X2(MessageDef *msg_p, uint32_t i);
void wait_f1_setup_response(void);
int gNB_app_handle_f1ap_gnb_cu_configuration_update(f1ap_gnb_cu_configuration_update_t *gnb_cu_cfg_update);
MessageDef *RCconfig_NR_CU_E1(const E1_t *entity);
int read_xn_cell_info(uint64_t *id, char **name, xnap_served_cell_info_t *info);
void Read_setup_req_Xn(uint64_t *id, char **name, xnap_served_cell_info_t *info, xnap_setup_req_t *req);
void read_xn_setup(uint64_t *id, char **name, xnap_setup_req_t *req);
xnap_net_config_t Read_IPconfig_Xn(void);
ngran_node_t get_node_type(void);
......
......@@ -112,15 +112,14 @@ int xnap_gNB_generate_xn_setup_request(sctp_assoc_t assoc_id, xnap_setup_req_t *
req->info.plmn.mnc_digit_length,
&e_BroadcastPLMNinTAISupport_ItemIE->plmn_id);
{
for (int k = 0; k < 1; k++) {
e_S_NSSAI_ItemIE = (XNAP_S_NSSAI_t *)calloc(1, sizeof(XNAP_S_NSSAI_t));
e_S_NSSAI_ItemIE->sst.size = 1; // OCTET STRING(SIZE(1))
e_S_NSSAI_ItemIE->sst.buf = calloc(e_S_NSSAI_ItemIE->sst.size, sizeof(OCTET_STRING_t));
e_S_NSSAI_ItemIE->sst.buf[0] = 1;
asn1cSeqAdd(&e_BroadcastPLMNinTAISupport_ItemIE->tAISliceSupport_List.list, e_S_NSSAI_ItemIE);
for (int k = 0; k < 1; k++) {
e_S_NSSAI_ItemIE = (XNAP_S_NSSAI_t *)calloc(1, sizeof(XNAP_S_NSSAI_t));
INT8_TO_OCTET_STRING(req->snssai[k].sst, &e_S_NSSAI_ItemIE->sst);
if (req->snssai[k].sd != 0xffffff && req->snssai[k].sd != 0) {
e_S_NSSAI_ItemIE->sd = calloc(3, sizeof(OCTET_STRING_t));
INT24_TO_OCTET_STRING(req->snssai[k].sd, e_S_NSSAI_ItemIE->sd);
}
asn1cSeqAdd(&e_BroadcastPLMNinTAISupport_ItemIE->tAISliceSupport_List.list, e_S_NSSAI_ItemIE);
}
asn1cSeqAdd(&TAISupport_ItemIEs->broadcastPLMNs.list, e_BroadcastPLMNinTAISupport_ItemIE);
}
......@@ -310,7 +309,6 @@ int xnap_gNB_generate_xn_setup_request(sctp_assoc_t assoc_id, xnap_setup_req_t *
servedCellMember->served_cell_info_NR.nrModeInfo.choice.tdd->nrTransmissonBandwidth.nRSCS = XNAP_NRSCS_scs120;
break;
}
switch (tdd->tbw.nrb) {
case 11:
servedCellMember->served_cell_info_NR.nrModeInfo.choice.tdd->nrTransmissonBandwidth.nRNRB = XNAP_NRNRB_nrb11;
......@@ -371,7 +369,7 @@ int xnap_gNB_generate_xn_setup_request(sctp_assoc_t assoc_id, xnap_setup_req_t *
e_GlobalAMF_Region_Information_ItemIEs->amf_region_id.size = 1;
e_GlobalAMF_Region_Information_ItemIEs->amf_region_id.buf =
calloc(1, e_GlobalAMF_Region_Information_ItemIEs->amf_region_id.size);
e_GlobalAMF_Region_Information_ItemIEs->amf_region_id.buf[0] = 80;
e_GlobalAMF_Region_Information_ItemIEs->amf_region_id.buf[0] = 80; // TODO: Hardcoded for now
e_GlobalAMF_Region_Information_ItemIEs->amf_region_id.bits_unused = 0;
asn1cSeqAdd(&ie->value.choice.AMF_Region_Information.list, e_GlobalAMF_Region_Information_ItemIEs);
......@@ -608,28 +606,28 @@ int xnap_gNB_generate_xn_setup_response(sctp_assoc_t assoc_id, xnap_setup_resp_t
}
switch (fdd->ul_tbw.nrb) {
case 11:
case 0:
servedCellMember->served_cell_info_NR.nrModeInfo.choice.fdd->ulNRTransmissonBandwidth.nRNRB = XNAP_NRNRB_nrb11;
break;
case 18:
case 1:
servedCellMember->served_cell_info_NR.nrModeInfo.choice.fdd->ulNRTransmissonBandwidth.nRNRB = XNAP_NRNRB_nrb18;
break;
case 24:
case 2:
servedCellMember->served_cell_info_NR.nrModeInfo.choice.fdd->ulNRTransmissonBandwidth.nRNRB = XNAP_NRNRB_nrb24;
break;
case 78:
case 11:
servedCellMember->served_cell_info_NR.nrModeInfo.choice.fdd->ulNRTransmissonBandwidth.nRNRB = XNAP_NRNRB_nrb78;
break;
case 106:
case 14:
servedCellMember->served_cell_info_NR.nrModeInfo.choice.fdd->ulNRTransmissonBandwidth.nRNRB = XNAP_NRNRB_nrb106;
break;
case 162:
case 21:
servedCellMember->served_cell_info_NR.nrModeInfo.choice.fdd->ulNRTransmissonBandwidth.nRNRB = XNAP_NRNRB_nrb162;
break;
case 217:
case 24:
servedCellMember->served_cell_info_NR.nrModeInfo.choice.fdd->ulNRTransmissonBandwidth.nRNRB = XNAP_NRNRB_nrb217;
break;
case 273:
case 28:
servedCellMember->served_cell_info_NR.nrModeInfo.choice.fdd->ulNRTransmissonBandwidth.nRNRB = XNAP_NRNRB_nrb273;
break;
default:
......@@ -651,32 +649,32 @@ int xnap_gNB_generate_xn_setup_response(sctp_assoc_t assoc_id, xnap_setup_resp_t
break;
}
switch (fdd->dl_tbw.nrb) {
case 11:
case 0:
servedCellMember->served_cell_info_NR.nrModeInfo.choice.fdd->dlNRTransmissonBandwidth.nRNRB = XNAP_NRNRB_nrb11;
break;
case 18:
case 1:
servedCellMember->served_cell_info_NR.nrModeInfo.choice.fdd->dlNRTransmissonBandwidth.nRNRB = XNAP_NRNRB_nrb18;
break;
case 24:
case 2:
servedCellMember->served_cell_info_NR.nrModeInfo.choice.fdd->dlNRTransmissonBandwidth.nRNRB = XNAP_NRNRB_nrb24;
break;
case 78:
case 11:
servedCellMember->served_cell_info_NR.nrModeInfo.choice.fdd->dlNRTransmissonBandwidth.nRNRB = XNAP_NRNRB_nrb78;
break;
case 106:
case 14:
servedCellMember->served_cell_info_NR.nrModeInfo.choice.fdd->dlNRTransmissonBandwidth.nRNRB = XNAP_NRNRB_nrb106;
break;
case 162:
case 21:
servedCellMember->served_cell_info_NR.nrModeInfo.choice.fdd->dlNRTransmissonBandwidth.nRNRB = XNAP_NRNRB_nrb162;
break;
case 217:
case 24:
servedCellMember->served_cell_info_NR.nrModeInfo.choice.fdd->dlNRTransmissonBandwidth.nRNRB = XNAP_NRNRB_nrb217;
break;
case 273:
case 28:
servedCellMember->served_cell_info_NR.nrModeInfo.choice.fdd->dlNRTransmissonBandwidth.nRNRB = XNAP_NRNRB_nrb273;
break;
default:
AssertFatal(0, "Failed: Check value for N_RB_DL/N_RB_UL");
AssertFatal(0, "Failed: Check value for N_RB_DL/N_RB_UL"); // TODO: Add all values or function to convert
break;
}
} else if (resp->info.mode == XNAP_MODE_TDD) { // TDD
......@@ -690,6 +688,7 @@ int xnap_gNB_generate_xn_setup_response(sctp_assoc_t assoc_id, xnap_setup_resp_t
asn1cSeqAdd(&servedCellMember->served_cell_info_NR.nrModeInfo.choice.tdd->nrFrequencyInfo.frequencyBand_List.list,
nrfreqbanditem);
}
printf("nrnrb %d \n", tdd->tbw.nrb);
switch (tdd->tbw.scs) {
case 15:
servedCellMember->served_cell_info_NR.nrModeInfo.choice.tdd->nrTransmissonBandwidth.nRSCS = XNAP_NRSCS_scs15;
......@@ -705,32 +704,32 @@ int xnap_gNB_generate_xn_setup_response(sctp_assoc_t assoc_id, xnap_setup_resp_t
break;
}
switch (tdd->tbw.nrb) {
case 11:
case 0:
servedCellMember->served_cell_info_NR.nrModeInfo.choice.tdd->nrTransmissonBandwidth.nRNRB = XNAP_NRNRB_nrb11;
break;
case 18:
case 1:
servedCellMember->served_cell_info_NR.nrModeInfo.choice.tdd->nrTransmissonBandwidth.nRNRB = XNAP_NRNRB_nrb18;
break;
case 24:
case 2:
servedCellMember->served_cell_info_NR.nrModeInfo.choice.tdd->nrTransmissonBandwidth.nRNRB = XNAP_NRNRB_nrb24;
break;
case 78:
case 11:
servedCellMember->served_cell_info_NR.nrModeInfo.choice.tdd->nrTransmissonBandwidth.nRNRB = XNAP_NRNRB_nrb78;
break;
case 106:
case 14:
servedCellMember->served_cell_info_NR.nrModeInfo.choice.tdd->nrTransmissonBandwidth.nRNRB = XNAP_NRNRB_nrb106;
break;
case 162:
case 21:
servedCellMember->served_cell_info_NR.nrModeInfo.choice.tdd->nrTransmissonBandwidth.nRNRB = XNAP_NRNRB_nrb162;
break;
case 217:
case 24:
servedCellMember->served_cell_info_NR.nrModeInfo.choice.tdd->nrTransmissonBandwidth.nRNRB = XNAP_NRNRB_nrb217;
break;
case 273:
case 28:
servedCellMember->served_cell_info_NR.nrModeInfo.choice.tdd->nrTransmissonBandwidth.nRNRB = XNAP_NRNRB_nrb273;
break;
default:
AssertFatal(0, "Failed: Check value for N_RB_DL/N_RB_UL");
AssertFatal(0, "Failed: Check value for N_RB_DL/N_RB_UL"); // TODO: Add all values or function to convert.
break;
}
}
......
......@@ -74,7 +74,6 @@ static void xnap_gNB_handle_sctp_association_resp(instance_t instance, sctp_new_
xnap_gNB_instance_t *instance_xn = xnap_gNB_get_instance(instance); // managementproc;
DevAssert(sctp_new_association_resp != NULL);
DevAssert(instance_xn != NULL);
printf("reached ass resp %d \n", sctp_new_association_resp->assoc_id);
/*Return if connection to gNB failed- to be modified if needed. (Exit on error in X2AP)*/
if (sctp_new_association_resp->sctp_state == SCTP_STATE_UNREACHABLE) {
LOG_E(XNAP,
......@@ -106,8 +105,6 @@ static void xnap_gNB_handle_sctp_association_resp(instance_t instance, sctp_new_
xnap_gnb_data_p->out_streams = sctp_new_association_resp->out_streams;
xnap_dump_trees(instance);
xnap_insert_gnb(instance, xnap_gnb_data_p);
// RB_INSERT(xnap_gnb_tree, &instance_xn->xnap_gnbs, xnap_gnb_data_p);
// instance_xn->num_gnbs++;
xnap_dump_trees(instance);
xnap_gNB_generate_xn_setup_request(sctp_new_association_resp->assoc_id, &instance_xn->setup_req);
}
......@@ -141,9 +138,7 @@ static void xnap_gNB_send_sctp_assoc_req(instance_t instance, xnap_net_config_t
MessageDef *message = NULL;
sctp_new_association_req_t *sctp_new_association_req = NULL;
DevAssert(nc != NULL);
printf("blahblahblah \n");
message = itti_alloc_new_message(TASK_XNAP, 0, SCTP_NEW_ASSOCIATION_REQ);
printf("ghjfghjjdfhj\n");
sctp_new_association_req = &message->ittiMsg.sctp_new_association_req;
sctp_new_association_req->port = nc->gnb_port_for_XNC;
sctp_new_association_req->ppid = XNAP_SCTP_PPID;
......@@ -155,7 +150,6 @@ static void xnap_gNB_send_sctp_assoc_req(instance_t instance, xnap_net_config_t
sizeof(nc->target_gnb_xn_ip_address[index]));
memcpy(&sctp_new_association_req->local_address, &nc->gnb_xn_ip_address, sizeof(nc->gnb_xn_ip_address));
sctp_new_association_req->ulp_cnx_id = index;
// instance_p->xn_target_gnb_pending_nb++;
itti_send_msg_to_task(TASK_SCTP, instance, message);
}
......@@ -185,20 +179,13 @@ static void xnap_gNB_handle_sctp_init_msg_multi_cnf(instance_t instance, sctp_in
static void xnap_gNB_handle_sctp_association_ind(instance_t instance, sctp_new_association_ind_t *sctp_new_association_ind)
{
// f1ap_cudu_inst_t *f1ap_cu_data = getCxt(instance);
xnap_gNB_instance_t *instance_p = xnap_gNB_get_instance(instance);
DevAssert(instance_p != NULL);
xnap_gNB_data_t *xnap_gnb_data_p;
DevAssert(sctp_new_association_ind != NULL);
// we don't need the assoc_id, subsequent messages (the first being Xn Setup
// Request), will deliver the assoc_id
// f1ap_cu_data->sctp_in_streams = sctp_new_association_ind->in_streams;
// f1ap_cu_data->sctp_out_streams = sctp_new_association_ind->out_streams;
LOG_W(XNAP, "SCTP Association IND Received.\n");
xnap_dump_trees(instance);
xnap_gnb_data_p = xnap_get_gNB(instance, sctp_new_association_ind->assoc_id);
// DevAssert(xnap_gnb_data_p != NULL);
if (xnap_gnb_data_p == NULL) {
LOG_W(XNAP, "xnap_gnb_data_p does not exist\n");
/* TODO: Create new gNB descriptor-not yet associated? */
......@@ -206,13 +193,10 @@ static void xnap_gNB_handle_sctp_association_ind(instance_t instance, sctp_new_a
AssertFatal(xnap_gnb_data_p != NULL, "out of memory\n");
xnap_gnb_data_p->assoc_id = sctp_new_association_ind->assoc_id;
xnap_gnb_data_p->state = XNAP_GNB_STATE_WAITING;
printf("reached here1\n");
xnap_gnb_data_p->in_streams = sctp_new_association_ind->in_streams;
xnap_gnb_data_p->out_streams = sctp_new_association_ind->out_streams;
xnap_dump_trees(instance);
xnap_insert_gnb(instance, xnap_gnb_data_p);
// RB_INSERT(xnap_gnb_tree, &instance_xn->xnap_gnbs, xnap_gnb_data_p);
// instance_xn->num_gnbs++;
xnap_dump_trees(instance);
} else {
xnap_gnb_data_p->in_streams = sctp_new_association_ind->in_streams;
......@@ -227,7 +211,6 @@ void *xnap_task(void *arg)
MessageDef *received_msg = NULL;
int result;
LOG_D(XNAP, "Starting XNAP layer\n");
// xnap_gNB_prepare_internal_data(); // management procedures
itti_mark_task_ready(TASK_XNAP);
while (1) {
......
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