Commit 489a5358 authored by Sakthivel Velumani's avatar Sakthivel Velumani

Started with CUUP task

parent b416061f
......@@ -16,5 +16,6 @@
#include "openair2/COMMON/gtpv1_u_messages_def.h"
#include "openair2/COMMON/flexran_messages_def.h"
#include "openair2/COMMON/f1ap_messages_def.h"
#include "openair2/COMMON/e1ap_messages_def.h"
#include "openair2/COMMON/ngap_messages_def.h"
......@@ -412,7 +412,7 @@ typedef struct MessageHeader_s {
} MessageHeader;
typedef struct message_info_s {
int id;
MessagesIds id;
message_priorities_t priority;
/* Message payload size */
MessageHeaderSize size;
......
/*
* Licensed to the OpenAirInterface (OAI) Software Alliance under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The OpenAirInterface Software Alliance licenses this file to You under
* the OAI Public License, Version 1.1 (the "License"); you may not use this file
* except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.openairinterface.org/?page_id=698
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*-------------------------------------------------------------------------------
* For more information about the OpenAirInterface (OAI) Software Alliance:
* contact@openairinterface.org
*/
/* gNB_CUUP application layer -> E1AP messages */
MESSAGE_DEF(E1AP_SETUP_REQ , MESSAGE_PRIORITY_MED , e1ap_setup_req_t , e1ap_setup_req)
/* E1AP -> eNB_DU or eNB_CU_RRC -> E1AP application layer messages */
MESSAGE_DEF(E1AP_SETUP_RESP , MESSAGE_PRIORITY_MED, e1ap_setup_resp_t , e1ap_setup_resp)
......@@ -596,3 +596,74 @@ int e1apCUCP_handle_send_DATA_USAGE_REPORT(instance_t instance,
E1AP_E1AP_PDU_t *pdu) {
AssertFatal(false,"Not implemented yet\n");
}
void up_task_send_sctp_association_req(instance_t instance, e1ap_setup_req_t *e1ap_setup_req) {
DevAssert(e1ap_setup_req != NULL);
MessageDef *message_p = NULL;
sctp_new_association_req_t *sctp_new_association_req_p = NULL;
message_p = itti_alloc_new_message(TASK_CUUP_E1, 0, SCTP_NEW_ASSOCIATION_REQ);
sctp_new_association_req_p = &message_p->ittiMsg.sctp_new_association_req;
sctp_new_association_req_p->ulp_cnx_id = instance;
sctp_new_association_req_p->port = E1AP_PORT_NUMBER;
sctp_new_association_req_p->ppid = E1AP_SCTP_PPID;
sctp_new_association_req_p->in_streams = e1ap_setup_req->sctp_in_streams;
sctp_new_association_req_p->out_streams = e1ap_setup_req->sctp_out_streams;
// remote
memcpy(&sctp_new_association_req_p->remote_address,
&e1ap_setup_req->CUCP_e1_ip_address,
sizeof(e1ap_setup_req->CUCP_e1_ip_address));
// local
memcpy(&sctp_new_association_req_p->local_address,
&e1ap_setup_req->CUUP_e1_ip_address,
sizeof(e1ap_setup_req->CUUP_e1_ip_address));
itti_send_msg_to_task(TASK_SCTP, instance, message_p);
}
void up_task_handle_sctp_association_resp(instance_t instance, sctp_new_association_resp_t sctp_new_association_resp) {
DevAssert(sctp_new_association_resp != NULL);
if (sctp_new_association_resp->sctp_state != SCTP_STATE_ESTABLISHED) {
LOG_W(E1AP, "Received unsuccessful result for SCTP association (%u), instance %ld, cnx_id %u\n",
sctp_new_association_resp->sctp_state,
instance,
sctp_new_association_resp->ulp_cnx_id);
return;
}
e1ap_setup_req_t *e1ap_cuup_setup_req = &getCxt(UPtype, instance)->setupReq;
e1ap_cuup_setup_req->assoc_id = sctp_new_association_resp->assoc_id;
e1ap_cuup_setup_req->sctp_in_streams = sctp_new_association_resp->in_streams;
e1ap_cuup_setup_req->sctp_out_streams = sctp_new_association_resp->out_streams;
e1ap_cuup_setup_req->default_sctp_stream_id = 0;
e1apCUUP_send_SETUP_REQUEST(instance);
}
void *E1AP_CUUP_task(void *arg) {
LOG_I(E1AP, "Starting E1AP at CU UP\n");
// SCTP
while (1) {
MessageDef *msg = NULL;
itti_receive_msg(TASK_CUUP_E1, &msg);
instance_t myInstance=ITTI_MSG_DESTINATION_INSTANCE(msg);
switch (ITTI_MSG_ID(msg)) {
case E1AP_SETUP_REQ:
LOG_I(E1AP, "CUUP Task Received E1AP_SETUP_REQ\n");
e1ap_setup_req_t *msgSetup = &E1AP_SETUP_REQ(msg);
createE1inst(UPtype, instance, msgSetup);
up_task_send_sctp_association_req(instance, msgSetup);
break;
case SCTP_NEW_ASSOCIATION_RESP:
LOG_I(E1AP, "CUUP Task Received SCTP_NEW_ASSOCIATION_RESP\n");
up_task_handle_sctp_association_resp(instance, &msg->ittiMsg.sctp_new_association_resp);
break;
}
}
}
......@@ -33,6 +33,17 @@ e1ap_upcp_inst_t *getCxt(E1_t type, instance_t instance) {
return type ? e1_up_inst[instance] : e1_cp_inst[instance];
}
void createE1inst(E1_t type, instance_t instance, e1ap_setup_req_t *req) {
if (type == CPtype) {
AssertFatal(e1_cp_inst[instance] == NULL, "Double call to E1 CP instance %d\n", instance);
e1_cp_inst[instance] = (e1_upcp_inst_t *) calloc(1, sizeof(e1_upcp_inst_t));
} else {
AssertFatal(e1_up_inst[instance] == NULL, "Double call to E1 UP instance %d\n", instance);
e1_up_inst[instance] = (e1_upcp_inst_t *) calloc(1, sizeof(e1_upcp_inst_t));
memcpy(&e1_up_inst[instance]->setupReq, req, sizeof(e1ap_setup_req_t));
}
}
E1AP_TransactionID_t transacID[MAX_NUM_TRANSAC_IDS] = {0};
srand(time(NULL));
......
......@@ -26,6 +26,9 @@
#define MAX_NUM_TRANSAC_IDS 8
#define E1AP_MAX_NUM_PLMNS
#define E1AP_SETUP_REQ(mSGpTR) (mSGpTR)->ittiMsg.e1ap_setup_req
#define E1AP_SETUP_RESP(mSGpTR) (mSGpTR)->ittiMsg.e1ap_setup_resp
typedef struct PLMN_ID_s {
int id;
} PLMN_ID_t;
......@@ -37,6 +40,11 @@ typedef struct e1ap_setup_req_s {
uint64_t cn_support;
int supported_plmns;
PLMN_ID_t plmns[E1AP_MAX_NUM_PLMNS];
uint16_t sctp_in_streams;
uint16_t sctp_out_streams;
uint16_t default_sctp_stream_id;
f1ap_net_ip_address_t CUUP_e1_ip_address;
f1ap_net_ip_address_t CUCP_e1_ip_address;
} e1ap_setup_req_t;
typedef struct e1ap_upcp_inst_s {
......
/*
* Licensed to the OpenAirInterface (OAI) Software Alliance under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The OpenAirInterface Software Alliance licenses this file to You under
* the OAI Public License, Version 1.1 (the "License"); you may not use this file
* except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.openairinterface.org/?page_id=698
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*-------------------------------------------------------------------------------
* For more information about the OpenAirInterface (OAI) Software Alliance:
* contact@openairinterface.org
*/
#define E1AP_PORT_NUMBER (30924)
#define E1AP_SCTP_PPID (63)
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