Commit 8ea27d3b authored by General ABS's avatar General ABS Committed by rmagueta

Fix IPaddrs for SCTP_NEW_ASSOCIATION_IND

parent 7afede37
......@@ -34,6 +34,7 @@
#include "f1ap_encoder.h"
#include "f1ap_itti_messaging.h"
#include "f1ap_cu_interface_management.h"
#include "f1ap_cu_task.h"
int CU_send_RESET(instance_t instance, F1AP_Reset_t *Reset) {
AssertFatal(1==0,"Not implemented yet\n");
......@@ -145,6 +146,16 @@ int CU_handle_F1_SETUP_REQUEST(instance_t instance,
// LTS: FIXME cell_type is not a attribute of a cell in the data structure !!!!!!!!!!
f1ap_req(true, instance)->cell_type = CELL_MACRO_GNB;
eth_params_t *IPaddrs = NULL;
for (int mod_id = 0; mod_id < RC.nb_nr_inst; mod_id++) {
if (req->cell[i].nr_pci == RC.nrrrc[mod_id]->carrier.physCellId) {
IPaddrs = &RC.nrrrc[mod_id]->eth_params_s;
break;
}
}
AssertFatal(IPaddrs != NULL, "IPaddrs is NULL!\n");
create_gtpInst(instance, IPaddrs);
// FDD Cells
if (servedCellInformation->nR_Mode_Info.present==F1AP_NR_Mode_Info_PR_fDD) {
struct fdd_s *FDDs=&req->nr_mode_info[i].fdd;
......
......@@ -48,23 +48,16 @@ static instance_t cu_task_create_gtpu_instance(eth_params_t *IPaddrs) {
return gtpv1Init(tmp);
}
static void cu_task_handle_sctp_association_ind(instance_t instance, sctp_new_association_ind_t *sctp_new_association_ind,
eth_params_t *IPaddrs) {
static void cu_task_handle_sctp_association_ind(instance_t instance, sctp_new_association_ind_t *sctp_new_association_ind)
{
createF1inst(true, instance, NULL);
// save the assoc id
f1ap_setup_req_t *f1ap_cu_data=f1ap_req(true, instance);
f1ap_cu_data->assoc_id = sctp_new_association_ind->assoc_id;
f1ap_cu_data->sctp_in_streams = sctp_new_association_ind->in_streams;
f1ap_setup_req_t *f1ap_cu_data = f1ap_req(true, instance);
f1ap_cu_data->assoc_id = sctp_new_association_ind->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;
f1ap_cu_data->default_sctp_stream_id = 0;
if (RC.nrrrc[instance]->node_type != ngran_gNB_CUCP) {
getCxt(CUtype, instance)->gtpInst = cu_task_create_gtpu_instance(IPaddrs);
AssertFatal(getCxt(CUtype, instance)->gtpInst > 0, "Failed to create CU F1-U UDP listener");
} else
LOG_I(F1AP, "In F1AP connection, don't start GTP-U, as we have also E1AP\n");
// Fixme: fully inconsistent instances management
// dirty global var is a bad fix
CUuniqInstance=getCxt(CUtype, instance)->gtpInst;
}
static void cu_task_handle_sctp_association_resp(instance_t instance, sctp_new_association_resp_t *sctp_new_association_resp) {
......@@ -113,6 +106,13 @@ static void cu_task_send_sctp_init_req(instance_t instance, char *my_addr) {
itti_send_msg_to_task(TASK_SCTP, instance, message_p);
}
void create_gtpInst(instance_t instance, eth_params_t *IPaddrs)
{
getCxt(CUtype, instance)->gtpInst = cu_task_create_gtpu_instance(IPaddrs);
AssertFatal(getCxt(CUtype, instance)->gtpInst > 0, "Failed to create CU F1-U UDP listener");
CUuniqInstance = getCxt(CUtype, instance)->gtpInst;
}
void *F1AP_CU_task(void *arg) {
MessageDef *received_msg = NULL;
int result;
......@@ -120,12 +120,12 @@ void *F1AP_CU_task(void *arg) {
// no RLC in CU, initialize mem pool for PDCP
pool_buffer_init();
itti_mark_task_ready(TASK_CU_F1);
eth_params_t *IPaddrs;
// Hardcoded instance id!
IPaddrs = &RC.nrrrc[0]->eth_params_s;
cu_task_send_sctp_init_req(0, IPaddrs->my_addr);
eth_params_t *IPaddrs[RC.nb_nr_inst];
for (int mod_id = 0; mod_id < RC.nb_nr_inst; mod_id++) {
IPaddrs[mod_id] = &RC.nrrrc[mod_id]->eth_params_s;
cu_task_send_sctp_init_req(mod_id, IPaddrs[mod_id]->my_addr);
}
while (1) {
itti_receive_msg(TASK_CU_F1, &received_msg);
......@@ -134,8 +134,7 @@ void *F1AP_CU_task(void *arg) {
switch (ITTI_MSG_ID(received_msg)) {
case SCTP_NEW_ASSOCIATION_IND:
cu_task_handle_sctp_association_ind(ITTI_MSG_ORIGIN_INSTANCE(received_msg),
&received_msg->ittiMsg.sctp_new_association_ind,
IPaddrs);
&received_msg->ittiMsg.sctp_new_association_ind);
break;
case SCTP_NEW_ASSOCIATION_RESP:
......
......@@ -23,5 +23,6 @@
#define F1AP_CU_TASK_H_
void *F1AP_CU_task(void *arg);
void create_gtpInst(instance_t instance, eth_params_t *IPaddrs);
#endif /* F1AP_CU_TASK_H_ */
......@@ -197,8 +197,8 @@ gNBs = (
tr_s_preference = "f1";
local_s_if_name = "lo";
local_s_address = "127.0.0.4";
remote_s_address = "127.0.0.3";
local_s_address = "127.0.0.6";
remote_s_address = "127.0.0.5";
local_s_portc = 501;
local_s_portd = 2152;
remote_s_portc = 500;
......
......@@ -159,8 +159,8 @@ MACRLCs = ({
tr_s_preference = "local_L1";
tr_n_preference = "f1";
local_n_if_name = "lo";
local_n_address = "127.0.0.3";
remote_n_address = "127.0.0.4";
local_n_address = "127.0.0.5";
remote_n_address = "127.0.0.6";
local_n_portc = 500;
local_n_portd = 2152;
remote_n_portc = 501;
......
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