Commit f895c4d9 authored by Raymond Knopp's avatar Raymond Knopp

ENDC path switch S1-U: Bugfixes at eNB side. Problem at S1AP...

ENDC path switch S1-U: Bugfixes at eNB side. Problem at S1AP E-RAB-Modification-Indication message encoding to be resolved
parent cbba3da3
...@@ -3154,6 +3154,7 @@ void rrc_eNB_generate_defaultRRCConnectionReconfiguration(const protocol_ctxt_t ...@@ -3154,6 +3154,7 @@ void rrc_eNB_generate_defaultRRCConnectionReconfiguration(const protocol_ctxt_t
MeasId5->reportConfigId = 6; MeasId5->reportConfigId = 6;
ASN_SEQUENCE_ADD(&MeasId_list->list, MeasId5); ASN_SEQUENCE_ADD(&MeasId_list->list, MeasId5);
//ue_context_pP->ue_context.does_nr=0;
if (ue_context_pP->ue_context.does_nr) { if (ue_context_pP->ue_context.does_nr) {
MeasId6 = calloc(1, sizeof(LTE_MeasIdToAddMod_t)); MeasId6 = calloc(1, sizeof(LTE_MeasIdToAddMod_t));
if (MeasId6 == NULL) exit(1); if (MeasId6 == NULL) exit(1);
...@@ -3217,7 +3218,7 @@ void rrc_eNB_generate_defaultRRCConnectionReconfiguration(const protocol_ctxt_t ...@@ -3217,7 +3218,7 @@ void rrc_eNB_generate_defaultRRCConnectionReconfiguration(const protocol_ctxt_t
if (MeasObj2 == NULL) exit(1); if (MeasObj2 == NULL) exit(1);
MeasObj2->measObjectId = 2; MeasObj2->measObjectId = 2;
MeasObj2->measObject.present = LTE_MeasObjectToAddMod__measObject_PR_measObjectNR_r15; MeasObj2->measObject.present = LTE_MeasObjectToAddMod__measObject_PR_measObjectNR_r15;
MeasObj2->measObject.choice.measObjectNR_r15.carrierFreq_r15 = 642256; //634000; //(634000 = 3.51GHz) (640000 = 3.6GHz) (641272 = 3619.08MHz = 3600 + 30/1000*106*12/2) (642256 is for 3.6GHz and absoluteFrequencySSB = 642016) MeasObj2->measObject.choice.measObjectNR_r15.carrierFreq_r15 = 641272; //642208; //642208 is for SSB at ptA + 82 RBs with ptA at 3600MHz //642256; //634000; //(634000 = 3.51GHz) (640000 = 3.6GHz) (641272 = 3619.08MHz = 3600 + 30/1000*106*12/2) (642256 is for 3.6GHz and absoluteFrequencySSB = 642016)
MeasObj2->measObject.choice.measObjectNR_r15.rs_ConfigSSB_r15.measTimingConfig_r15.periodicityAndOffset_r15.present = LTE_MTC_SSB_NR_r15__periodicityAndOffset_r15_PR_sf20_r15; MeasObj2->measObject.choice.measObjectNR_r15.rs_ConfigSSB_r15.measTimingConfig_r15.periodicityAndOffset_r15.present = LTE_MTC_SSB_NR_r15__periodicityAndOffset_r15_PR_sf20_r15;
MeasObj2->measObject.choice.measObjectNR_r15.rs_ConfigSSB_r15.measTimingConfig_r15.periodicityAndOffset_r15.choice.sf20_r15 = 0; MeasObj2->measObject.choice.measObjectNR_r15.rs_ConfigSSB_r15.measTimingConfig_r15.periodicityAndOffset_r15.choice.sf20_r15 = 0;
MeasObj2->measObject.choice.measObjectNR_r15.rs_ConfigSSB_r15.measTimingConfig_r15.ssb_Duration_r15 = LTE_MTC_SSB_NR_r15__ssb_Duration_r15_sf4; MeasObj2->measObject.choice.measObjectNR_r15.rs_ConfigSSB_r15.measTimingConfig_r15.ssb_Duration_r15 = LTE_MTC_SSB_NR_r15__ssb_Duration_r15_sf4;
...@@ -3360,13 +3361,13 @@ void rrc_eNB_generate_defaultRRCConnectionReconfiguration(const protocol_ctxt_t ...@@ -3360,13 +3361,13 @@ void rrc_eNB_generate_defaultRRCConnectionReconfiguration(const protocol_ctxt_t
ReportConfig_NR->reportConfig.choice.reportConfigInterRAT.triggerType.present = LTE_ReportConfigInterRAT__triggerType_PR_event; ReportConfig_NR->reportConfig.choice.reportConfigInterRAT.triggerType.present = LTE_ReportConfigInterRAT__triggerType_PR_event;
ReportConfig_NR->reportConfig.choice.reportConfigInterRAT.triggerType.choice.event.eventId.present = LTE_ReportConfigInterRAT__triggerType__event__eventId_PR_eventB1_NR_r15; ReportConfig_NR->reportConfig.choice.reportConfigInterRAT.triggerType.choice.event.eventId.present = LTE_ReportConfigInterRAT__triggerType__event__eventId_PR_eventB1_NR_r15;
ReportConfig_NR->reportConfig.choice.reportConfigInterRAT.triggerType.choice.event.eventId.choice.eventB1_NR_r15.b1_ThresholdNR_r15.present = LTE_ThresholdNR_r15_PR_nr_RSRP_r15; ReportConfig_NR->reportConfig.choice.reportConfigInterRAT.triggerType.choice.event.eventId.choice.eventB1_NR_r15.b1_ThresholdNR_r15.present = LTE_ThresholdNR_r15_PR_nr_RSRP_r15;
ReportConfig_NR->reportConfig.choice.reportConfigInterRAT.triggerType.choice.event.eventId.choice.eventB1_NR_r15.b1_ThresholdNR_r15.choice.nr_RSRP_r15 = 46; ReportConfig_NR->reportConfig.choice.reportConfigInterRAT.triggerType.choice.event.eventId.choice.eventB1_NR_r15.b1_ThresholdNR_r15.choice.nr_RSRP_r15 = 0;
ReportConfig_NR->reportConfig.choice.reportConfigInterRAT.triggerType.choice.event.eventId.choice.eventB1_NR_r15.reportOnLeave_r15 = FALSE; ReportConfig_NR->reportConfig.choice.reportConfigInterRAT.triggerType.choice.event.eventId.choice.eventB1_NR_r15.reportOnLeave_r15 = FALSE;
ReportConfig_NR->reportConfig.choice.reportConfigInterRAT.triggerType.choice.event.hysteresis = 2; ReportConfig_NR->reportConfig.choice.reportConfigInterRAT.triggerType.choice.event.hysteresis = 2;
ReportConfig_NR->reportConfig.choice.reportConfigInterRAT.triggerType.choice.event.timeToTrigger = LTE_TimeToTrigger_ms80; ReportConfig_NR->reportConfig.choice.reportConfigInterRAT.triggerType.choice.event.timeToTrigger = LTE_TimeToTrigger_ms80;
ReportConfig_NR->reportConfig.choice.reportConfigInterRAT.maxReportCells = 4; ReportConfig_NR->reportConfig.choice.reportConfigInterRAT.maxReportCells = 4;
ReportConfig_NR->reportConfig.choice.reportConfigInterRAT.reportInterval = LTE_ReportInterval_ms120; ReportConfig_NR->reportConfig.choice.reportConfigInterRAT.reportInterval = LTE_ReportInterval_ms120;
ReportConfig_NR->reportConfig.choice.reportConfigInterRAT.reportAmount = LTE_ReportConfigInterRAT__reportAmount_infinity; ReportConfig_NR->reportConfig.choice.reportConfigInterRAT.reportAmount = LTE_ReportConfigInterRAT__reportAmount_r1;
ReportConfig_NR->reportConfig.choice.reportConfigInterRAT.ext7 = calloc(1, sizeof(struct LTE_ReportConfigInterRAT__ext7)); ReportConfig_NR->reportConfig.choice.reportConfigInterRAT.ext7 = calloc(1, sizeof(struct LTE_ReportConfigInterRAT__ext7));
if (ReportConfig_NR->reportConfig.choice.reportConfigInterRAT.ext7 == NULL) exit(1); if (ReportConfig_NR->reportConfig.choice.reportConfigInterRAT.ext7 == NULL) exit(1);
ReportConfig_NR->reportConfig.choice.reportConfigInterRAT.ext7->reportQuantityCellNR_r15 = calloc(1, sizeof(struct LTE_ReportQuantityNR_r15)); ReportConfig_NR->reportConfig.choice.reportConfigInterRAT.ext7->reportQuantityCellNR_r15 = calloc(1, sizeof(struct LTE_ReportQuantityNR_r15));
...@@ -4292,6 +4293,16 @@ rrc_eNB_generate_RRCConnectionReconfiguration_SCell( ...@@ -4292,6 +4293,16 @@ rrc_eNB_generate_RRCConnectionReconfiguration_SCell(
return(0); return(0);
} }
static volatile int start_nr;
static void *xx(void *_)
{
while (1) {
getchar();
start_nr = 1;
printf("start nr\n");
}
return 0;
}
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
void void
...@@ -4311,6 +4322,15 @@ rrc_eNB_process_MeasurementReport( ...@@ -4311,6 +4322,15 @@ rrc_eNB_process_MeasurementReport(
T(T_ENB_RRC_MEASUREMENT_REPORT, T_INT(ctxt_pP->module_id), T_INT(ctxt_pP->frame), T(T_ENB_RRC_MEASUREMENT_REPORT, T_INT(ctxt_pP->module_id), T_INT(ctxt_pP->frame),
T_INT(ctxt_pP->subframe), T_INT(ctxt_pP->rnti)); T_INT(ctxt_pP->subframe), T_INT(ctxt_pP->rnti));
{
static int conf = 0;
if (!conf) {
pthread_t t;
pthread_create(&t, NULL, xx, NULL);
conf = 1;
}
}
if (measResults2 == NULL ) if (measResults2 == NULL )
return; return;
...@@ -4321,6 +4341,7 @@ rrc_eNB_process_MeasurementReport( ...@@ -4321,6 +4341,7 @@ rrc_eNB_process_MeasurementReport(
ue_context_pP->ue_context.measResults->measId=measResults2->measId; ue_context_pP->ue_context.measResults->measId=measResults2->measId;
printf("meas %d\n", (int)measResults2->measId);
switch (measResults2->measId) { switch (measResults2->measId) {
case 1: case 1:
LOG_D(RRC,"Periodic report at frame %d and subframe %d \n", ctxt_pP->frame, ctxt_pP->subframe); LOG_D(RRC,"Periodic report at frame %d and subframe %d \n", ctxt_pP->frame, ctxt_pP->subframe);
...@@ -4366,7 +4387,11 @@ rrc_eNB_process_MeasurementReport( ...@@ -4366,7 +4387,11 @@ rrc_eNB_process_MeasurementReport(
/* TODO: improve NR triggering */ /* TODO: improve NR triggering */
if (measResults2->measId == 7) { if (measResults2->measId == 7) {
if (ue_context_pP->ue_context.Status != RRC_NR_NSA) { // if (start_nr) {
printf("nr\n");
static int gonr = 0;
if (!gonr && ue_context_pP->ue_context.Status != RRC_NR_NSA) {
gonr=1;
MessageDef *msg; MessageDef *msg;
ue_context_pP->ue_context.Status = RRC_NR_NSA; ue_context_pP->ue_context.Status = RRC_NR_NSA;
...@@ -4382,6 +4407,14 @@ rrc_eNB_process_MeasurementReport( ...@@ -4382,6 +4407,14 @@ rrc_eNB_process_MeasurementReport(
memcpy(&X2AP_ENDC_SGNB_ADDITION_REQ(msg).e_rabs_tobeadded[e_rab].sgw_addr, memcpy(&X2AP_ENDC_SGNB_ADDITION_REQ(msg).e_rabs_tobeadded[e_rab].sgw_addr,
&ue_context_pP->ue_context.e_rab[e_rab].param.sgw_addr, &ue_context_pP->ue_context.e_rab[e_rab].param.sgw_addr,
sizeof(transport_layer_addr_t)); sizeof(transport_layer_addr_t));
LOG_I(RRC,"x2u tunnel: index %d target enb ip %d.%d.%d.%d length %d gtp teid %u\n",
i,
X2AP_ENDC_SGNB_ADDITION_REQ(msg).e_rabs_tobeadded[e_rab].sgw_addr.buffer[0],
X2AP_ENDC_SGNB_ADDITION_REQ(msg).e_rabs_tobeadded[e_rab].sgw_addr.buffer[1],
X2AP_ENDC_SGNB_ADDITION_REQ(msg).e_rabs_tobeadded[e_rab].sgw_addr.buffer[2],
X2AP_ENDC_SGNB_ADDITION_REQ(msg).e_rabs_tobeadded[e_rab].sgw_addr.buffer[3],
X2AP_ENDC_SGNB_ADDITION_REQ(msg).e_rabs_tobeadded[e_rab].sgw_addr.length,
X2AP_ENDC_SGNB_ADDITION_REQ(msg).e_rabs_tobeadded[e_rab].gtp_teid);
} }
LOG_I(RRC, LOG_I(RRC,
"[eNB %d] frame %d subframe %d: UE rnti %x switching to NSA mode\n", "[eNB %d] frame %d subframe %d: UE rnti %x switching to NSA mode\n",
...@@ -8509,6 +8542,14 @@ void rrc_eNB_process_AdditionResponseInformation(const module_id_t enb_mod_idP, ...@@ -8509,6 +8542,14 @@ void rrc_eNB_process_AdditionResponseInformation(const module_id_t enb_mod_idP,
printf("\n"); printf("\n");
} }
{
int i;
int len = m->rrc_buffer_size;
unsigned char *buffer = (unsigned char*)m->rrc_buffer;
printf("xxx: (len %d): ", m->rrc_buffer_size);
for (i = 0; i<len; i++) printf("%2.2x ", ((unsigned char *)buffer)[i]);
printf("\n");
}
asn_dec_rval_t dec_rval = uper_decode_complete( NULL, asn_dec_rval_t dec_rval = uper_decode_complete( NULL,
&asn_DEF_NR_CG_Config, &asn_DEF_NR_CG_Config,
(void **)&CG_Config, (void **)&CG_Config,
...@@ -8601,6 +8642,7 @@ void rrc_eNB_process_AdditionResponseInformation(const module_id_t enb_mod_idP, ...@@ -8601,6 +8642,7 @@ void rrc_eNB_process_AdditionResponseInformation(const module_id_t enb_mod_idP,
0, 0); 0, 0);
size = rrc_eNB_generate_RRCConnectionReconfiguration_endc(&ctxt, ue_context, buffer, 8192, scg_CellGroupConfig, nr1_conf); size = rrc_eNB_generate_RRCConnectionReconfiguration_endc(&ctxt, ue_context, buffer, 8192, scg_CellGroupConfig, nr1_conf);
printf("called rrc_eNB_generate_RRCConnectionReconfiguration_endc size %d rnti %x\n", size, m->rnti);
rrc_data_req(&ctxt, rrc_data_req(&ctxt,
DCCH, DCCH,
......
...@@ -35,6 +35,39 @@ ...@@ -35,6 +35,39 @@
extern RAN_CONTEXT_t RC; extern RAN_CONTEXT_t RC;
extern mui_t rrc_eNB_mui; extern mui_t rrc_eNB_mui;
static int generate_release_drb1(unsigned char *nr1_buf, int nr1_buf_size)
{
NR_RadioBearerConfig_t r;
NR_DRB_ToReleaseList_t l;
NR_DRB_Identity_t id;
asn_enc_rval_t enc_rval;
memset(&r, 0, sizeof(r));
memset(&l, 0, sizeof(l));
memset(&id, 0, sizeof(id));
id = 1;
r.drb_ToReleaseList = &l;
ASN_SEQUENCE_ADD(&l.list, &id);
enc_rval = uper_encode_to_buffer(&asn_DEF_NR_RadioBearerConfig,
NULL,
&r,
nr1_buf,
nr1_buf_size);
{
int len = (enc_rval.encoded + 7) / 8;
int i;
printf("generate_release_drb1: len = %d (encoded %d)\n", len, enc_rval.encoded);
for (i = 0; i < len; i++) printf(" %2.2x", nr1_buf[i]);
printf("\n");
}
return (enc_rval.encoded + 7) / 8;
}
int rrc_eNB_generate_RRCConnectionReconfiguration_endc(protocol_ctxt_t *ctxt, int rrc_eNB_generate_RRCConnectionReconfiguration_endc(protocol_ctxt_t *ctxt,
rrc_eNB_ue_context_t *ue_context, rrc_eNB_ue_context_t *ue_context,
unsigned char *buffer, unsigned char *buffer,
...@@ -130,10 +163,12 @@ int rrc_eNB_generate_RRCConnectionReconfiguration_endc(protocol_ctxt_t *ctxt, ...@@ -130,10 +163,12 @@ int rrc_eNB_generate_RRCConnectionReconfiguration_endc(protocol_ctxt_t *ctxt,
mac.choice.explicitValue.timeAlignmentTimerDedicated = LTE_TimeAlignmentTimer_sf10240; mac.choice.explicitValue.timeAlignmentTimerDedicated = LTE_TimeAlignmentTimer_sf10240;
mac.choice.explicitValue.ext4 = &mac_ext4; mac.choice.explicitValue.ext4 = &mac_ext4;
#if 0
mac_ext4.dualConnectivityPHR = &dc_phr; mac_ext4.dualConnectivityPHR = &dc_phr;
dc_phr.present = LTE_MAC_MainConfig__ext4__dualConnectivityPHR_PR_setup; dc_phr.present = LTE_MAC_MainConfig__ext4__dualConnectivityPHR_PR_setup;
dc_phr.choice.setup.phr_ModeOtherCG_r12 = LTE_MAC_MainConfig__ext4__dualConnectivityPHR__setup__phr_ModeOtherCG_r12_virtual; dc_phr.choice.setup.phr_ModeOtherCG_r12 = LTE_MAC_MainConfig__ext4__dualConnectivityPHR__setup__phr_ModeOtherCG_r12_virtual;
#endif
/* NR config */ /* NR config */
struct LTE_RRCConnectionReconfiguration_v890_IEs cr_890; struct LTE_RRCConnectionReconfiguration_v890_IEs cr_890;
...@@ -194,6 +229,7 @@ int rrc_eNB_generate_RRCConnectionReconfiguration_endc(protocol_ctxt_t *ctxt, ...@@ -194,6 +229,7 @@ int rrc_eNB_generate_RRCConnectionReconfiguration_endc(protocol_ctxt_t *ctxt,
long sk_counter = 0; long sk_counter = 0;
cr_1510.sk_Counter_r15 = &sk_counter; cr_1510.sk_Counter_r15 = &sk_counter;
#if 1
OCTET_STRING_t dummy_nr1_conf; OCTET_STRING_t dummy_nr1_conf;
unsigned char nr1_buf[4] = { 0, 0, 0, 0 }; unsigned char nr1_buf[4] = { 0, 0, 0, 0 };
...@@ -216,6 +252,15 @@ int rrc_eNB_generate_RRCConnectionReconfiguration_endc(protocol_ctxt_t *ctxt, ...@@ -216,6 +252,15 @@ int rrc_eNB_generate_RRCConnectionReconfiguration_endc(protocol_ctxt_t *ctxt,
} }
#endif #endif
#else
OCTET_STRING_t nr1_conf;
unsigned char nr1_buf[1024];
int nr1_size;
nr1_size = generate_release_drb1(nr1_buf, 1024);
cr_1510.nr_RadioBearerConfig1_r15 = &nr1_conf;
nr1_conf.buf = nr1_buf;
nr1_conf.size = nr1_size;
#endif
#if 0 #if 0
OCTET_STRING_t nr2_conf; OCTET_STRING_t nr2_conf;
......
...@@ -118,15 +118,20 @@ int s1ap_eNB_encode_initiating(S1AP_S1AP_PDU_t *pdu, ...@@ -118,15 +118,20 @@ int s1ap_eNB_encode_initiating(S1AP_S1AP_PDU_t *pdu,
free(res.buffer); free(res.buffer);
break; break;
case S1AP_ProcedureCode_id_E_RABModificationIndication:
res = asn_encode_to_new_buffer(NULL, ATS_CANONICAL_XER, &asn_DEF_S1AP_S1AP_PDU, pdu);
free(res.buffer);
break;
default: default:
S1AP_DEBUG("Unknown procedure ID (%d) for initiating message\n", S1AP_DEBUG("Unknown procedure ID (%d) for initiating message\n",
(int)pdu->choice.initiatingMessage.procedureCode); (int)pdu->choice.initiatingMessage.procedureCode);
return -1; return -1;
} }
if (asn1_xer_print) { //if (asn1_xer_print) {
xer_fprint(stdout, &asn_DEF_S1AP_S1AP_PDU, (void *)pdu); xer_fprint(stdout, &asn_DEF_S1AP_S1AP_PDU, (void *)pdu);
} //}
memset(&res, 0, sizeof(res)); memset(&res, 0, sizeof(res));
res = asn_encode_to_new_buffer(NULL, ATS_ALIGNED_CANONICAL_PER, &asn_DEF_S1AP_S1AP_PDU, pdu); res = asn_encode_to_new_buffer(NULL, ATS_ALIGNED_CANONICAL_PER, &asn_DEF_S1AP_S1AP_PDU, pdu);
......
...@@ -1626,7 +1626,7 @@ int s1ap_eNB_path_switch_req(instance_t instance, ...@@ -1626,7 +1626,7 @@ int s1ap_eNB_path_switch_req(instance_t instance,
/* /*
* eNB generate a S1 E_RAB Modification Indication towards MME * eNB generate a S1 E_RAB Modification Indication towards MME
*/ */
int s1ap_eNB_generate_E_RAB_Modification_Indication( /*int s1ap_eNB_generate_E_RAB_Modification_Indication(
instance_t instance, instance_t instance,
s1ap_e_rab_modification_ind_t *e_rab_modification_ind) s1ap_e_rab_modification_ind_t *e_rab_modification_ind)
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
...@@ -1655,14 +1655,22 @@ int s1ap_eNB_generate_E_RAB_Modification_Indication( ...@@ -1655,14 +1655,22 @@ int s1ap_eNB_generate_E_RAB_Modification_Indication(
uint32_t CSG_id = 0; uint32_t CSG_id = 0;
/* Prepare the S1AP message to encode */ if ((ue_context_p = s1ap_eNB_get_ue_context(s1ap_eNB_instance_p,
e_rab_modification_ind->eNB_ue_s1ap_id)) == NULL) {
// The context for this eNB ue s1ap id doesn't exist in the map of eNB UEs
S1AP_WARN("Failed to find ue context associated with eNB ue s1ap id: 0x%06x\n",
e_rab_modification_ind->eNB_ue_s1ap_id);
return -1;
}
// Prepare the S1AP message to encode
memset(&pdu, 0, sizeof(pdu)); memset(&pdu, 0, sizeof(pdu));
pdu.present = S1AP_S1AP_PDU_PR_initiatingMessage; pdu.present = S1AP_S1AP_PDU_PR_initiatingMessage;
pdu.choice.initiatingMessage.procedureCode = S1AP_ProcedureCode_id_E_RABModificationIndication; pdu.choice.initiatingMessage.procedureCode = S1AP_ProcedureCode_id_E_RABModificationIndication;
pdu.choice.initiatingMessage.criticality = S1AP_Criticality_reject; pdu.choice.initiatingMessage.criticality = S1AP_Criticality_reject;
pdu.choice.initiatingMessage.value.present = S1AP_InitiatingMessage__value_PR_E_RABModificationIndication; pdu.choice.initiatingMessage.value.present = S1AP_InitiatingMessage__value_PR_E_RABModificationIndication;
out = &pdu.choice.initiatingMessage.value.choice.E_RABModificationIndication; out = &pdu.choice.initiatingMessage.value.choice.E_RABModificationIndication;
/* mandatory */ // mandatory
ie = (S1AP_E_RABModificationIndicationIEs_t *)calloc(1, sizeof(S1AP_E_RABModificationIndicationIEs_t)); ie = (S1AP_E_RABModificationIndicationIEs_t *)calloc(1, sizeof(S1AP_E_RABModificationIndicationIEs_t));
ie->id = S1AP_ProtocolIE_ID_id_MME_UE_S1AP_ID; ie->id = S1AP_ProtocolIE_ID_id_MME_UE_S1AP_ID;
ie->criticality = S1AP_Criticality_reject; ie->criticality = S1AP_Criticality_reject;
...@@ -1738,8 +1746,12 @@ int s1ap_eNB_generate_E_RAB_Modification_Indication( ...@@ -1738,8 +1746,12 @@ int s1ap_eNB_generate_E_RAB_Modification_Indication(
ASN_SEQUENCE_ADD(&ie->value.choice.E_RABNotToBeModifiedListBearerModInd.list, E_RAB_NotToBeModifiedItem_BearerModInd_IEs); ASN_SEQUENCE_ADD(&ie->value.choice.E_RABNotToBeModifiedListBearerModInd.list, E_RAB_NotToBeModifiedItem_BearerModInd_IEs);
} }
} }
else else{
ie->value.present = S1AP_E_RABModificationIndicationIEs__value_PR_NOTHING; ie->value.present = S1AP_E_RABModificationIndicationIEs__value_PR_E_RABNotToBeModifiedListBearerModInd;
ie->value.choice.E_RABNotToBeModifiedListBearerModInd.list.size = 0;
}
ASN_SEQUENCE_ADD(&out->protocolIEs.list, ie); ASN_SEQUENCE_ADD(&out->protocolIEs.list, ie);
...@@ -1753,12 +1765,170 @@ int s1ap_eNB_generate_E_RAB_Modification_Indication( ...@@ -1753,12 +1765,170 @@ int s1ap_eNB_generate_E_RAB_Modification_Indication(
if (s1ap_eNB_encode_pdu(&pdu, &buffer, &len) < 0) { if (s1ap_eNB_encode_pdu(&pdu, &buffer, &len) < 0) {
S1AP_ERROR("Failed to encode S1 setup request\n"); S1AP_ERROR("Failed to encode S1 E-RAB modification indication \n");
return -1;
}
// Non UE-Associated signalling -> stream = 0
S1AP_INFO("Size of encoded message: %d \n", len);
s1ap_eNB_itti_send_sctp_data_req(s1ap_eNB_instance_p->instance,
ue_context_p->mme_ref->assoc_id, buffer,
len, ue_context_p->tx_stream);
//s1ap_eNB_itti_send_sctp_data_req(s1ap_eNB_instance_p->instance, ue_context_p->mme_ref->assoc_id, buffer, len, 0);
return ret;
}*/
int s1ap_eNB_generate_E_RAB_Modification_Indication(
instance_t instance,
s1ap_e_rab_modification_ind_t *e_rab_modification_ind)
//-----------------------------------------------------------------------------
{
struct s1ap_eNB_ue_context_s *ue_context_p = NULL;
S1AP_S1AP_PDU_t pdu;
S1AP_E_RABModificationIndication_t *out = NULL;
S1AP_E_RABModificationIndicationIEs_t *ie = NULL;
S1AP_E_RABToBeModifiedItemBearerModInd_t *E_RAB_ToBeModifiedItem_BearerModInd = NULL;
S1AP_E_RABToBeModifiedItemBearerModIndIEs_t *E_RAB_ToBeModifiedItem_BearerModInd_IEs = NULL;
S1AP_E_RABNotToBeModifiedItemBearerModInd_t *E_RAB_NotToBeModifiedItem_BearerModInd = NULL;
S1AP_E_RABNotToBeModifiedItemBearerModIndIEs_t *E_RAB_NotToBeModifiedItem_BearerModInd_IEs = NULL;
s1ap_eNB_instance_t *s1ap_eNB_instance_p = NULL;
s1ap_eNB_instance_p = s1ap_eNB_get_instance(instance);
uint8_t *buffer = NULL;
uint32_t len = 0;
int ret = 0;
DevAssert(s1ap_eNB_instance_p != NULL);
DevAssert(e_rab_modification_ind != NULL);
int num_e_rabs_tobemodified = e_rab_modification_ind->nb_of_e_rabs_tobemodified;
int num_e_rabs_nottobemodified = e_rab_modification_ind->nb_of_e_rabs_nottobemodified;
uint16_t CSG_id = 0;
if ((ue_context_p = s1ap_eNB_get_ue_context(s1ap_eNB_instance_p,
e_rab_modification_ind->eNB_ue_s1ap_id)) == NULL) {
// The context for this eNB ue s1ap id doesn't exist in the map of eNB UEs
S1AP_WARN("Failed to find ue context associated with eNB ue s1ap id: 0x%06x\n",
e_rab_modification_ind->eNB_ue_s1ap_id);
return -1;
}
// Prepare the S1AP message to encode
memset(&pdu, 0, sizeof(pdu));
pdu.present = S1AP_S1AP_PDU_PR_initiatingMessage;
pdu.choice.initiatingMessage.procedureCode = S1AP_ProcedureCode_id_E_RABModificationIndication;
pdu.choice.initiatingMessage.criticality = S1AP_Criticality_reject;
pdu.choice.initiatingMessage.value.present = S1AP_InitiatingMessage__value_PR_E_RABModificationIndication;
out = &pdu.choice.initiatingMessage.value.choice.E_RABModificationIndication;
/* mandatory */
ie = (S1AP_E_RABModificationIndicationIEs_t *)calloc(1, sizeof(S1AP_E_RABModificationIndicationIEs_t));
ie->id = S1AP_ProtocolIE_ID_id_MME_UE_S1AP_ID;
ie->criticality = S1AP_Criticality_reject;
ie->value.present = S1AP_E_RABModificationIndicationIEs__value_PR_MME_UE_S1AP_ID;
ie->value.choice.MME_UE_S1AP_ID = e_rab_modification_ind->mme_ue_s1ap_id;
ASN_SEQUENCE_ADD(&out->protocolIEs.list, ie);
ie = (S1AP_E_RABModificationIndicationIEs_t *)calloc(1, sizeof(S1AP_E_RABModificationIndicationIEs_t));
ie->id = S1AP_ProtocolIE_ID_id_eNB_UE_S1AP_ID;
ie->criticality = S1AP_Criticality_reject;
ie->value.present = S1AP_E_RABModificationIndicationIEs__value_PR_ENB_UE_S1AP_ID;
ie->value.choice.ENB_UE_S1AP_ID = e_rab_modification_ind->eNB_ue_s1ap_id;
ASN_SEQUENCE_ADD(&out->protocolIEs.list, ie);
//E-RABs to be modified list
ie = (S1AP_E_RABModificationIndicationIEs_t *)calloc(1, sizeof(S1AP_E_RABModificationIndicationIEs_t));
ie->id = S1AP_ProtocolIE_ID_id_E_RABToBeModifiedListBearerModInd;
ie->criticality = S1AP_Criticality_reject;
ie->value.present = S1AP_E_RABModificationIndicationIEs__value_PR_E_RABToBeModifiedListBearerModInd;
//The following two for-loops here will probably need to change. We should do a different type of search
for(int i=0; i<num_e_rabs_tobemodified; i++){
E_RAB_ToBeModifiedItem_BearerModInd_IEs = (S1AP_E_RABToBeModifiedItemBearerModIndIEs_t *)calloc(1,sizeof(S1AP_E_RABToBeModifiedItemBearerModIndIEs_t));
E_RAB_ToBeModifiedItem_BearerModInd_IEs->id = S1AP_ProtocolIE_ID_id_E_RABToBeModifiedItemBearerModInd;
E_RAB_ToBeModifiedItem_BearerModInd_IEs->criticality = S1AP_Criticality_reject;
E_RAB_ToBeModifiedItem_BearerModInd_IEs->value.present = S1AP_E_RABToBeModifiedItemBearerModIndIEs__value_PR_E_RABToBeModifiedItemBearerModInd;
E_RAB_ToBeModifiedItem_BearerModInd = &E_RAB_ToBeModifiedItem_BearerModInd_IEs->value.choice.E_RABToBeModifiedItemBearerModInd;
{
E_RAB_ToBeModifiedItem_BearerModInd->e_RAB_ID = e_rab_modification_ind->e_rabs_tobemodified[i].e_rab_id;
E_RAB_ToBeModifiedItem_BearerModInd->transportLayerAddress.size = e_rab_modification_ind->e_rabs_tobemodified[i].eNB_addr.length/8;
E_RAB_ToBeModifiedItem_BearerModInd->transportLayerAddress.bits_unused = e_rab_modification_ind->e_rabs_tobemodified[i].eNB_addr.length%8;
E_RAB_ToBeModifiedItem_BearerModInd->transportLayerAddress.buf = calloc(1, E_RAB_ToBeModifiedItem_BearerModInd->transportLayerAddress.size);
memcpy (E_RAB_ToBeModifiedItem_BearerModInd->transportLayerAddress.buf, e_rab_modification_ind->e_rabs_tobemodified[i].eNB_addr.buffer,
E_RAB_ToBeModifiedItem_BearerModInd->transportLayerAddress.size);
INT32_TO_OCTET_STRING(e_rab_modification_ind->e_rabs_tobemodified[i].gtp_teid, &E_RAB_ToBeModifiedItem_BearerModInd->dL_GTP_TEID);
}
ASN_SEQUENCE_ADD(&ie->value.choice.E_RABToBeModifiedListBearerModInd.list, E_RAB_ToBeModifiedItem_BearerModInd_IEs);
}
ASN_SEQUENCE_ADD(&out->protocolIEs.list, ie);
//E-RABs NOT to be modified list
ie = (S1AP_E_RABModificationIndicationIEs_t *)calloc(1, sizeof(S1AP_E_RABModificationIndicationIEs_t));
ie->id = S1AP_ProtocolIE_ID_id_E_RABNotToBeModifiedListBearerModInd;
ie->criticality = S1AP_Criticality_reject;
//if(num_e_rabs_nottobemodified > 0) {
ie->value.present = S1AP_E_RABModificationIndicationIEs__value_PR_E_RABNotToBeModifiedListBearerModInd;
for(int i=0; i<num_e_rabs_tobemodified; i++){
E_RAB_NotToBeModifiedItem_BearerModInd_IEs = (S1AP_E_RABNotToBeModifiedItemBearerModIndIEs_t *)calloc(1,sizeof(S1AP_E_RABNotToBeModifiedItemBearerModIndIEs_t));
E_RAB_NotToBeModifiedItem_BearerModInd_IEs->id = S1AP_ProtocolIE_ID_id_E_RABNotToBeModifiedItemBearerModInd;
E_RAB_NotToBeModifiedItem_BearerModInd_IEs->criticality = S1AP_Criticality_reject;
E_RAB_NotToBeModifiedItem_BearerModInd_IEs->value.present = S1AP_E_RABNotToBeModifiedItemBearerModIndIEs__value_PR_E_RABNotToBeModifiedItemBearerModInd;
E_RAB_NotToBeModifiedItem_BearerModInd = &E_RAB_NotToBeModifiedItem_BearerModInd_IEs->value.choice.E_RABNotToBeModifiedItemBearerModInd;
{
E_RAB_NotToBeModifiedItem_BearerModInd->e_RAB_ID = e_rab_modification_ind->e_rabs_tobemodified[i].e_rab_id;
E_RAB_NotToBeModifiedItem_BearerModInd->transportLayerAddress.size = e_rab_modification_ind->e_rabs_tobemodified[i].eNB_addr.length/8;
E_RAB_NotToBeModifiedItem_BearerModInd->transportLayerAddress.bits_unused = e_rab_modification_ind->e_rabs_tobemodified[i].eNB_addr.length%8;
E_RAB_NotToBeModifiedItem_BearerModInd->transportLayerAddress.buf =
calloc(1, E_RAB_NotToBeModifiedItem_BearerModInd->transportLayerAddress.size);
memcpy (E_RAB_NotToBeModifiedItem_BearerModInd->transportLayerAddress.buf, e_rab_modification_ind->e_rabs_tobemodified[i].eNB_addr.buffer,
E_RAB_NotToBeModifiedItem_BearerModInd->transportLayerAddress.size);
INT32_TO_OCTET_STRING(e_rab_modification_ind->e_rabs_tobemodified[i].gtp_teid, &E_RAB_NotToBeModifiedItem_BearerModInd->dL_GTP_TEID);
}
ASN_SEQUENCE_ADD(&ie->value.choice.E_RABNotToBeModifiedListBearerModInd.list, E_RAB_NotToBeModifiedItem_BearerModInd_IEs);
}
// }
/*else{
ie->value.present = S1AP_E_RABModificationIndicationIEs__value_PR_E_RABNotToBeModifiedListBearerModInd;
ie->value.choice.E_RABNotToBeModifiedListBearerModInd.list.size = 0;
} */
ASN_SEQUENCE_ADD(&out->protocolIEs.list, ie);
ie = (S1AP_E_RABModificationIndicationIEs_t *)calloc(1, sizeof(S1AP_E_RABModificationIndicationIEs_t));
ie->id = S1AP_ProtocolIE_ID_id_CSGMembershipInfo;
ie->criticality = S1AP_Criticality_reject;
ie->value.present = S1AP_E_RABModificationIndicationIEs__value_PR_CSGMembershipInfo;
ie->value.choice.CSGMembershipInfo.cSGMembershipStatus = S1AP_CSGMembershipStatus_member;
INT16_TO_BIT_STRING(CSG_id, &ie->value.choice.CSGMembershipInfo.cSG_Id);
ASN_SEQUENCE_ADD(&out->protocolIEs.list, ie);
if (s1ap_eNB_encode_pdu(&pdu, &buffer, &len) < 0) {
S1AP_ERROR("Failed to encode S1 E-RAB modification indication \n");
return -1; return -1;
} }
/* Non UE-Associated signalling -> stream = 0 */ // Non UE-Associated signalling -> stream = 0
s1ap_eNB_itti_send_sctp_data_req(s1ap_eNB_instance_p->instance, ue_context_p->mme_ref->assoc_id, buffer, len, 0); S1AP_INFO("Size of encoded message: %d \n", len);
s1ap_eNB_itti_send_sctp_data_req(s1ap_eNB_instance_p->instance,
ue_context_p->mme_ref->assoc_id, buffer,
len, ue_context_p->tx_stream);
//s1ap_eNB_itti_send_sctp_data_req(s1ap_eNB_instance_p->instance, ue_context_p->mme_ref->assoc_id, buffer, len, 0);
return ret; return ret;
} }
......
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