From 7514bb917b117e3358d499325d89e115a7ad4096 Mon Sep 17 00:00:00 2001 From: francescomani Date: Mon, 6 Mar 2023 10:57:31 +0100 Subject: [PATCH 01/29] fixes for generation of precoding matrices --- openair1/PHY/INIT/nr_init.c | 441 +++++++++++++++++------------------- 1 file changed, 207 insertions(+), 234 deletions(-) diff --git a/openair1/PHY/INIT/nr_init.c b/openair1/PHY/INIT/nr_init.c index c10a0071a7..9a83ed801b 100644 --- a/openair1/PHY/INIT/nr_init.c +++ b/openair1/PHY/INIT/nr_init.c @@ -113,58 +113,71 @@ int init_codebook_gNB(PHY_VARS_gNB *gNB) { // X X X X ... X // |<-----N1---->| int x_polarization = gNB->ap_XP; + AssertFatal(CSI_RS_antenna_ports == N1 * N2 * x_polarization, + "Nb of antenna ports at PHY %d does not correspond to what passed down with fapi %d\n", + N1 * N2 * x_polarization, CSI_RS_antenna_ports); + //Get the uniform planar array parameters // To be confirmed - int O2 = N2 > 1? 4 : 1; //Vertical beam oversampling (1 or 4) + int O2 = N2 > 1 ? 4 : 1; //Vertical beam oversampling (1 or 4) int O1 = CSI_RS_antenna_ports > 2 ? 4 : 1; //Horizontal beam oversampling (1 or 4) - AssertFatal(CSI_RS_antenna_ports == N1*N2*x_polarization, - "Nb of antenna ports at PHY %d does not correspond to what passed down with fapi %d\n", - N1*N2*x_polarization, CSI_RS_antenna_ports); + + // num of allowed k1 and k2 according to 5.2.2.2.1-3 and -4 in 38.214 + int K1; + if(N2 == N1 || N1 == 2) + K1 = 2; + else if (N2 == 1) + K1 = 5; + else + K1 = 3; + int K2 = N2 > 1 ? 2 : 1; // Generation of codebook Type1 with codebookMode 1 (CSI_RS_antenna_ports < 16) if (CSI_RS_antenna_ports < 16) { //Generate DFT vertical beams //ll: index of a vertical beams vector (represented by i1_1 in TS 38.214) - double complex v[N1*O1][N1]; - for (int ll=0; llnr_mimo_precoding_matrix = (int32_t ***)malloc16(max_mimo_layers * sizeof(int32_t **)); int32_t ***mat = gNB->nr_mimo_precoding_matrix; @@ -230,22 +243,11 @@ int init_codebook_gNB(PHY_VARS_gNB *gNB) { //Compute the code book size for generating 2 layers out of Tx antenna ports //pmi_size is computed as follows - gNB->pmiq_size[1] = 1;//1 for unity matrix - for(int llb=0; llbpmiq_size[1] += 1; - } - } - } - } - } - mat[1] = (int32_t **)malloc16(gNB->pmiq_size[1]*sizeof(int32_t *)); + gNB->pmiq_size[1] = 1 + (2 * N1 * O1 * N2 * O2 * K1 * K2); + mat[1] = (int32_t **)malloc16(gNB->pmiq_size[1] * sizeof(int32_t *)); //pmi=0 corresponds to unit matrix - mat[1][0] = (int32_t *)calloc((2*N1*N2)*(2),sizeof(int32_t)); + mat[1][0] = (int32_t *)calloc((2 * N1 * N2) * 2, sizeof(int32_t)); for(int j_col=0; j_col<2; j_col++) { //2 layers for (int i_rows=0; i_rows<2*N1*N2; i_rows++) { //2-x polarized antenna if(j_col==i_rows) { @@ -256,52 +258,50 @@ int init_codebook_gNB(PHY_VARS_gNB *gNB) { //pmi=1,...,pmi_size, we construct int pmiq = 0; - for(int llb=0; llb0) - ((short*) &mat[1][pmiq][i_rows*2+j_col])[0] = (short) ((creal(res_code)*32768)+0.5);//convert to Q15 - else - ((short*) &mat[1][pmiq][i_rows*2+j_col])[0] = (short) ((creal(res_code)*32768)-0.5);//convert to Q15 - if (cimag(res_code)>0) - ((short*) &mat[1][pmiq][i_rows*2+j_col])[1] = (short) ((cimag(res_code)*32768)+0.5);//convert to Q15 - else - ((short*) &mat[1][pmiq][i_rows*2+j_col])[1] = (short) ((cimag(res_code)*32768)-0.5);//convert to Q15 - LOG_D(PHY, "2 Layer Precoding Matrix[1][pmi %d][antPort %d][layerIdx %d]= %f+j %f -> Fixed Point %d+j %d \n", - pmiq,i_rows,j_col, creal(res_code), cimag(res_code),((short*) &mat[1][pmiq][i_rows*2+j_col])[0],((short*) &mat[1][pmiq][i_rows*2+j_col])[1]); - } - for (int i_rows=N1*N2; i_rows<2*N1*N2; i_rows++) { - res_code=sqrt(1/(double)(2*CSI_RS_antenna_ports))*(phase_sign)*theta_n[nn]*v_lm[llc][mmc][i_rows-N1*N2]; - if (creal(res_code)>0) - ((short*) &mat[1][pmiq][i_rows*2+j_col])[0] = (short) ((creal(res_code)*32768)+0.5);//convert to Q15 - else - ((short*) &mat[1][pmiq][i_rows*2+j_col])[0] = (short) ((creal(res_code)*32768)-0.5);//convert to Q15 - if (cimag(res_code)>0) - ((short*) &mat[1][pmiq][i_rows*2+j_col])[1] = (short) ((cimag(res_code)*32768)+0.5);//convert to Q15 - else - ((short*) &mat[1][pmiq][i_rows*2+j_col])[1] = (short) ((cimag(res_code)*32768)-0.5);//convert to Q15 - LOG_D(PHY, "2 Layer Precoding Matrix[1][pmi %d][antPort %d][layerIdx %d]= %f+j %f -> Fixed Point %d+j %d \n", - pmiq,i_rows,j_col, creal(res_code), cimag(res_code),((short*) &mat[1][pmiq][i_rows*2+j_col])[0],((short*) &mat[1][pmiq][i_rows*2+j_col])[1]); - } + for(int ll = 0; ll < N1 * O1; ll++) { //i_1_1 + for (int mm = 0; mm < N2 * O2; mm++) { // i_1_2 + for(int k1 = 0; k1 < K1; k1++) { + for (int k2 = 0; k2 < K2; k2++) { + for (int nn = 0; nn < 2; nn++) { // i_2 + pmiq += 1; + mat[1][pmiq] = (int32_t *)malloc16((2 * N1 * N2) * 2 * sizeof(int32_t)); + LOG_D(PHY, "layer 2 Codebook pmiq = %d\n", pmiq); + for(int j_col = 0; j_col < 2; j_col++) { + if (j_col == 0) { + llc = ll; + mmc = mm; + phase_sign = 1; + } + if (j_col == 1) { + llc = ll + k1 * O1; + mmc = mm + k2 * O2; + phase_sign = -1; + } + for (int i_rows=0; i_rows0) + ((short*) &mat[1][pmiq][i_rows*2+j_col])[0] = (short) ((creal(res_code)*32768)+0.5);//convert to Q15 + else + ((short*) &mat[1][pmiq][i_rows*2+j_col])[0] = (short) ((creal(res_code)*32768)-0.5);//convert to Q15 + if (cimag(res_code)>0) + ((short*) &mat[1][pmiq][i_rows*2+j_col])[1] = (short) ((cimag(res_code)*32768)+0.5);//convert to Q15 + else + ((short*) &mat[1][pmiq][i_rows*2+j_col])[1] = (short) ((cimag(res_code)*32768)-0.5);//convert to Q15 + LOG_D(PHY, "2 Layer Precoding Matrix[1][pmi %d][antPort %d][layerIdx %d]= %f+j %f -> Fixed Point %d+j %d \n", + pmiq, i_rows, j_col, creal(res_code), cimag(res_code), ((short*) &mat[1][pmiq][i_rows*2+j_col])[0], ((short*) &mat[1][pmiq][i_rows*2+j_col])[1]); + } + for (int i_rows=N1*N2; i_rows<2*N1*N2; i_rows++) { + res_code=sqrt(1/(double)(2*CSI_RS_antenna_ports))*(phase_sign)*theta_n[nn]*v_lm[llc][mmc][i_rows-N1*N2]; + if (creal(res_code)>0) + ((short*) &mat[1][pmiq][i_rows*2+j_col])[0] = (short) ((creal(res_code)*32768)+0.5);//convert to Q15 + else + ((short*) &mat[1][pmiq][i_rows*2+j_col])[0] = (short) ((creal(res_code)*32768)-0.5);//convert to Q15 + if (cimag(res_code)>0) + ((short*) &mat[1][pmiq][i_rows*2+j_col])[1] = (short) ((cimag(res_code)*32768)+0.5);//convert to Q15 + else + ((short*) &mat[1][pmiq][i_rows*2+j_col])[1] = (short) ((cimag(res_code)*32768)-0.5);//convert to Q15 + LOG_D(PHY, "2 Layer Precoding Matrix[1][pmi %d][antPort %d][layerIdx %d]= %f+j %f -> Fixed Point %d+j %d \n", + pmiq, i_rows, j_col, creal(res_code), cimag(res_code), ((short*) &mat[1][pmiq][i_rows*2+j_col])[0], ((short*) &mat[1][pmiq][i_rows*2+j_col])[1]); } } } @@ -312,85 +312,72 @@ int init_codebook_gNB(PHY_VARS_gNB *gNB) { //Table 5.2.2.2.1-7: //Codebook for 3-layer CSI reporting using antenna ports 3000 to 2999+PCSI-RS - if(max_mimo_layers>=3) { + if(max_mimo_layers >= 3) { //pmi_size is computed as follows - gNB->pmiq_size[2] = 1;//unity matrix - for(int llb=0; llbpmiq_size[2] += 1; - } - } - } - } - } - mat[2] = (int32_t **)malloc16(gNB->pmiq_size[2]*sizeof(int32_t *)); + gNB->pmiq_size[2] = 1 + (2 * N1 * O1 * N2 * O2 * K1 * K2); + mat[2] = (int32_t **)malloc16(gNB->pmiq_size[2] * sizeof(int32_t *)); //pmi=0 corresponds to unit matrix - mat[2][0] = (int32_t *)calloc((2*N1*N2)*(3),sizeof(int32_t)); - for(int j_col=0; j_col<3; j_col++) { //3 layers - for (int i_rows=0; i_rows<2*N1*N2; i_rows++) { //2-x polarized antenna - if(j_col==i_rows) { - mat[2][0][i_rows*3+j_col] = 0x7fff; + mat[2][0] = (int32_t *)calloc(2 * N1 * N2 * 3, sizeof(int32_t)); + for(int j_col = 0; j_col < 3; j_col++) { //3 layers + for (int i_rows = 0; i_rows < 2 * N1 * N2; i_rows++) { //2-x polarized antenna + if(j_col == i_rows) { + mat[2][0][i_rows * 3 + j_col] = 0x7fff; } } } pmiq = 0; //pmi=1,...,pmi_size are computed as follows - for(int llb=0; llb0) - ((short*) &mat[2][pmiq][i_rows*3+j_col])[0] = (short) ((creal(res_code)*32768)+0.5);//convert to Q15 - else - ((short*) &mat[2][pmiq][i_rows*3+j_col])[0] = (short) ((creal(res_code)*32768)-0.5);//convert to Q15 - if (cimag(res_code)>0) - ((short*) &mat[2][pmiq][i_rows*3+j_col])[1] = (short) ((cimag(res_code)*32768)+0.5);//convert to Q15 - else - ((short*) &mat[2][pmiq][i_rows*3+j_col])[1] = (short) ((cimag(res_code)*32768)-0.5);//convert to Q15 - LOG_D(PHY, "3 Layer Precoding Matrix[2][pmi %d][antPort %d][layerIdx %d]= %f+j %f -> Fixed Point %d+j %d \n", - pmiq,i_rows,j_col, creal(res_code), cimag(res_code),((short*) &mat[2][pmiq][i_rows*3+j_col])[0],((short*) &mat[2][pmiq][i_rows*3+j_col])[1]); - } - for (int i_rows=N1*N2; i_rows<2*N1*N2; i_rows++) { - res_code=sqrt(1/(double)(3*CSI_RS_antenna_ports))*(phase_sign)*theta_n[nn]*v_lm[llc][mmc][i_rows-N1*N2]; - if (creal(res_code)>0) - ((short*) &mat[2][pmiq][i_rows*3+j_col])[0] = (short) ((creal(res_code)*32768)+0.5);//convert to Q15 - else - ((short*) &mat[2][pmiq][i_rows*3+j_col])[0] = (short) ((creal(res_code)*32768)-0.5);//convert to Q15 - if (cimag(res_code)>0) - ((short*) &mat[2][pmiq][i_rows*3+j_col])[1] = (short) ((cimag(res_code)*32768)+0.5);//convert to Q15 - else - ((short*) &mat[2][pmiq][i_rows*3+j_col])[1] = (short) ((cimag(res_code)*32768)-0.5);//convert to Q15 - LOG_D(PHY, "3 Layer Precoding Matrix[2][pmi %d][antPort %d][layerIdx %d]= %f+j %f -> Fixed Point %d+j %d \n", - pmiq,i_rows,j_col, creal(res_code), cimag(res_code),((short*) &mat[2][pmiq][i_rows*3+j_col])[0],((short*) &mat[2][pmiq][i_rows*3+j_col])[1]); - } + for(int ll = 0; ll < N1 * O1; ll++) { //i_1_1 + for (int mm = 0; mm < N2 * O2; mm++) { // i_1_2 + for(int k1 = 0; k1 < K1; k1++) { + for (int k2 = 0; k2 < K2; k2++) { + for (int nn = 0; nn < 2; nn++) { // i_2 + pmiq += 1; + mat[2][pmiq] = (int32_t *)malloc16((2 * N1 * N2 * 3) * sizeof(int32_t)); + LOG_D(PHY, "layer 3 Codebook pmiq = %d\n",pmiq); + for(int j_col = 0; j_col < 3; j_col++) { + if (j_col == 0) { + llc = ll; + mmc = mm; + phase_sign = 1; + } + if (j_col==1) { + llc = ll + k1 * O1; + mmc = mm + k2 * O2; + phase_sign = 1; + } + if (j_col==2) { + llc = ll; + mmc = mm; + phase_sign = -1; + } + for (int i_rows=0; i_rows0) + ((short*) &mat[2][pmiq][i_rows*3+j_col])[0] = (short) ((creal(res_code)*32768)+0.5);//convert to Q15 + else + ((short*) &mat[2][pmiq][i_rows*3+j_col])[0] = (short) ((creal(res_code)*32768)-0.5);//convert to Q15 + if (cimag(res_code)>0) + ((short*) &mat[2][pmiq][i_rows*3+j_col])[1] = (short) ((cimag(res_code)*32768)+0.5);//convert to Q15 + else + ((short*) &mat[2][pmiq][i_rows*3+j_col])[1] = (short) ((cimag(res_code)*32768)-0.5);//convert to Q15 + LOG_D(PHY, "3 Layer Precoding Matrix[2][pmi %d][antPort %d][layerIdx %d]= %f+j %f -> Fixed Point %d+j %d \n", + pmiq,i_rows,j_col, creal(res_code), cimag(res_code),((short*) &mat[2][pmiq][i_rows*3+j_col])[0],((short*) &mat[2][pmiq][i_rows*3+j_col])[1]); + } + for (int i_rows=N1*N2; i_rows<2*N1*N2; i_rows++) { + res_code=sqrt(1/(double)(3*CSI_RS_antenna_ports))*(phase_sign)*theta_n[nn]*v_lm[llc][mmc][i_rows-N1*N2]; + if (creal(res_code)>0) + ((short*) &mat[2][pmiq][i_rows*3+j_col])[0] = (short) ((creal(res_code)*32768)+0.5);//convert to Q15 + else + ((short*) &mat[2][pmiq][i_rows*3+j_col])[0] = (short) ((creal(res_code)*32768)-0.5);//convert to Q15 + if (cimag(res_code)>0) + ((short*) &mat[2][pmiq][i_rows*3+j_col])[1] = (short) ((cimag(res_code)*32768)+0.5);//convert to Q15 + else + ((short*) &mat[2][pmiq][i_rows*3+j_col])[1] = (short) ((cimag(res_code)*32768)-0.5);//convert to Q15 + LOG_D(PHY, "3 Layer Precoding Matrix[2][pmi %d][antPort %d][layerIdx %d]= %f+j %f -> Fixed Point %d+j %d \n", + pmiq,i_rows,j_col, creal(res_code), cimag(res_code),((short*) &mat[2][pmiq][i_rows*3+j_col])[0],((short*) &mat[2][pmiq][i_rows*3+j_col])[1]); } } } @@ -402,92 +389,76 @@ int init_codebook_gNB(PHY_VARS_gNB *gNB) { //Table 5.2.2.2.1-8: //Codebook for 4-layer CSI reporting using antenna ports 3000 to 2999+PCSI-RS - if(max_mimo_layers>=4) { + if(max_mimo_layers >= 4) { //pmi_size is computed as follows - gNB->pmiq_size[3] = 1;//unity matrix - for(int llb=0; llbpmiq_size[3] += 1; - } - } - } - } - } - - mat[3] = (int32_t **)malloc16(gNB->pmiq_size[3]*sizeof(int32_t *)); + gNB->pmiq_size[3] = 1 + (2 * N1 * O1 * N2 * O2 * K1 * K2); + mat[3] = (int32_t **)malloc16(gNB->pmiq_size[3] * sizeof(int32_t *)); //pmi=0 corresponds to unit matrix - mat[3][0] = (int32_t *)calloc((2*N1*N2)*(4),sizeof(int32_t)); - for(int j_col=0; j_col<4; j_col++) { //4 layers - for (int i_rows=0; i_rows<2*N1*N2; i_rows++) { //2-x polarized antenna - if(j_col==i_rows) { - mat[3][0][i_rows*4+j_col] = 0x7fff; + mat[3][0] = (int32_t *)calloc((2 * N1 * N2 * 4), sizeof(int32_t)); + for(int j_col = 0; j_col < 4; j_col++) { //4 layers + for (int i_rows = 0; i_rows < 2 * N1 * N2; i_rows++) { //2-x polarized antenna + if(j_col == i_rows) { + mat[3][0][i_rows * 4 + j_col] = 0x7fff; } } } pmiq = 0; //pmi=1,...,pmi_size are computed as follows - for(int llb=0; llb0) - ((short*) &mat[3][pmiq][i_rows*4+j_col])[0] = (short) ((creal(res_code)*32768)+0.5);//convert to Q15 - else - ((short*) &mat[3][pmiq][i_rows*4+j_col])[0] = (short) ((creal(res_code)*32768)-0.5);//convert to Q15 - if (cimag(res_code)>0) - ((short*) &mat[3][pmiq][i_rows*4+j_col])[1] = (short) ((cimag(res_code)*32768)+0.5);//convert to Q15 - else - ((short*) &mat[3][pmiq][i_rows*4+j_col])[1] = (short) ((cimag(res_code)*32768)-0.5);//convert to Q15 - LOG_D(PHY, "4 Layer Precoding Matrix[3][pmi %d][antPort %d][layerIdx %d]= %f+j %f -> Fixed Point %d+j %d \n", - pmiq,i_rows,j_col, creal(res_code), cimag(res_code),((short*) &mat[3][pmiq][i_rows*4+j_col])[0],((short*) &mat[3][pmiq][i_rows*4+j_col])[1]); - } - - for (int i_rows=N1*N2; i_rows<2*N1*N2; i_rows++) { - res_code=sqrt(1/(double)(4*CSI_RS_antenna_ports))*(phase_sign)*theta_n[nn]*v_lm[llc][mmc][i_rows-N1*N2]; - if (creal(res_code)>0) - ((short*) &mat[3][pmiq][i_rows*4+j_col])[0] = (short) ((creal(res_code)*32768)+0.5);//convert to Q15 - else - ((short*) &mat[3][pmiq][i_rows*4+j_col])[0] = (short) ((creal(res_code)*32768)-0.5);//convert to Q15 - if (cimag(res_code)>0) - ((short*) &mat[3][pmiq][i_rows*4+j_col])[1] = (short) ((cimag(res_code)*32768)+0.5);//convert to Q15 - else - ((short*) &mat[3][pmiq][i_rows*4+j_col])[1] = (short) ((cimag(res_code)*32768)-0.5);//convert to Q15 - LOG_D(PHY, "4 Layer Precoding Matrix[3][pmi %d][antPort %d][layerIdx %d]= %f+j %f -> Fixed Point %d+j %d \n", - pmiq,i_rows,j_col, creal(res_code), cimag(res_code),((short*) &mat[3][pmiq][i_rows*4+j_col])[0],((short*) &mat[3][pmiq][i_rows*4+j_col])[1]); - } + for(int ll = 0; ll < N1 * O1; ll++) { //i_1_1 + for (int mm = 0; mm < N2 * O2; mm++) { // i_1_2 + for(int k1 = 0; k1 < K1; k1++) { + for (int k2 = 0; k2 < K2; k2++) { + for (int nn = 0; nn < 2; nn++) { // i_2 + pmiq += 1; + mat[3][pmiq] = (int32_t *)malloc16((2*N1*N2)*4*sizeof(int32_t)); + LOG_D(PHY, "layer 4 pmiq = %d\n",pmiq); + for(int j_col=0; j_col<4; j_col++) { + if (j_col==0) { + llc = ll; + mmc = mm; + phase_sign = 1; + } + if (j_col==1) { + llc = ll + k1 * O1; + mmc = mm + k2 * O2; + phase_sign = 1; + } + if (j_col==2) { + llc = ll; + mmc = mm; + phase_sign = -1; + } + if (j_col==3) { + llc = ll + k1 * O1; + mmc = mm + k2 * O2; + phase_sign = -1; + } + for (int i_rows=0; i_rows0) + ((short*) &mat[3][pmiq][i_rows*4+j_col])[0] = (short) ((creal(res_code)*32768)+0.5);//convert to Q15 + else + ((short*) &mat[3][pmiq][i_rows*4+j_col])[0] = (short) ((creal(res_code)*32768)-0.5);//convert to Q15 + if (cimag(res_code)>0) + ((short*) &mat[3][pmiq][i_rows*4+j_col])[1] = (short) ((cimag(res_code)*32768)+0.5);//convert to Q15 + else + ((short*) &mat[3][pmiq][i_rows*4+j_col])[1] = (short) ((cimag(res_code)*32768)-0.5);//convert to Q15 + LOG_D(PHY, "4 Layer Precoding Matrix[3][pmi %d][antPort %d][layerIdx %d]= %f+j %f -> Fixed Point %d+j %d \n", + pmiq,i_rows,j_col, creal(res_code), cimag(res_code),((short*) &mat[3][pmiq][i_rows*4+j_col])[0],((short*) &mat[3][pmiq][i_rows*4+j_col])[1]); + } + for (int i_rows=N1*N2; i_rows<2*N1*N2; i_rows++) { + res_code=sqrt(1/(double)(4*CSI_RS_antenna_ports))*(phase_sign)*theta_n[nn]*v_lm[llc][mmc][i_rows-N1*N2]; + if (creal(res_code)>0) + ((short*) &mat[3][pmiq][i_rows*4+j_col])[0] = (short) ((creal(res_code)*32768)+0.5);//convert to Q15 + else + ((short*) &mat[3][pmiq][i_rows*4+j_col])[0] = (short) ((creal(res_code)*32768)-0.5);//convert to Q15 + if (cimag(res_code)>0) + ((short*) &mat[3][pmiq][i_rows*4+j_col])[1] = (short) ((cimag(res_code)*32768)+0.5);//convert to Q15 + else + ((short*) &mat[3][pmiq][i_rows*4+j_col])[1] = (short) ((cimag(res_code)*32768)-0.5);//convert to Q15 + LOG_D(PHY, "4 Layer Precoding Matrix[3][pmi %d][antPort %d][layerIdx %d]= %f+j %f -> Fixed Point %d+j %d \n", + pmiq,i_rows,j_col, creal(res_code), cimag(res_code),((short*) &mat[3][pmiq][i_rows*4+j_col])[0],((short*) &mat[3][pmiq][i_rows*4+j_col])[1]); } } } @@ -497,6 +468,8 @@ int init_codebook_gNB(PHY_VARS_gNB *gNB) { } } } + else + AssertFatal(false, "Max number of antenna ports supported is 16\n"); } return 0; } From 60a033b801847739498c7380317593c43fef7e6c Mon Sep 17 00:00:00 2001 From: francescomani Date: Mon, 15 Jan 2024 16:57:58 +0100 Subject: [PATCH 02/29] remove ASAN_OPTIONS: detect_leaks=0 from SA rfsim CI tests --- .../yaml_files/5g_f1_rfsimulator/docker-compose.yaml | 1 - .../yaml_files/5g_fdd_rfsimulator/docker-compose.yaml | 1 - .../yaml_files/5g_rfsimulator/docker-compose.yaml | 10 ---------- .../5g_rfsimulator_24prb/docker-compose.yaml | 1 - .../yaml_files/5g_rfsimulator_2x2/docker-compose.yaml | 1 - .../yaml_files/5g_rfsimulator_e1/docker-compose.yaml | 2 -- .../5g_rfsimulator_u0_25prb/docker-compose.yaml | 1 - 7 files changed, 17 deletions(-) diff --git a/ci-scripts/yaml_files/5g_f1_rfsimulator/docker-compose.yaml b/ci-scripts/yaml_files/5g_f1_rfsimulator/docker-compose.yaml index 308efdc33b..bc5c84fc76 100644 --- a/ci-scripts/yaml_files/5g_f1_rfsimulator/docker-compose.yaml +++ b/ci-scripts/yaml_files/5g_f1_rfsimulator/docker-compose.yaml @@ -223,7 +223,6 @@ services: -r 106 --numerology 1 -C 3619200000 --uicc0.imsi 208990100001100 --rfsimulator.serveraddr 192.168.71.171 - ASAN_OPTIONS: detect_leaks=0 depends_on: - oai-du networks: diff --git a/ci-scripts/yaml_files/5g_fdd_rfsimulator/docker-compose.yaml b/ci-scripts/yaml_files/5g_fdd_rfsimulator/docker-compose.yaml index 7912c48408..3909fec500 100644 --- a/ci-scripts/yaml_files/5g_fdd_rfsimulator/docker-compose.yaml +++ b/ci-scripts/yaml_files/5g_fdd_rfsimulator/docker-compose.yaml @@ -187,7 +187,6 @@ services: container_name: rfsim5g-oai-nr-ue environment: USE_ADDITIONAL_OPTIONS: -E --sa --rfsim -r 106 --numerology 1 --uicc0.imsi 208990100001100 --band 66 -C 2169090000 --CO -400000000 --ssb 378 --rfsimulator.serveraddr 192.168.71.140 --log_config.global_log_options level,nocolor,time - ASAN_OPTIONS: detect_leaks=0 depends_on: - oai-gnb networks: diff --git a/ci-scripts/yaml_files/5g_rfsimulator/docker-compose.yaml b/ci-scripts/yaml_files/5g_rfsimulator/docker-compose.yaml index d238d63ea1..62209dc7eb 100644 --- a/ci-scripts/yaml_files/5g_rfsimulator/docker-compose.yaml +++ b/ci-scripts/yaml_files/5g_rfsimulator/docker-compose.yaml @@ -187,7 +187,6 @@ services: container_name: rfsim5g-oai-nr-ue environment: USE_ADDITIONAL_OPTIONS: -E --sa --rfsim -r 106 --numerology 1 --uicc0.imsi 208990100001100 -C 3619200000 --rfsimulator.serveraddr 192.168.71.140 --log_config.global_log_options level,nocolor,time - ASAN_OPTIONS: detect_leaks=0 depends_on: - oai-gnb networks: @@ -206,7 +205,6 @@ services: container_name: rfsim5g-oai-nr-ue2 environment: USE_ADDITIONAL_OPTIONS: -E --sa --rfsim -r 106 --numerology 1 --uicc0.imsi 208990100001101 -C 3619200000 --rfsimulator.serveraddr 192.168.71.140 --log_config.global_log_options level,nocolor,time - ASAN_OPTIONS: detect_leaks=0 depends_on: - oai-gnb networks: @@ -225,7 +223,6 @@ services: container_name: rfsim5g-oai-nr-ue3 environment: USE_ADDITIONAL_OPTIONS: -E --sa --rfsim -r 106 --numerology 1 --uicc0.imsi 208990100001102 -C 3619200000 --rfsimulator.serveraddr 192.168.71.140 --log_config.global_log_options level,nocolor,time - ASAN_OPTIONS: detect_leaks=0 depends_on: - oai-gnb networks: @@ -244,7 +241,6 @@ services: container_name: rfsim5g-oai-nr-ue4 environment: USE_ADDITIONAL_OPTIONS: -E --sa --rfsim -r 106 --numerology 1 --uicc0.imsi 208990100001103 -C 3619200000 --rfsimulator.serveraddr 192.168.71.140 --log_config.global_log_options level,nocolor,time - ASAN_OPTIONS: detect_leaks=0 depends_on: - oai-gnb networks: @@ -263,7 +259,6 @@ services: container_name: rfsim5g-oai-nr-ue5 environment: USE_ADDITIONAL_OPTIONS: -E --sa --rfsim -r 106 --numerology 1 --uicc0.imsi 208990100001104 -C 3619200000 --rfsimulator.serveraddr 192.168.71.140 --log_config.global_log_options level,nocolor,time - ASAN_OPTIONS: detect_leaks=0 depends_on: - oai-gnb networks: @@ -282,7 +277,6 @@ services: container_name: rfsim5g-oai-nr-ue6 environment: USE_ADDITIONAL_OPTIONS: -E --sa --rfsim -r 106 --numerology 1 --uicc0.imsi 208990100001105 -C 3619200000 --rfsimulator.serveraddr 192.168.71.140 --log_config.global_log_options level,nocolor,time - ASAN_OPTIONS: detect_leaks=0 depends_on: - oai-gnb networks: @@ -301,7 +295,6 @@ services: container_name: rfsim5g-oai-nr-ue7 environment: USE_ADDITIONAL_OPTIONS: -E --sa --rfsim -r 106 --numerology 1 --uicc0.imsi 208990100001106 -C 3619200000 --rfsimulator.serveraddr 192.168.71.140 --log_config.global_log_options level,nocolor,time - ASAN_OPTIONS: detect_leaks=0 depends_on: - oai-gnb networks: @@ -320,7 +313,6 @@ services: container_name: rfsim5g-oai-nr-ue8 environment: USE_ADDITIONAL_OPTIONS: -E --sa --rfsim -r 106 --numerology 1 --uicc0.imsi 208990100001107 -C 3619200000 --rfsimulator.serveraddr 192.168.71.140 --log_config.global_log_options level,nocolor,time - ASAN_OPTIONS: detect_leaks=0 depends_on: - oai-gnb networks: @@ -339,7 +331,6 @@ services: container_name: rfsim5g-oai-nr-ue9 environment: USE_ADDITIONAL_OPTIONS: -E --sa --rfsim -r 106 --numerology 1 --uicc0.imsi 208990100001108 -C 3619200000 --rfsimulator.serveraddr 192.168.71.140 --log_config.global_log_options level,nocolor,time - ASAN_OPTIONS: detect_leaks=0 depends_on: - oai-gnb networks: @@ -358,7 +349,6 @@ services: container_name: rfsim5g-oai-nr-ue10 environment: USE_ADDITIONAL_OPTIONS: -E --sa --rfsim -r 106 --numerology 1 --uicc0.imsi 208990100001109 -C 3619200000 --rfsimulator.serveraddr 192.168.71.140 --log_config.global_log_options level,nocolor,time - ASAN_OPTIONS: detect_leaks=0 depends_on: - oai-gnb networks: diff --git a/ci-scripts/yaml_files/5g_rfsimulator_24prb/docker-compose.yaml b/ci-scripts/yaml_files/5g_rfsimulator_24prb/docker-compose.yaml index eaadeb1b1b..9d122b0af3 100644 --- a/ci-scripts/yaml_files/5g_rfsimulator_24prb/docker-compose.yaml +++ b/ci-scripts/yaml_files/5g_rfsimulator_24prb/docker-compose.yaml @@ -187,7 +187,6 @@ services: container_name: rfsim5g-oai-nr-ue environment: USE_ADDITIONAL_OPTIONS: --sa --rfsim -r 24 --ssb 24 --numerology 1 -C 3604800000 --uicc0.imsi 208990100001100 --rfsimulator.serveraddr 192.168.71.140 --log_config.global_log_options level,nocolor,time - ASAN_OPTIONS: detect_leaks=0 depends_on: - oai-gnb networks: diff --git a/ci-scripts/yaml_files/5g_rfsimulator_2x2/docker-compose.yaml b/ci-scripts/yaml_files/5g_rfsimulator_2x2/docker-compose.yaml index 8ebf8602eb..001d245b32 100644 --- a/ci-scripts/yaml_files/5g_rfsimulator_2x2/docker-compose.yaml +++ b/ci-scripts/yaml_files/5g_rfsimulator_2x2/docker-compose.yaml @@ -188,7 +188,6 @@ services: container_name: rfsim5g-oai-nr-ue environment: USE_ADDITIONAL_OPTIONS: --sa --rfsim -r 106 --numerology 1 --band 78 -C 3319680000 --ue-nb-ant-tx 2 --uicc0.imsi 208990100001100 --ue-nb-ant-rx 2 --uecap_file /opt/oai-nr-ue/etc/uecap.xml --rfsimulator.serveraddr 192.168.71.140 --log_config.global_log_options level,nocolor,time - ASAN_OPTIONS: detect_leaks=0 depends_on: - oai-gnb networks: diff --git a/ci-scripts/yaml_files/5g_rfsimulator_e1/docker-compose.yaml b/ci-scripts/yaml_files/5g_rfsimulator_e1/docker-compose.yaml index adfdefbccf..426af8ebcd 100644 --- a/ci-scripts/yaml_files/5g_rfsimulator_e1/docker-compose.yaml +++ b/ci-scripts/yaml_files/5g_rfsimulator_e1/docker-compose.yaml @@ -366,7 +366,6 @@ services: -r 106 --numerology 1 -C 3619200000 --uicc0.imsi 208990100001100 --rfsimulator.serveraddr 192.168.78.2 - ASAN_OPTIONS: detect_leaks=0 depends_on: - oai-du networks: @@ -389,7 +388,6 @@ services: -r 106 --numerology 1 -C 3619200000 --uicc0.imsi 208990100001101 --uicc0.nssai_sst 2 --rfsimulator.serveraddr 192.168.78.3 - ASAN_OPTIONS: detect_leaks=0 depends_on: - oai-du2 networks: diff --git a/ci-scripts/yaml_files/5g_rfsimulator_u0_25prb/docker-compose.yaml b/ci-scripts/yaml_files/5g_rfsimulator_u0_25prb/docker-compose.yaml index 42fb6648e8..cfded0966f 100644 --- a/ci-scripts/yaml_files/5g_rfsimulator_u0_25prb/docker-compose.yaml +++ b/ci-scripts/yaml_files/5g_rfsimulator_u0_25prb/docker-compose.yaml @@ -188,7 +188,6 @@ services: container_name: rfsim5g-oai-nr-ue environment: USE_ADDITIONAL_OPTIONS: --sa --rfsim -r 25 --numerology 0 --uicc0.imsi 208990100001100 --band 66 -C 2152260000 --CO -400000000 --ssb 76 --rfsimulator.serveraddr 192.168.71.140 --log_config.global_log_options level,nocolor,time - ASAN_OPTIONS: detect_leaks=0 depends_on: - oai-gnb networks: From 698b0f5f9584e09acfe64418f6f25d4f1ac06f7a Mon Sep 17 00:00:00 2001 From: francescomani Date: Mon, 15 Jan 2024 17:57:22 +0100 Subject: [PATCH 03/29] trying to avoid heap-use-after-free in ue dci configuration --- openair2/LAYER2/NR_MAC_UE/main_ue_nr.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/openair2/LAYER2/NR_MAC_UE/main_ue_nr.c b/openair2/LAYER2/NR_MAC_UE/main_ue_nr.c index 83b5d7867b..4eb6a8e242 100644 --- a/openair2/LAYER2/NR_MAC_UE/main_ue_nr.c +++ b/openair2/LAYER2/NR_MAC_UE/main_ue_nr.c @@ -206,12 +206,13 @@ void release_mac_configuration(NR_UE_MAC_INST_t *mac) free(sc->maxMIMO_Layers_PUSCH); memset(&mac->sc_info, 0, sizeof(mac->sc_info)); + mac->current_DL_BWP = NULL; + mac->current_UL_BWP = NULL; + for (int i = 0; i < mac->dl_BWPs.count; i++) release_dl_BWP(mac, i); for (int i = 0; i < mac->ul_BWPs.count; i++) release_ul_BWP(mac, i); - mac->current_DL_BWP = NULL; - mac->current_UL_BWP = NULL; for (int i = 0; i < NR_MAX_NUM_LCID; i++) { nr_release_mac_config_logicalChannelBearer(mac, i + 1); From 26eda2f25c2dea9f7554c50395f0673d5a039864 Mon Sep 17 00:00:00 2001 From: Raphael Defosseux Date: Tue, 16 Jan 2024 14:09:08 +0100 Subject: [PATCH 04/29] fix(build): migrating rocky dockerfiles to Rocky-linux-9 to ease maintenance Signed-off-by: Raphael Defosseux --- docker/Dockerfile.base.rocky | 5 ++- docker/Dockerfile.build.rocky | 2 +- docker/Dockerfile.eNB.rocky | 47 +++++++++++------------- docker/Dockerfile.gNB.aw2s.rocky | 27 +++++++++----- docker/Dockerfile.gNB.rocky | 57 +++++++++++++++-------------- docker/Dockerfile.lteUE.rocky | 61 +++++++++++++++----------------- docker/Dockerfile.nr-cuup.rocky | 12 ++++--- docker/Dockerfile.nrUE.rocky | 55 ++++++++++++++-------------- 8 files changed, 137 insertions(+), 129 deletions(-) diff --git a/docker/Dockerfile.base.rocky b/docker/Dockerfile.base.rocky index e8eda721d2..42267f5d59 100644 --- a/docker/Dockerfile.base.rocky +++ b/docker/Dockerfile.base.rocky @@ -21,11 +21,11 @@ #--------------------------------------------------------------------- # # Dockerfile for the Open-Air-Interface BUILD service -# Valid for Rocky 8.7 +# Valid for Rocky 9 # #--------------------------------------------------------------------- -ARG BASE_IMAGE=docker.io/rockylinux:8.7 +ARG BASE_IMAGE=docker.io/rockylinux:9 FROM $BASE_IMAGE AS ran-base ENV TZ=Europe/Paris @@ -33,7 +33,6 @@ ENV BUILD_UHD_FROM_SOURCE=True ENV UHD_VERSION=4.4.0.0 RUN dnf install 'dnf-command(config-manager)' -y && \ - dnf config-manager --set-enabled powertools && \ dnf install epel-release -y && crb enable && \ dnf update -y && \ dnf install -y \ diff --git a/docker/Dockerfile.build.rocky b/docker/Dockerfile.build.rocky index 10b04d90c0..aef75c7d2b 100644 --- a/docker/Dockerfile.build.rocky +++ b/docker/Dockerfile.build.rocky @@ -21,7 +21,7 @@ #--------------------------------------------------------------------- # # Dockerfile for the Open-Air-Interface BUILD service -# Valid for Rocky 8.7 +# Valid for Rocky 9 # #--------------------------------------------------------------------- diff --git a/docker/Dockerfile.eNB.rocky b/docker/Dockerfile.eNB.rocky index 95e9e4b6d7..5bd3aa8458 100644 --- a/docker/Dockerfile.eNB.rocky +++ b/docker/Dockerfile.eNB.rocky @@ -21,17 +21,15 @@ #--------------------------------------------------------------------- # # Dockerfile for the Open-Air-Interface BUILD service -# Valid for Rocky 8.7 +# Valid for Rocky 9 # #--------------------------------------------------------------------- -ARG BASE_IMAGE=docker.io/rockylinux:8.7 +ARG BASE_IMAGE=docker.io/rockylinux:9 FROM ran-base:latest AS enb-base FROM ran-build:latest AS enb-build -RUN python3 ./docker/scripts/generateTemplate.py ./docker/scripts/enb_parameters.yaml && \ - cp /oai-ran/docker/scripts/enb_entrypoint.sh /oai-ran/docker/scripts/entrypoint.sh #start from scratch for target executable FROM $BASE_IMAGE as oai-enb @@ -56,9 +54,9 @@ RUN dnf update -y && \ WORKDIR /opt/oai-enb/bin COPY --from=enb-build \ - /oai-ran/cmake_targets/ran_build/build/lte-softmodem \ - /oai-ran/docker/scripts/entrypoint.sh \ - ./ + /oai-ran/cmake_targets/ran_build/build/lte-softmodem ./ + +COPY ./docker/scripts/enb_entrypoint.sh ./entrypoint.sh COPY --from=enb-build \ /oai-ran/cmake_targets/ran_build/build/liboai_eth_transpro.so \ @@ -73,24 +71,25 @@ COPY --from=enb-build \ /usr/local/lib/ COPY --from=enb-base \ - /lib64/libconfig.so.9 \ + /lib64/libconfig.so.11 \ /lib64/libblas.so.3 \ + /lib64/libcblas.so.3 \ /lib64/liblapack.so.3 \ /lib64/liblapacke.so.3 \ - /lib64/libboost_chrono.so.1.66.0 \ - /lib64/libboost_date_time.so.1.66.0 \ - /lib64/libboost_filesystem.so.1.66.0 \ - /lib64/libboost_program_options.so.1.66.0 \ - /lib64/libboost_serialization.so.1.66.0 \ - /lib64/libboost_thread.so.1.66.0 \ - /lib64/libboost_system.so.1.66.0 \ - /lib64/libboost_unit_test_framework.so.1.66.0 \ - /lib64/libboost_atomic.so.1.66.0 \ - /lib64/libboost_timer.so.1.66.0 \ - /lib64/libboost_regex.so.1.66.0 \ - /lib64/libicudata.so.60 \ - /lib64/libicui18n.so.60 \ - /lib64/libicuuc.so.60 \ + /lib64/libboost_chrono.so.1.75.0 \ + /lib64/libboost_date_time.so.1.75.0 \ + /lib64/libboost_filesystem.so.1.75.0 \ + /lib64/libboost_program_options.so.1.75.0 \ + /lib64/libboost_serialization.so.1.75.0 \ + /lib64/libboost_thread.so.1.75.0 \ + /lib64/libboost_system.so.1.75.0 \ + /lib64/libboost_unit_test_framework.so.1.75.0 \ + /lib64/libboost_atomic.so.1.75.0 \ + /lib64/libboost_timer.so.1.75.0 \ + /lib64/libboost_regex.so.1.75.0 \ + /lib64/libicudata.so.67 \ + /lib64/libicui18n.so.67 \ + /lib64/libicuuc.so.67 \ /lib64/ @@ -116,10 +115,6 @@ RUN /bin/bash -c "ln -s /usr/local/lib/liboai_usrpdevif.so /usr/local/lib/liboai echo "ldd on libtelnetsrv.so" && ldd /usr/local/lib/libtelnetsrv.so && \ echo "ldd on libtelnetsrv_enb.so" && ldd /usr/local/lib/libtelnetsrv_enb.so -# Copy the relevant configuration files for eNB -WORKDIR /opt/oai-enb/etc -COPY --from=enb-build /oai-ran/docker/etc . - WORKDIR /opt/oai-enb # 2152 --> S1U, GTP/UDP diff --git a/docker/Dockerfile.gNB.aw2s.rocky b/docker/Dockerfile.gNB.aw2s.rocky index f13a6f244f..1897bf2720 100644 --- a/docker/Dockerfile.gNB.aw2s.rocky +++ b/docker/Dockerfile.gNB.aw2s.rocky @@ -21,11 +21,11 @@ #--------------------------------------------------------------------- # # Dockerfile for the Open-Air-Interface BUILD service -# Valid for Rocky 8.7 +# Valid for Rocky 9 # #--------------------------------------------------------------------- -ARG BASE_IMAGE=docker.io/rockylinux:8.7 +ARG BASE_IMAGE=docker.io/rockylinux:9 FROM ran-base:latest AS gnb-base FROM ran-build:latest AS gnb-build @@ -55,11 +55,11 @@ RUN dnf update -y && \ echo "/usr/local/lib" > /etc/ld.so.conf.d/local-lib.conf && \ echo "/usr/local/lib64" >> /etc/ld.so.conf.d/local-lib.conf +COPY ./libori.so /usr/local/lib + WORKDIR /opt/oai-gnb-aw2s/bin -COPY --from=gnb-build \ - /oai-ran/cmake_targets/ran_build/build/nr-softmodem \ - ./ -COPY ./docker/scripts/gnb-aw2s_entrypoint.sh ./entrypoint.sh +COPY --from=gnb-build /oai-ran/cmake_targets/ran_build/build/nr-softmodem ./ +COPY ./docker/scripts/gnb-aw2s_entrypoint.sh /opt/oai-gnb-aw2s/bin/entrypoint.sh COPY --from=gnb-build \ /oai-ran/cmake_targets/ran_build/build/liboai_eth_transpro.so \ @@ -70,21 +70,30 @@ COPY --from=gnb-build \ /oai-ran/cmake_targets/ran_build/build/libdfts.so \ /oai-ran/cmake_targets/ran_build/build/libldpc*.so \ /oai-ran/cmake_targets/ran_build/build/libtelnetsrv.so \ - /usr/local/lib/libori.so \ /usr/local/lib/ COPY --from=gnb-base \ - /lib64/libconfig.so.9 \ + /lib64/libconfig.so.11 \ /lib64/libforms.so.2 \ /lib64/libblas.so.3 \ + /lib64/libcblas.so.3 \ /lib64/liblapack.so.3 \ /lib64/liblapacke.so.3 \ /lib64/ RUN ln -s /usr/local/lib/libaw2sori_transpro.so /usr/local/lib/libthirdparty_transpro.so && \ ln -s /usr/local/lib/liboai_eth_transpro.so /usr/local/lib/liboai_transpro.so && \ - ldconfig + ldconfig && \ + echo "ldd on nr-softmodem" && ldd /opt/oai-gnb-aw2s/bin/nr-softmodem && \ + echo "ldd on liboai_eth_transpro.so" && ldd /usr/local/lib/liboai_eth_transpro.so && \ + echo "ldd on librfsimulator.so" && ldd /usr/local/lib/librfsimulator.so && \ + echo "ldd on libthirdparty_transpro.so" && ldd /usr/local/lib/libthirdparty_transpro.so && \ + echo "ldd on libcoding.so" && ldd /usr/local/lib/libcoding.so && \ + echo "ldd on libparams_libconfig.so" && ldd /usr/local/lib/libparams_libconfig.so && \ + echo "ldd on libdfts.so" && ldd /usr/local/lib/libdfts.so && \ + echo "ldd on libtelnetsrv.so" && ldd /usr/local/lib/libtelnetsrv.so WORKDIR /opt/oai-gnb-aw2s + ENTRYPOINT ["/opt/oai-gnb-aw2s/bin/entrypoint.sh"] CMD ["/opt/oai-gnb-aw2s/bin/nr-softmodem", "-O", "/opt/oai-gnb-aw2s/etc/gnb.conf"] diff --git a/docker/Dockerfile.gNB.rocky b/docker/Dockerfile.gNB.rocky index d6e225aa73..035f1122a5 100644 --- a/docker/Dockerfile.gNB.rocky +++ b/docker/Dockerfile.gNB.rocky @@ -21,17 +21,15 @@ #--------------------------------------------------------------------- # # Dockerfile for the Open-Air-Interface BUILD service -# Valid for Rocky 8.7 +# Valid for Rocky 9 # #--------------------------------------------------------------------- -ARG BASE_IMAGE=docker.io/rockylinux:8.7 +ARG BASE_IMAGE=docker.io/rockylinux:9 FROM ran-base:latest AS gnb-base FROM ran-build:latest AS gnb-build -RUN python3 ./docker/scripts/generateTemplate.py ./docker/scripts/gnb_parameters.yaml && \ - cp /oai-ran/docker/scripts/gnb_entrypoint.sh /oai-ran/docker/scripts/entrypoint.sh #start from scratch for target executable FROM $BASE_IMAGE as oai-gnb @@ -57,9 +55,8 @@ RUN dnf update -y && \ WORKDIR /opt/oai-gnb/bin COPY --from=gnb-build \ - /oai-ran/cmake_targets/ran_build/build/nr-softmodem \ - /oai-ran/docker/scripts/entrypoint.sh \ - ./ + /oai-ran/cmake_targets/ran_build/build/nr-softmodem ./ +COPY ./docker/scripts/gnb_entrypoint.sh ./entrypoint.sh COPY --from=gnb-build \ /oai-ran/cmake_targets/ran_build/build/liboai_eth_transpro.so \ @@ -74,25 +71,26 @@ COPY --from=gnb-build \ /usr/local/lib/ COPY --from=gnb-base \ - /lib64/libconfig.so.9 \ + /lib64/libconfig.so.11 \ /lib64/libforms.so.2 \ /lib64/libblas.so.3 \ + /lib64/libcblas.so.3 \ /lib64/liblapack.so.3 \ /lib64/liblapacke.so.3 \ - /lib64/libboost_chrono.so.1.66.0 \ - /lib64/libboost_date_time.so.1.66.0 \ - /lib64/libboost_filesystem.so.1.66.0 \ - /lib64/libboost_program_options.so.1.66.0 \ - /lib64/libboost_serialization.so.1.66.0 \ - /lib64/libboost_thread.so.1.66.0 \ - /lib64/libboost_system.so.1.66.0 \ - /lib64/libboost_unit_test_framework.so.1.66.0 \ - /lib64/libboost_atomic.so.1.66.0 \ - /lib64/libboost_timer.so.1.66.0 \ - /lib64/libboost_regex.so.1.66.0 \ - /lib64/libicudata.so.60 \ - /lib64/libicui18n.so.60 \ - /lib64/libicuuc.so.60 \ + /lib64/libboost_chrono.so.1.75.0 \ + /lib64/libboost_date_time.so.1.75.0 \ + /lib64/libboost_filesystem.so.1.75.0 \ + /lib64/libboost_program_options.so.1.75.0 \ + /lib64/libboost_serialization.so.1.75.0 \ + /lib64/libboost_thread.so.1.75.0 \ + /lib64/libboost_system.so.1.75.0 \ + /lib64/libboost_unit_test_framework.so.1.75.0 \ + /lib64/libboost_atomic.so.1.75.0 \ + /lib64/libboost_timer.so.1.75.0 \ + /lib64/libboost_regex.so.1.75.0 \ + /lib64/libicudata.so.67 \ + /lib64/libicui18n.so.67 \ + /lib64/libicuuc.so.67 \ /lib64/ # Now we are copying from builder-image the UHD files. @@ -104,11 +102,16 @@ WORKDIR /usr/local/share/uhd/rfnoc COPY --from=gnb-base /usr/local/share/uhd/rfnoc/ . RUN /bin/bash -c "ln -s /usr/local/lib/liboai_usrpdevif.so /usr/local/lib/liboai_device.so" && \ - ldconfig - -# Copy the relevant configuration files for gNB -WORKDIR /opt/oai-gnb/etc -COPY --from=gnb-build /oai-ran/docker/etc . + ldconfig && \ + echo "ldd on nr-softmodem" && ldd /opt/oai-gnb/bin/nr-softmodem && \ + echo "ldd on liboai_eth_transpro.so" && ldd /usr/local/lib/liboai_eth_transpro.so && \ + echo "ldd on librfsimulator.so" && ldd /usr/local/lib/librfsimulator.so && \ + echo "ldd on liboai_usrpdevif.so" && ldd /usr/local/lib/liboai_usrpdevif.so && \ + echo "ldd on libcoding.so" && ldd /usr/local/lib/libcoding.so && \ + echo "ldd on libparams_libconfig.so" && ldd /usr/local/lib/libparams_libconfig.so && \ + echo "ldd on libdfts.so" && ldd /usr/local/lib/libdfts.so && \ + echo "ldd on libtelnetsrv.so" && ldd /usr/local/lib/libtelnetsrv.so && \ + echo "ldd on libtelnetsrv_ci.so" && ldd /usr/local/lib/libtelnetsrv_ci.so WORKDIR /opt/oai-gnb #EXPOSE 2152/udp # S1U, GTP/UDP diff --git a/docker/Dockerfile.lteUE.rocky b/docker/Dockerfile.lteUE.rocky index 168d692e88..9e4043fb9b 100644 --- a/docker/Dockerfile.lteUE.rocky +++ b/docker/Dockerfile.lteUE.rocky @@ -21,18 +21,15 @@ #--------------------------------------------------------------------- # # Dockerfile for the Open-Air-Interface BUILD service -# Valid for Rocky 8.7 +# Valid for Rocky 9 # #--------------------------------------------------------------------- -ARG BASE_IMAGE=docker.io/rockylinux:8.7 +ARG BASE_IMAGE=docker.io/rockylinux:9 FROM ran-base:latest AS lte-ue-base FROM ran-build:latest AS lte-ue-build -RUN python3 ./docker/scripts/generateTemplate.py ./docker/scripts/lte_ue_parameters.yaml && \ - python3 ./docker/scripts/generateTemplate.py ./docker/scripts/lte_ue_sim_parameters.yaml && \ - cp /oai-ran/docker/scripts/lte_ue_entrypoint.sh /oai-ran/docker/scripts/entrypoint.sh #start from scratch for target executable FROM $BASE_IMAGE as oai-lte-ue @@ -58,12 +55,12 @@ RUN dnf update -y && \ WORKDIR /opt/oai-lte-ue/bin COPY --from=lte-ue-build \ /oai-ran/cmake_targets/ran_build/build/lte-uesoftmodem \ - /oai-ran/docker/scripts/entrypoint.sh \ /oai-ran/cmake_targets/nas_sim_tools/build/conf2uedata \ /oai-ran/cmake_targets/nas_sim_tools/build/nvram \ /oai-ran/cmake_targets/nas_sim_tools/build/usim \ ./ +COPY ./docker/scripts/lte_ue_entrypoint.sh ./entrypoint.sh COPY --from=lte-ue-build \ /oai-ran/cmake_targets/ran_build/build/liboai_eth_transpro.so \ /oai-ran/cmake_targets/ran_build/build/librfsimulator.so \ @@ -75,24 +72,25 @@ COPY --from=lte-ue-build \ /usr/local/lib/ COPY --from=lte-ue-base \ - /lib64/libconfig.so.9 \ + /lib64/libconfig.so.11 \ /lib64/libblas.so.3 \ + /lib64/libcblas.so.3 \ /lib64/liblapack.so.3 \ /lib64/liblapacke.so.3 \ - /lib64/libboost_chrono.so.1.66.0 \ - /lib64/libboost_date_time.so.1.66.0 \ - /lib64/libboost_filesystem.so.1.66.0 \ - /lib64/libboost_program_options.so.1.66.0 \ - /lib64/libboost_serialization.so.1.66.0 \ - /lib64/libboost_thread.so.1.66.0 \ - /lib64/libboost_system.so.1.66.0 \ - /lib64/libboost_unit_test_framework.so.1.66.0 \ - /lib64/libboost_atomic.so.1.66.0 \ - /lib64/libboost_timer.so.1.66.0 \ - /lib64/libboost_regex.so.1.66.0 \ - /lib64/libicudata.so.60 \ - /lib64/libicui18n.so.60 \ - /lib64/libicuuc.so.60 \ + /lib64/libboost_chrono.so.1.75.0 \ + /lib64/libboost_date_time.so.1.75.0 \ + /lib64/libboost_filesystem.so.1.75.0 \ + /lib64/libboost_program_options.so.1.75.0 \ + /lib64/libboost_serialization.so.1.75.0 \ + /lib64/libboost_thread.so.1.75.0 \ + /lib64/libboost_system.so.1.75.0 \ + /lib64/libboost_unit_test_framework.so.1.75.0 \ + /lib64/libboost_atomic.so.1.75.0 \ + /lib64/libboost_timer.so.1.75.0 \ + /lib64/libboost_regex.so.1.75.0 \ + /lib64/libicudata.so.67 \ + /lib64/libicui18n.so.67 \ + /lib64/libicuuc.so.67 \ /lib64/ # Now we are copying from builder-image the UHD files. @@ -106,17 +104,16 @@ COPY --from=lte-ue-base /usr/local/share/uhd/rfnoc/ . RUN /bin/bash -c "ln -s /usr/local/lib/liboai_usrpdevif.so /usr/local/lib/liboai_device.so" && \ ldconfig && \ echo "ldd on lte-uesoftmodem" && ldd /opt/oai-lte-ue/bin/lte-uesoftmodem && \ - echo "ldd on liboai_eth_transpro" && ldd /usr/local/lib/liboai_eth_transpro.so && \ - echo "ldd on librfsimulator" && ldd /usr/local/lib/librfsimulator.so && \ - echo "ldd on liboai_usrpdevif" && ldd /usr/local/lib/liboai_usrpdevif.so && \ - echo "ldd on libcoding" && ldd /usr/local/lib/libcoding.so && \ - echo "ldd on libparams_libconfig" && ldd /usr/local/lib/libparams_libconfig.so && \ - echo "ldd on libdfts" && ldd /usr/local/lib/libdfts.so && \ - echo "ldd on libtelnetsrv" && ldd /usr/local/lib/libtelnetsrv.so - -# Copy the relevant configuration files for UE -WORKDIR /opt/oai-lte-ue/etc -COPY --from=lte-ue-build /oai-ran/docker/etc . + echo "ldd on conf2uedata" && ldd /opt/oai-lte-ue/bin/conf2uedata && \ + echo "ldd on nvram" && ldd /opt/oai-lte-ue/bin/nvram && \ + echo "ldd on usim" && ldd /opt/oai-lte-ue/bin/usim && \ + echo "ldd on liboai_eth_transpro.so" && ldd /usr/local/lib/liboai_eth_transpro.so && \ + echo "ldd on librfsimulator.so" && ldd /usr/local/lib/librfsimulator.so && \ + echo "ldd on liboai_usrpdevif.so" && ldd /usr/local/lib/liboai_usrpdevif.so && \ + echo "ldd on libcoding.so" && ldd /usr/local/lib/libcoding.so && \ + echo "ldd on libparams_libconfig.so" && ldd /usr/local/lib/libparams_libconfig.so && \ + echo "ldd on libdfts.so" && ldd /usr/local/lib/libdfts.so && \ + echo "ldd on libtelnetsrv.so" && ldd /usr/local/lib/libtelnetsrv.so WORKDIR /opt/oai-lte-ue CMD ["/opt/oai-lte-ue/bin/lte-uesoftmodem"] diff --git a/docker/Dockerfile.nr-cuup.rocky b/docker/Dockerfile.nr-cuup.rocky index a021b356a7..adeaf053d9 100644 --- a/docker/Dockerfile.nr-cuup.rocky +++ b/docker/Dockerfile.nr-cuup.rocky @@ -21,11 +21,11 @@ #--------------------------------------------------------------------- # # Dockerfile for the Open-Air-Interface BUILD service -# Valid for Rocky 8.7 +# Valid for Rocky 9 # #--------------------------------------------------------------------- -ARG BASE_IMAGE=docker.io/rockylinux:8.7 +ARG BASE_IMAGE=docker.io/rockylinux:9 FROM ran-base:latest AS gnb-base FROM ran-build:latest AS gnb-build @@ -36,8 +36,9 @@ RUN cp /oai-ran/docker/scripts/gnb_entrypoint.sh /oai-ran/docker/scripts/entrypo FROM $BASE_IMAGE as oai-nr-cuup ENV TZ=Europe/Paris -RUN dnf update -y && \ - dnf install -y \ +RUN yum repolist --disablerepo=* && \ + yum update -y && \ + yum install -y \ procps-ng \ lksctp-tools \ tzdata \ @@ -59,8 +60,9 @@ COPY --from=gnb-build \ /usr/local/lib/ COPY --from=gnb-base \ - /lib64/libconfig.so.9 \ + /lib64/libconfig.so.11 \ /lib64/libblas.so.3 \ + /lib64/libcblas.so.3 \ /lib64/liblapack.so.3 \ /lib64/liblapacke.so.3 \ /lib64/ diff --git a/docker/Dockerfile.nrUE.rocky b/docker/Dockerfile.nrUE.rocky index cb07b2eb6a..638b4406c4 100644 --- a/docker/Dockerfile.nrUE.rocky +++ b/docker/Dockerfile.nrUE.rocky @@ -21,17 +21,15 @@ #--------------------------------------------------------------------- # # Dockerfile for the Open-Air-Interface BUILD service -# Valid for Rocky 8.7 +# Valid for Rocky 9 # #--------------------------------------------------------------------- -ARG BASE_IMAGE=docker.io/rockylinux:8.7 +ARG BASE_IMAGE=docker.io/rockylinux:9 FROM ran-base:latest AS nr-ue-base FROM ran-build:latest AS nr-ue-build -RUN python3 ./docker/scripts/generateTemplate.py ./docker/scripts/nr_ue_parameters.yaml && \ - cp /oai-ran/docker/scripts/nr_ue_entrypoint.sh /oai-ran/docker/scripts/entrypoint.sh #start from scratch for target executable FROM $BASE_IMAGE as oai-nr-ue @@ -59,9 +57,8 @@ RUN dnf update -y && \ WORKDIR /opt/oai-nr-ue/bin COPY --from=nr-ue-build \ /oai-ran/cmake_targets/ran_build/build/nr-uesoftmodem \ - /oai-ran/docker/scripts/entrypoint.sh \ ./ - +COPY ./docker/scripts/nr_ue_entrypoint.sh ./entrypoint.sh WORKDIR /opt/oai-nr-ue/etc COPY --from=nr-ue-build \ @@ -77,25 +74,26 @@ COPY --from=nr-ue-build \ /usr/local/lib/ COPY --from=nr-ue-base \ - /lib64/libconfig.so.9 \ + /lib64/libconfig.so.11 \ /lib64/libblas.so.3 \ + /lib64/libcblas.so.3 \ /lib64/liblapack.so.3 \ /lib64/liblapacke.so.3 \ /lib64/libforms.so.2 \ - /lib64/libboost_chrono.so.1.66.0 \ - /lib64/libboost_date_time.so.1.66.0 \ - /lib64/libboost_filesystem.so.1.66.0 \ - /lib64/libboost_program_options.so.1.66.0 \ - /lib64/libboost_serialization.so.1.66.0 \ - /lib64/libboost_thread.so.1.66.0 \ - /lib64/libboost_system.so.1.66.0 \ - /lib64/libboost_unit_test_framework.so.1.66.0 \ - /lib64/libboost_atomic.so.1.66.0 \ - /lib64/libboost_timer.so.1.66.0 \ - /lib64/libboost_regex.so.1.66.0 \ - /lib64/libicudata.so.60 \ - /lib64/libicui18n.so.60 \ - /lib64/libicuuc.so.60 \ + /lib64/libboost_chrono.so.1.75.0 \ + /lib64/libboost_date_time.so.1.75.0 \ + /lib64/libboost_filesystem.so.1.75.0 \ + /lib64/libboost_program_options.so.1.75.0 \ + /lib64/libboost_serialization.so.1.75.0 \ + /lib64/libboost_thread.so.1.75.0 \ + /lib64/libboost_system.so.1.75.0 \ + /lib64/libboost_unit_test_framework.so.1.75.0 \ + /lib64/libboost_atomic.so.1.75.0 \ + /lib64/libboost_timer.so.1.75.0 \ + /lib64/libboost_regex.so.1.75.0 \ + /lib64/libicudata.so.67 \ + /lib64/libicui18n.so.67 \ + /lib64/libicuuc.so.67 \ /lib64/ # Now we are copying from builder-image the UHD files. @@ -107,11 +105,16 @@ WORKDIR /usr/local/share/uhd/rfnoc COPY --from=nr-ue-base /usr/local/share/uhd/rfnoc/ . RUN /bin/bash -c "ln -s /usr/local/lib/liboai_usrpdevif.so /usr/local/lib/liboai_device.so" && \ - ldconfig - -# Copy the relevant configuration files for eNB -WORKDIR /opt/oai-nr-ue/etc -COPY --from=nr-ue-build /oai-ran/ci-scripts/conf_files/ue.* . + ldconfig && \ + echo "ldd on nr-uesoftmodem" && ldd /opt/oai-nr-ue/bin/nr-uesoftmodem && \ + echo "ldd on liboai_eth_transpro.so" && ldd /usr/local/lib/liboai_eth_transpro.so && \ + echo "ldd on librfsimulator.so" && ldd /usr/local/lib/librfsimulator.so && \ + echo "ldd on liboai_usrpdevif.so" && ldd /usr/local/lib/liboai_usrpdevif.so && \ + echo "ldd on libcoding.so" && ldd /usr/local/lib/libcoding.so && \ + echo "ldd on libparams_libconfig.so" && ldd /usr/local/lib/libparams_libconfig.so && \ + echo "ldd on libdfts.so" && ldd /usr/local/lib/libdfts.so && \ + echo "ldd on libtelnetsrv.so" && ldd /usr/local/lib/libtelnetsrv.so && \ + echo "ldd on libtelnetsrv_5Gue.so" && ldd /usr/local/lib/libtelnetsrv_5Gue.so WORKDIR /opt/oai-nr-ue CMD ["/opt/oai-nr-ue/bin/nr-uesoftmodem", "-O", "/opt/oai-nr-ue/etc/nr-ue.conf"] From a2b881a443bd37ea5b2c09afa904c6cdbbfb996e Mon Sep 17 00:00:00 2001 From: Teodora Date: Wed, 17 Jan 2024 10:53:41 +0100 Subject: [PATCH 05/29] FlexRIC release v2 - update KPM available versions - bool return when reading Service Models --- CMakeLists.txt | 4 +- .../RAN_FUNCTION/CUSTOMIZED/ran_func_gtp.c | 3 +- .../RAN_FUNCTION/CUSTOMIZED/ran_func_gtp.h | 2 +- .../RAN_FUNCTION/CUSTOMIZED/ran_func_mac.c | 4 +- .../RAN_FUNCTION/CUSTOMIZED/ran_func_mac.h | 2 +- .../RAN_FUNCTION/CUSTOMIZED/ran_func_pdcp.c | 7 ++- .../RAN_FUNCTION/CUSTOMIZED/ran_func_pdcp.h | 2 +- .../RAN_FUNCTION/CUSTOMIZED/ran_func_rlc.c | 4 +- .../RAN_FUNCTION/CUSTOMIZED/ran_func_rlc.h | 2 +- .../RAN_FUNCTION/CUSTOMIZED/ran_func_slice.c | 4 +- .../RAN_FUNCTION/CUSTOMIZED/ran_func_slice.h | 2 +- .../RAN_FUNCTION/CUSTOMIZED/ran_func_tc.c | 4 +- .../RAN_FUNCTION/CUSTOMIZED/ran_func_tc.h | 2 +- .../E2AP/RAN_FUNCTION/O-RAN/ran_func_kpm.c | 43 +++++++++---------- .../E2AP/RAN_FUNCTION/O-RAN/ran_func_kpm.h | 2 +- .../E2AP/RAN_FUNCTION/O-RAN/ran_func_rc.c | 4 +- .../E2AP/RAN_FUNCTION/O-RAN/ran_func_rc.h | 2 +- 17 files changed, 54 insertions(+), 39 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 4aefd12b54..ddda5d3e07 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -300,8 +300,8 @@ set(E2AP_VERSION "E2AP_V2" CACHE STRING "E2AP version") set_property(CACHE E2AP_VERSION PROPERTY STRINGS "E2AP_V1" "E2AP_V2" "E2AP_V3") message(STATUS "Selected E2AP_VERSION: ${E2AP_VERSION}") -set(KPM_VERSION "KPM_V2" CACHE STRING "The KPM SM version to use") -set_property(CACHE KPM_VERSION PROPERTY STRINGS "KPM_V2" "KPM_V3") +set(KPM_VERSION "KPM_V2_03" CACHE STRING "The KPM SM version to use") +set_property(CACHE KPM_VERSION PROPERTY STRINGS "KPM_V2_03" "KPM_V3_00") message(STATUS "Selected KPM Version: ${KPM_VERSION}") diff --git a/openair2/E2AP/RAN_FUNCTION/CUSTOMIZED/ran_func_gtp.c b/openair2/E2AP/RAN_FUNCTION/CUSTOMIZED/ran_func_gtp.c index ac02a85c05..6f9f776014 100644 --- a/openair2/E2AP/RAN_FUNCTION/CUSTOMIZED/ran_func_gtp.c +++ b/openair2/E2AP/RAN_FUNCTION/CUSTOMIZED/ran_func_gtp.c @@ -33,7 +33,7 @@ static const int mod_id = 0; -void read_gtp_sm(void * data) +bool read_gtp_sm(void * data) { assert(data != NULL); @@ -80,6 +80,7 @@ void read_gtp_sm(void * data) i++; } + return num_ues > 0; } void read_gtp_setup_sm(void* data) diff --git a/openair2/E2AP/RAN_FUNCTION/CUSTOMIZED/ran_func_gtp.h b/openair2/E2AP/RAN_FUNCTION/CUSTOMIZED/ran_func_gtp.h index b69fb7e462..74a6277a5e 100644 --- a/openair2/E2AP/RAN_FUNCTION/CUSTOMIZED/ran_func_gtp.h +++ b/openair2/E2AP/RAN_FUNCTION/CUSTOMIZED/ran_func_gtp.h @@ -24,7 +24,7 @@ #include "openair2/E2AP/flexric/src/agent/../sm/sm_io.h" -void read_gtp_sm(void*); +bool read_gtp_sm(void*); void read_gtp_setup_sm(void*); diff --git a/openair2/E2AP/RAN_FUNCTION/CUSTOMIZED/ran_func_mac.c b/openair2/E2AP/RAN_FUNCTION/CUSTOMIZED/ran_func_mac.c index 099c1bad1c..7619b0877b 100644 --- a/openair2/E2AP/RAN_FUNCTION/CUSTOMIZED/ran_func_mac.c +++ b/openair2/E2AP/RAN_FUNCTION/CUSTOMIZED/ran_func_mac.c @@ -27,7 +27,7 @@ static const int mod_id = 0; -void read_mac_sm(void* data) +bool read_mac_sm(void* data) { assert(data != NULL); @@ -110,6 +110,8 @@ void read_mac_sm(void* data) ++i; } + + return num_ues > 0; } void read_mac_setup_sm(void* data) diff --git a/openair2/E2AP/RAN_FUNCTION/CUSTOMIZED/ran_func_mac.h b/openair2/E2AP/RAN_FUNCTION/CUSTOMIZED/ran_func_mac.h index c32d84433d..6839b03485 100644 --- a/openair2/E2AP/RAN_FUNCTION/CUSTOMIZED/ran_func_mac.h +++ b/openair2/E2AP/RAN_FUNCTION/CUSTOMIZED/ran_func_mac.h @@ -28,7 +28,7 @@ #include "openair2/E2AP/flexric/src/util/time_now_us.h" -void read_mac_sm(void*); +bool read_mac_sm(void*); void read_mac_setup_sm(void*); diff --git a/openair2/E2AP/RAN_FUNCTION/CUSTOMIZED/ran_func_pdcp.c b/openair2/E2AP/RAN_FUNCTION/CUSTOMIZED/ran_func_pdcp.c index a340c6f499..f123d67257 100644 --- a/openair2/E2AP/RAN_FUNCTION/CUSTOMIZED/ran_func_pdcp.c +++ b/openair2/E2AP/RAN_FUNCTION/CUSTOMIZED/ran_func_pdcp.c @@ -55,7 +55,7 @@ static return act_rb; } -void read_pdcp_sm(void* data) +bool read_pdcp_sm(void* data) { assert(data != NULL); //assert(data->type == PDCP_STATS_V0); @@ -123,6 +123,9 @@ void read_pdcp_sm(void* data) ++i; } } + + return act_rb > 0; + } else { //assert(0!=0 && "Calling PDCP"); @@ -176,6 +179,8 @@ void read_pdcp_sm(void* data) ++i; } } + + return act_rb > 0; } } diff --git a/openair2/E2AP/RAN_FUNCTION/CUSTOMIZED/ran_func_pdcp.h b/openair2/E2AP/RAN_FUNCTION/CUSTOMIZED/ran_func_pdcp.h index 951cd7373d..a1b4f2d3a3 100644 --- a/openair2/E2AP/RAN_FUNCTION/CUSTOMIZED/ran_func_pdcp.h +++ b/openair2/E2AP/RAN_FUNCTION/CUSTOMIZED/ran_func_pdcp.h @@ -24,7 +24,7 @@ #include "openair2/E2AP/flexric/src/agent/../sm/sm_io.h" -void read_pdcp_sm(void*); +bool read_pdcp_sm(void*); void read_pdcp_setup_sm(void* data); diff --git a/openair2/E2AP/RAN_FUNCTION/CUSTOMIZED/ran_func_rlc.c b/openair2/E2AP/RAN_FUNCTION/CUSTOMIZED/ran_func_rlc.c index bc9bac5916..0e6359e9fa 100644 --- a/openair2/E2AP/RAN_FUNCTION/CUSTOMIZED/ran_func_rlc.c +++ b/openair2/E2AP/RAN_FUNCTION/CUSTOMIZED/ran_func_rlc.c @@ -67,7 +67,7 @@ void active_avg_to_tx(NR_UEs_t* const UE_info) } } -void read_rlc_sm(void* data) +bool read_rlc_sm(void* data) { assert(data != NULL); // assert(data->type == RLC_STATS_V0); @@ -161,6 +161,8 @@ void read_rlc_sm(void* data) ++i; } } + + return act_rb > 0; } void read_rlc_setup_sm(void* data) diff --git a/openair2/E2AP/RAN_FUNCTION/CUSTOMIZED/ran_func_rlc.h b/openair2/E2AP/RAN_FUNCTION/CUSTOMIZED/ran_func_rlc.h index b2f518e7f6..9edf6f0818 100644 --- a/openair2/E2AP/RAN_FUNCTION/CUSTOMIZED/ran_func_rlc.h +++ b/openair2/E2AP/RAN_FUNCTION/CUSTOMIZED/ran_func_rlc.h @@ -24,7 +24,7 @@ #include "openair2/E2AP/flexric/src/agent/../sm/sm_io.h" -void read_rlc_sm(void*); +bool read_rlc_sm(void*); void read_rlc_setup_sm(void* data); diff --git a/openair2/E2AP/RAN_FUNCTION/CUSTOMIZED/ran_func_slice.c b/openair2/E2AP/RAN_FUNCTION/CUSTOMIZED/ran_func_slice.c index b0f81136b0..11ce8b513b 100644 --- a/openair2/E2AP/RAN_FUNCTION/CUSTOMIZED/ran_func_slice.c +++ b/openair2/E2AP/RAN_FUNCTION/CUSTOMIZED/ran_func_slice.c @@ -24,13 +24,15 @@ #include #include -void read_slice_sm(void* data) +bool read_slice_sm(void* data) { assert(data != NULL); // assert(data->type == SLICE_STATS_V0); slice_ind_data_t* slice = (slice_ind_data_t*)data; fill_slice_ind_data(slice); + + return true; } void read_slice_setup_sm(void* data) diff --git a/openair2/E2AP/RAN_FUNCTION/CUSTOMIZED/ran_func_slice.h b/openair2/E2AP/RAN_FUNCTION/CUSTOMIZED/ran_func_slice.h index d01f7f2cf2..3d9203a676 100644 --- a/openair2/E2AP/RAN_FUNCTION/CUSTOMIZED/ran_func_slice.h +++ b/openair2/E2AP/RAN_FUNCTION/CUSTOMIZED/ran_func_slice.h @@ -24,7 +24,7 @@ #include "openair2/E2AP/flexric/src/agent/../sm/sm_io.h" -void read_slice_sm(void*); +bool read_slice_sm(void*); void read_slice_setup_sm(void* data); diff --git a/openair2/E2AP/RAN_FUNCTION/CUSTOMIZED/ran_func_tc.c b/openair2/E2AP/RAN_FUNCTION/CUSTOMIZED/ran_func_tc.c index 6d420fa183..e6fc3f851b 100644 --- a/openair2/E2AP/RAN_FUNCTION/CUSTOMIZED/ran_func_tc.c +++ b/openair2/E2AP/RAN_FUNCTION/CUSTOMIZED/ran_func_tc.c @@ -23,13 +23,15 @@ #include "../../flexric/test/rnd/fill_rnd_data_tc.h" #include -void read_tc_sm(void* data) +bool read_tc_sm(void* data) { assert(data != NULL); //assert(data->type == TC_STATS_V0); tc_ind_data_t* tc = (tc_ind_data_t*)data; fill_tc_ind_data(tc); + + return true; } void read_tc_setup_sm(void* data) diff --git a/openair2/E2AP/RAN_FUNCTION/CUSTOMIZED/ran_func_tc.h b/openair2/E2AP/RAN_FUNCTION/CUSTOMIZED/ran_func_tc.h index 19d655301b..86f5dd1a5a 100644 --- a/openair2/E2AP/RAN_FUNCTION/CUSTOMIZED/ran_func_tc.h +++ b/openair2/E2AP/RAN_FUNCTION/CUSTOMIZED/ran_func_tc.h @@ -24,7 +24,7 @@ #include "openair2/E2AP/flexric/src/agent/../sm/sm_io.h" -void read_tc_sm(void*); +bool read_tc_sm(void*); void read_tc_setup_sm(void* data); diff --git a/openair2/E2AP/RAN_FUNCTION/O-RAN/ran_func_kpm.c b/openair2/E2AP/RAN_FUNCTION/O-RAN/ran_func_kpm.c index 562cc715d8..d56d39542b 100644 --- a/openair2/E2AP/RAN_FUNCTION/O-RAN/ran_func_kpm.c +++ b/openair2/E2AP/RAN_FUNCTION/O-RAN/ran_func_kpm.c @@ -73,7 +73,7 @@ static size_t filter_ues_by_s_nssai_in_du_or_monolithic(test_cond_e const condit } matches->num_ues = i; - assert(matches->num_ues >= 1 && "The number of filtered UEs must be at least equal to 1"); + return i; } @@ -104,7 +104,7 @@ static size_t filter_ues_by_s_nssai_in_cu(test_cond_e const condition, uint8_t s } matches->num_ues = i; - assert(matches->num_ues >= 1 && "The number of filtered UEs must be at least equal to 1"); + return i; } @@ -613,9 +613,9 @@ kpm_ric_ind_hdr_format_1_t kpm_ind_hdr_frm_1(void) kpm_ric_ind_hdr_format_1_t hdr_frm_1 = {0}; int64_t const t = time_now_us(); -#if defined KPM_V2 +#if defined KPM_V2_03 hdr_frm_1.collectStartTime = t/1000000; // seconds -#elif defined KPM_V3 +#elif defined KPM_V3_00 hdr_frm_1.collectStartTime = t; // microseconds #else static_assert(0!=0, "Undefined KPM SM Version"); @@ -690,31 +690,31 @@ static void capture_sst_sd(test_info_lst_t* test, uint8_t *sst, uint32_t **sd) // we made a mistake in the past: NSSAI is supposed to be an OCTET_STRING, // but earlier version of the RAN function and the xApp used integer, so // handle this gracefully by accepting integer as well - switch (*test->test_cond_value) { + switch (test->test_cond_value->type) { case INTEGER_TEST_COND_VALUE: - AssertFatal(*test->int_value <= 0xff, "illegal SST %ld\n", *test->int_value); - *sst = *test->int_value; + AssertFatal(*test->test_cond_value->int_value <= 0xff, "illegal SST %ld\n", *test->test_cond_value->int_value); + *sst = *test->test_cond_value->int_value; *sd = NULL; break; case OCTET_STRING_TEST_COND_VALUE: - if (test->octet_string_value->len == 1) { - *sst = test->octet_string_value->buf[0]; + if (test->test_cond_value->octet_string_value->len == 1) { + *sst = test->test_cond_value->octet_string_value->buf[0]; *sd = NULL; } else { - DevAssert(test->octet_string_value->len == 4); - uint8_t *buf = test->octet_string_value->buf; + DevAssert(test->test_cond_value->octet_string_value->len == 4); + uint8_t *buf = test->test_cond_value->octet_string_value->buf; *sst = buf[0]; *sd = malloc(**sd); **sd = buf[1] << 16 | buf[2] << 8 | buf[3]; } break; default: - AssertFatal(false, "test condition value %d impossible\n", *test->test_cond_value); + AssertFatal(false, "test condition value %d impossible\n", test->test_cond_value->type); break; } } -void read_kpm_sm(void* data) +bool read_kpm_sm(void* data) { assert(data != NULL); // assert(data->type == KPM_STATS_V3_0); @@ -767,9 +767,7 @@ void read_kpm_sm(void* data) } case CQI_TEST_COND_TYPE: { - // This is a bad idea. Done only to check FlexRIC xAPP - printf("CQI not implemented!. Randomly filling the data \n"); - goto rnd_data_label; + assert(0 != 0 && "Not implemented"); break; } @@ -786,7 +784,7 @@ void read_kpm_sm(void* data) case S_NSSAI_TEST_COND_TYPE: { assert(frm_4->matching_cond_lst[i].test_info_lst.S_NSSAI == TRUE_TEST_COND_TYPE && "Must be true"); assert(frm_4->matching_cond_lst[i].test_info_lst.test_cond != NULL && "Even though is optional.."); - assert(frm_4->matching_cond_lst[i].test_info_lst.int_value != NULL && "Even though is optional.."); + assert(frm_4->matching_cond_lst[i].test_info_lst.test_cond_value != NULL && "Even though is optional.."); test_cond_e const test_cond = *frm_4->matching_cond_lst[i].test_info_lst.test_cond; uint8_t sst = 0; @@ -796,14 +794,17 @@ void read_kpm_sm(void* data) if (NODE_IS_DU(RC.nrrrc[0]->node_type)) { matched_ues_mac_t matched_ues = {0}; matched_ues.num_ues = filter_ues_by_s_nssai_in_du_or_monolithic(test_cond, sst, sd, &matched_ues); + if (matched_ues.num_ues == 0) return false; kpm->ind.msg.frm_3 = fill_kpm_ind_msg_frm_3_in_du(&matched_ues, &frm_4->action_def_format_1); } else if (NODE_IS_CU(RC.nrrrc[0]->node_type)) { matched_ues_rrc_t matched_ues = {0}; matched_ues.num_ues = filter_ues_by_s_nssai_in_cu(test_cond, sst, sd, &matched_ues); + if (matched_ues.num_ues == 0) return false; kpm->ind.msg.frm_3 = fill_kpm_ind_msg_frm_3_in_cu(&matched_ues, &frm_4->action_def_format_1); } else if (NODE_IS_MONOLITHIC(RC.nrrrc[0]->node_type)) { matched_ues_mac_t matched_ues = {0}; matched_ues.num_ues = filter_ues_by_s_nssai_in_du_or_monolithic(test_cond, sst, sd, &matched_ues); + if (matched_ues.num_ues == 0) return false; kpm->ind.msg.frm_3 = fill_kpm_ind_msg_frm_3_in_monolithic(&matched_ues, &frm_4->action_def_format_1); } else { assert(false && "NG-RAN Type not implemented"); @@ -822,13 +823,11 @@ void read_kpm_sm(void* data) } default: { - rnd_data_label: - kpm->ind.hdr = fill_rnd_kpm_ind_hdr(); - kpm->ind.msg = fill_rnd_kpm_ind_msg(); - - break; + AssertFatal(kpm->act_def->type == FORMAT_4_ACTION_DEFINITION, "Action Definition Format %d not yet implemented", kpm->act_def->type); } } + + return true; } void read_kpm_setup_sm(void* e2ap) diff --git a/openair2/E2AP/RAN_FUNCTION/O-RAN/ran_func_kpm.h b/openair2/E2AP/RAN_FUNCTION/O-RAN/ran_func_kpm.h index 9ef9207819..4883f9fe49 100644 --- a/openair2/E2AP/RAN_FUNCTION/O-RAN/ran_func_kpm.h +++ b/openair2/E2AP/RAN_FUNCTION/O-RAN/ran_func_kpm.h @@ -24,7 +24,7 @@ #include "openair2/E2AP/flexric/src/agent/../sm/sm_io.h" -void read_kpm_sm(void*); +bool read_kpm_sm(void*); void read_kpm_setup_sm(void*); diff --git a/openair2/E2AP/RAN_FUNCTION/O-RAN/ran_func_rc.c b/openair2/E2AP/RAN_FUNCTION/O-RAN/ran_func_rc.c index e05bb3fd7b..6d6db167df 100644 --- a/openair2/E2AP/RAN_FUNCTION/O-RAN/ran_func_rc.c +++ b/openair2/E2AP/RAN_FUNCTION/O-RAN/ran_func_rc.c @@ -30,11 +30,13 @@ #include #include -void read_rc_sm(void* data) +bool read_rc_sm(void* data) { assert(data != NULL); // assert(data->type == RAN_CTRL_STATS_V1_03); assert(0!=0 && "Not implemented"); + + return true; } void read_rc_setup_sm(void* data) diff --git a/openair2/E2AP/RAN_FUNCTION/O-RAN/ran_func_rc.h b/openair2/E2AP/RAN_FUNCTION/O-RAN/ran_func_rc.h index c7f252971c..ed877fea02 100644 --- a/openair2/E2AP/RAN_FUNCTION/O-RAN/ran_func_rc.h +++ b/openair2/E2AP/RAN_FUNCTION/O-RAN/ran_func_rc.h @@ -24,7 +24,7 @@ #include "openair2/E2AP/flexric/src/agent/../sm/sm_io.h" -void read_rc_sm(void *); +bool read_rc_sm(void *); void read_rc_setup_sm(void* data); From 56843fc1d72f6bfb718459996d0e4471c1bf7440 Mon Sep 17 00:00:00 2001 From: Teodora Date: Wed, 17 Jan 2024 15:51:52 +0100 Subject: [PATCH 06/29] Add E2 agent in CU-UP --- CMakeLists.txt | 8 +++-- executables/nr-cuup.c | 53 +++++++++++++++++++++++++++++++ executables/nr-softmodem.c | 2 +- openair2/E2AP/CMakeLists.txt | 1 + openair2/E2AP/e2_agent_arg.c | 50 +++++++++++++++++++++++++++++ openair2/E2AP/e2_agent_arg.h | 4 +++ openair2/E2AP/e2_agent_paramdef.h | 42 ++++++++++++++++++++++++ openair2/ENB_APP/enb_config.c | 32 ------------------- openair2/ENB_APP/enb_paramdef.h | 25 --------------- openair2/GNB_APP/gnb_config.c | 30 ----------------- 10 files changed, 157 insertions(+), 90 deletions(-) create mode 100644 openair2/E2AP/e2_agent_arg.c create mode 100644 openair2/E2AP/e2_agent_paramdef.h diff --git a/CMakeLists.txt b/CMakeLists.txt index ddda5d3e07..bd1c3d0618 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1433,7 +1433,7 @@ target_link_libraries(L2 PRIVATE x2ap s1ap lte_rrc m2ap) target_link_libraries(L2 PRIVATE asn1_lte_rrc_hdrs asn1_nr_rrc_hdrs) if(E2_AGENT) - target_link_libraries(L2 PUBLIC e2_agent e2_ran_func) + target_link_libraries(L2 PUBLIC e2_agent e2_agent_arg e2_ran_func) target_compile_definitions(L2 PRIVATE E2_AGENT) target_compile_definitions(L2 PRIVATE ${E2AP_VERSION} ${KPM_VERSION}) endif() @@ -1460,7 +1460,7 @@ target_link_libraries(e1_if PRIVATE asn1_nr_rrc_hdrs asn1_lte_rrc_hdrs asn1_f1ap target_link_libraries(L2_NR PRIVATE f1ap x2ap s1ap ngap nr_rrc e1ap nr_rlc) if(E2_AGENT) - target_link_libraries(L2_NR PUBLIC e2_agent e2_ran_func) + target_link_libraries(L2_NR PUBLIC e2_agent e2_agent_arg e2_ran_func) target_compile_definitions(L2_NR PRIVATE ${E2AP_VERSION} ${KPM_VERSION}) target_compile_definitions(L2_NR PRIVATE E2_AGENT) endif() @@ -2114,6 +2114,10 @@ target_link_libraries(nr-cuup PRIVATE GTPV1U e1ap f1ap SIMU_ETH z sctp dl pthread shlib_loader ${T_LIB}) target_link_libraries(nr-cuup PRIVATE asn1_lte_rrc_hdrs asn1_nr_rrc_hdrs) +if(E2_AGENT) + target_link_libraries(nr-cuup PRIVATE e2_agent e2_agent_arg) # RAN functions to be added + target_compile_definitions(nr-cuup PRIVATE ${E2AP_VERSION} ${KPM_VERSION} E2_AGENT) +endif() # nr-uesoftmodem is UE implementation ####################################### diff --git a/executables/nr-cuup.c b/executables/nr-cuup.c index 5fb66bc73a..d78f671a05 100644 --- a/executables/nr-cuup.c +++ b/executables/nr-cuup.c @@ -39,6 +39,43 @@ int asn1_xer_print; int oai_exit = 0; instance_t CUuniqInstance = 0; +#ifdef E2_AGENT +#include "openair2/E2AP/flexric/src/agent/e2_agent_api.h" +#include "openair2/E2AP/RAN_FUNCTION/init_ran_func.h" + +static void initialize_agent(ngran_node_t node_type, e2_agent_args_t oai_args) +{ + AssertFatal(oai_args.sm_dir != NULL , "Please, specify the directory where the SMs are located in the config file, i.e., add in config file the next line: e2_agent = {near_ric_ip_addr = \"127.0.0.1\"; sm_dir = \"/usr/local/lib/flexric/\");} "); + AssertFatal(oai_args.ip != NULL , "Please, specify the IP address of the nearRT-RIC in the config file, i.e., e2_agent = {near_ric_ip_addr = \"127.0.0.1\"; sm_dir = \"/usr/local/lib/flexric/\""); + + printf("After RCconfig_NR_E2agent %s %s \n",oai_args.sm_dir, oai_args.ip ); + + fr_args_t args = { .ip = oai_args.ip }; // init_fr_args(0, NULL); + memcpy(args.libs_dir, oai_args.sm_dir, 128); + + sleep(1); + + // Only 1 instances is supported in one executable + // Advice: run multiple executables to have multiple instances + const e1ap_upcp_inst_t *e1inst = getCxtE1(CUuniqInstance); + + const int nb_id = e1inst->gnb_id; + const int cu_up_id = e1inst->cuup.setupReq.gNB_cu_up_id; + const int mcc = e1inst->cuup.setupReq.plmn[0].id.mcc; + const int mnc = e1inst->cuup.setupReq.plmn[0].id.mnc; + const int mnc_digit_len = e1inst->cuup.setupReq.plmn[0].id.mnc_digit_length; + // const ngran_node_t node_type = ngran_gNB_CUUP; + + printf("[E2 NODE]: mcc = %d mnc = %d mnc_digit = %d nb_id = %d \n", mcc, mnc, mnc_digit_len, nb_id); + + printf("[E2 NODE]: Args %s %s \n", args.ip, args.libs_dir); + + // sm_io_ag_ran_t io = init_ran_func_ag(); + // init_agent_api(mcc, mnc, mnc_digit_len, nb_id, cu_up_id, node_type, io, &args); +} +#endif // E2_AGENT + + void exit_function(const char *file, const char *function, const int line, const char *s, const int assert) { if (assert) { @@ -135,6 +172,22 @@ int main(int argc, char **argv) AssertFatal(msg != NULL, "Send init to task for E1AP UP failed\n"); itti_send_msg_to_task(TASK_CUUP_E1, 0, msg); + #ifdef E2_AGENT + ////////////////////////////////// + ////////////////////////////////// + //// Init the E2 Agent + + // OAI Wrapper + e2_agent_args_t oai_args = RCconfig_NR_E2agent(); + + if (oai_args.enabled) { + const ngran_node_t node_type = get_node_type(); + assert(node_type == ngran_gNB_CUUP); + initialize_agent(node_type, oai_args); + } + + #endif // E2_AGENT + printf("TYPE TO TERMINATE\n"); itti_wait_tasks_end(NULL); diff --git a/executables/nr-softmodem.c b/executables/nr-softmodem.c index aa8dd6025e..ad24e55755 100644 --- a/executables/nr-softmodem.c +++ b/executables/nr-softmodem.c @@ -600,7 +600,7 @@ static void initialize_agent(ngran_node_t node_type, e2_agent_args_t oai_args) AssertFatal(mac != NULL, "MAC not initialized\n"); cu_du_id = mac->f1_config.gnb_id; nb_id = mac->f1_config.setup_req->gNB_DU_id; - } else if (node_type == ngran_gNB_CU) { + } else if (node_type == ngran_gNB_CU || node_type == ngran_gNB_CUCP) { // agent buggy: the CU has no second ID, it is the CU-UP ID // however, that is not a problem her for us, so put the same ID twice nb_id = rrc->node_id; diff --git a/openair2/E2AP/CMakeLists.txt b/openair2/E2AP/CMakeLists.txt index c5603849a3..c7f79ae06f 100644 --- a/openair2/E2AP/CMakeLists.txt +++ b/openair2/E2AP/CMakeLists.txt @@ -128,3 +128,4 @@ add_subdirectory(flexric/src/sm) add_subdirectory(flexric/src/util) add_subdirectory(RAN_FUNCTION) +add_library(e2_agent_arg STATIC e2_agent_arg.c) diff --git a/openair2/E2AP/e2_agent_arg.c b/openair2/E2AP/e2_agent_arg.c new file mode 100644 index 0000000000..ea0eee3f1a --- /dev/null +++ b/openair2/E2AP/e2_agent_arg.c @@ -0,0 +1,50 @@ +/* + * 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 + */ + +#include "e2_agent_arg.h" +#include "e2_agent_paramdef.h" +#include "common/config/config_userapi.h" + +e2_agent_args_t RCconfig_NR_E2agent(void) +{ + paramdef_t e2agent_params[] = E2AGENT_PARAMS_DESC; + int ret = config_get(config_get_if(), e2agent_params, sizeofArray(e2agent_params), CONFIG_STRING_E2AGENT); + if (ret < 0) { + printf("configuration file does not contain a \"%s\" section, applying default parameters from FlexRIC\n", CONFIG_STRING_E2AGENT); + return (e2_agent_args_t) { 0 }; + } + + bool enabled = config_isparamset(e2agent_params, E2AGENT_CONFIG_SMDIR_IDX) + && config_isparamset(e2agent_params, E2AGENT_CONFIG_IP_IDX); + e2_agent_args_t dst = {.enabled = enabled}; + if (!enabled) { + printf("E2 agent is DISABLED (for activation, define .%s.{%s,%s} parameters)\n", CONFIG_STRING_E2AGENT, E2AGENT_CONFIG_IP, E2AGENT_CONFIG_SMDIR); + return dst; + } + + if (e2agent_params[E2AGENT_CONFIG_SMDIR_IDX].strptr != NULL) + dst.sm_dir = *e2agent_params[E2AGENT_CONFIG_SMDIR_IDX].strptr; + + if (e2agent_params[E2AGENT_CONFIG_IP_IDX].strptr != NULL) + dst.ip = *e2agent_params[E2AGENT_CONFIG_IP_IDX].strptr; + + return dst; +} diff --git a/openair2/E2AP/e2_agent_arg.h b/openair2/E2AP/e2_agent_arg.h index 30f1ce4750..48ec8b3a24 100644 --- a/openair2/E2AP/e2_agent_arg.h +++ b/openair2/E2AP/e2_agent_arg.h @@ -23,6 +23,8 @@ #define E2_AGENT_ARGS_H #include +#include +#include // Wrapper for OAI typedef struct{ @@ -31,6 +33,8 @@ typedef struct{ const bool enabled; } e2_agent_args_t; +e2_agent_args_t RCconfig_NR_E2agent(void); + #endif diff --git a/openair2/E2AP/e2_agent_paramdef.h b/openair2/E2AP/e2_agent_paramdef.h new file mode 100644 index 0000000000..8d68c8898a --- /dev/null +++ b/openair2/E2AP/e2_agent_paramdef.h @@ -0,0 +1,42 @@ +/* + * 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 + */ + +#ifndef E2_AGENT_PARAMDEF_H_ +#define E2_AGENT_PARAMDEF_H_ + +/* E2 Agent configuration */ +#define CONFIG_STRING_E2AGENT "e2_agent" + +#define E2AGENT_CONFIG_IP "near_ric_ip_addr" +#define E2AGENT_CONFIG_SMDIR "sm_dir" + +static const char* const e2agent_config_ip_default = "127.0.0.1"; +static const char* const e2agent_config_smdir_default = "."; + +#define E2AGENT_PARAMS_DESC { \ + {E2AGENT_CONFIG_IP, "RIC IP address", 0, strptr:NULL, defstrval:(char*)e2agent_config_ip_default, TYPE_STRING, 0}, \ + {E2AGENT_CONFIG_SMDIR, "Directory with SMs to load", 0, strptr:NULL, defstrval:(char*)e2agent_config_smdir_default, TYPE_STRING, 0}, \ +} + +#define E2AGENT_CONFIG_IP_IDX 0 +#define E2AGENT_CONFIG_SMDIR_IDX 1 + +#endif diff --git a/openair2/ENB_APP/enb_config.c b/openair2/ENB_APP/enb_config.c index a360369c94..0debcc3264 100644 --- a/openair2/ENB_APP/enb_config.c +++ b/openair2/ENB_APP/enb_config.c @@ -2931,35 +2931,3 @@ void read_config_and_init(void) { RCconfig_RRC(enb_id, RC.rrc[enb_id]); } } - -#ifdef E2_AGENT - -e2_agent_args_t RCconfig_E2agent(void) -{ - paramdef_t e2agent_params[] = E2AGENT_PARAMS_DESC; - int ret = config_get(config_get_if(), e2agent_params, sizeofArray(e2agent_params), CONFIG_STRING_E2AGENT); - if (ret < 0) { - LOG_W(GNB_APP, "configuration file does not contain a \"%s\" section, applying default parameters\n", CONFIG_STRING_E2AGENT); - return (e2_agent_args_t) {0}; - } - - bool enabled = config_isparamset(e2agent_params, E2AGENT_CONFIG_SMDIR_IDX) - && config_isparamset(e2agent_params, E2AGENT_CONFIG_IP_IDX); - if (!enabled) { - LOG_W(GNB_APP, "E2 agent is DISABLED (for activation, define .%s.{%s,%s} parameters)\n", CONFIG_STRING_E2AGENT, E2AGENT_CONFIG_IP, E2AGENT_CONFIG_SMDIR); - return (e2_agent_args_t) { - .enabled = false, - }; - } - - return (e2_agent_args_t) { - .enabled = true, - .ip = *e2agent_params[E2AGENT_CONFIG_IP_IDX].strptr, - .sm_dir = *e2agent_params[E2AGENT_CONFIG_SMDIR_IDX].strptr, - }; -} - - -#endif - - diff --git a/openair2/ENB_APP/enb_paramdef.h b/openair2/ENB_APP/enb_paramdef.h index 626705317b..ed3be8c024 100644 --- a/openair2/ENB_APP/enb_paramdef.h +++ b/openair2/ENB_APP/enb_paramdef.h @@ -1321,32 +1321,7 @@ typedef struct srb1_params_s { #define CONFIG_HLP_PARALLEL "PARALLEL_SINGLE_THREAD, PARALLEL_RU_L1_SPLIT, or PARALLEL_RU_L1_TRX_SPLIT(RU_L1_TRX_SPLIT by defult)\n" /*-------------------------------------------------------------------------------------------------------------------------------------------------------------*/ -#ifdef E2_AGENT -/* E2 Agent configuration */ -#define CONFIG_STRING_E2AGENT "e2_agent" - -#define E2AGENT_CONFIG_IP "near_ric_ip_addr" -//#define E2AGENT_CONFIG_PORT "port" -#define E2AGENT_CONFIG_SMDIR "sm_dir" - -static const char* const e2agent_config_ip_default = "127.0.0.1"; -static const char* const e2agent_config_smdir_default = "."; - -#define E2AGENT_PARAMS_DESC { \ - {E2AGENT_CONFIG_IP, "RIC IP address", 0, strptr:NULL, defstrval:(char*)e2agent_config_ip_default, TYPE_STRING, 0}, \ - {E2AGENT_CONFIG_SMDIR, "Directory with SMs to load", 0, strptr:NULL, defstrval:(char*)e2agent_config_smdir_default, TYPE_STRING, 0}, \ -} -/* -// {E2AGENT_CONFIG_PORT, "RIC port", 0, u16ptr:NULL, defuintval:e2agent_config_port_default, TYPE_UINT16, 0}, \ -} -*/ - -#define E2AGENT_CONFIG_IP_IDX 0 -#define E2AGENT_CONFIG_SMDIR_IDX 1 -//#define E2AGENT_CONFIG_PORT_IDX 2 - -#endif // E2_AGENT #include "enb_paramdef_emtc.h" diff --git a/openair2/GNB_APP/gnb_config.c b/openair2/GNB_APP/gnb_config.c index de0373e37a..8be6543010 100644 --- a/openair2/GNB_APP/gnb_config.c +++ b/openair2/GNB_APP/gnb_config.c @@ -2266,33 +2266,3 @@ ngran_node_t get_node_type(void) return ngran_gNB; } } - -#ifdef E2_AGENT - -e2_agent_args_t RCconfig_NR_E2agent(void) -{ - paramdef_t e2agent_params[] = E2AGENT_PARAMS_DESC; - int ret = config_get(config_get_if(), e2agent_params, sizeofArray(e2agent_params), CONFIG_STRING_E2AGENT); - if (ret < 0) { - LOG_W(GNB_APP, "configuration file does not contain a \"%s\" section, applying default parameters from FlexRIC\n", CONFIG_STRING_E2AGENT); - return (e2_agent_args_t) { 0 }; - } - - bool enabled = config_isparamset(e2agent_params, E2AGENT_CONFIG_SMDIR_IDX) - && config_isparamset(e2agent_params, E2AGENT_CONFIG_IP_IDX); - e2_agent_args_t dst = {.enabled = enabled}; - if (!enabled) { - LOG_W(GNB_APP, "E2 agent is DISABLED (for activation, define .%s.{%s,%s} parameters)\n", CONFIG_STRING_E2AGENT, E2AGENT_CONFIG_IP, E2AGENT_CONFIG_SMDIR); - return dst; - } - - if (e2agent_params[E2AGENT_CONFIG_SMDIR_IDX].strptr != NULL) - dst.sm_dir = *e2agent_params[E2AGENT_CONFIG_SMDIR_IDX].strptr; - - if (e2agent_params[E2AGENT_CONFIG_IP_IDX].strptr != NULL) - dst.ip = *e2agent_params[E2AGENT_CONFIG_IP_IDX].strptr; - - return dst; -} - -#endif // E2_AGENT From 9207e134676054cee4c44aa43a53a9dad91118bf Mon Sep 17 00:00:00 2001 From: Teodora Date: Wed, 17 Jan 2024 15:53:52 +0100 Subject: [PATCH 07/29] Service Models support in CU-UP - e2_ran_func library divided into e2_ran_func_cuup (CU-UP only) and e2_ran_func_du_cucp_cuup (DU, CU, CU-CP and gNB-mono) - GTP SM is not yet implemented in CU-UP -> CU-UP doesn't store PDU session information - PDCP SM support for gNB-mono, CU and CU-UP - KPM SM support for all node types (DU, CU, CU-UP, CU-CP and gNB-mono) --- CMakeLists.txt | 6 +- executables/nr-cuup.c | 5 +- openair2/E2AP/RAN_FUNCTION/CMakeLists.txt | 51 +- .../RAN_FUNCTION/CUSTOMIZED/CMakeLists.txt | 20 - .../RAN_FUNCTION/CUSTOMIZED/ran_func_gtp.c | 75 +- .../RAN_FUNCTION/CUSTOMIZED/ran_func_mac.c | 1 - .../RAN_FUNCTION/CUSTOMIZED/ran_func_pdcp.c | 232 ++-- .../RAN_FUNCTION/CUSTOMIZED/ran_func_rlc.c | 1 - .../E2AP/RAN_FUNCTION/O-RAN/CMakeLists.txt | 10 - .../E2AP/RAN_FUNCTION/O-RAN/ran_func_kpm.c | 1047 +++++++++-------- .../E2AP/RAN_FUNCTION/O-RAN/ran_func_rc.c | 4 +- openair2/E2AP/RAN_FUNCTION/init_ran_func.c | 37 +- openair2/LAYER2/nr_pdcp/nr_pdcp_oai_api.c | 12 + openair2/LAYER2/nr_pdcp/nr_pdcp_oai_api.h | 2 + 14 files changed, 762 insertions(+), 741 deletions(-) delete mode 100644 openair2/E2AP/RAN_FUNCTION/CUSTOMIZED/CMakeLists.txt delete mode 100644 openair2/E2AP/RAN_FUNCTION/O-RAN/CMakeLists.txt diff --git a/CMakeLists.txt b/CMakeLists.txt index bd1c3d0618..ebf80cd457 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1433,7 +1433,7 @@ target_link_libraries(L2 PRIVATE x2ap s1ap lte_rrc m2ap) target_link_libraries(L2 PRIVATE asn1_lte_rrc_hdrs asn1_nr_rrc_hdrs) if(E2_AGENT) - target_link_libraries(L2 PUBLIC e2_agent e2_agent_arg e2_ran_func) + target_link_libraries(L2 PUBLIC e2_agent e2_agent_arg e2_ran_func_du_cucp_cuup) target_compile_definitions(L2 PRIVATE E2_AGENT) target_compile_definitions(L2 PRIVATE ${E2AP_VERSION} ${KPM_VERSION}) endif() @@ -1460,7 +1460,7 @@ target_link_libraries(e1_if PRIVATE asn1_nr_rrc_hdrs asn1_lte_rrc_hdrs asn1_f1ap target_link_libraries(L2_NR PRIVATE f1ap x2ap s1ap ngap nr_rrc e1ap nr_rlc) if(E2_AGENT) - target_link_libraries(L2_NR PUBLIC e2_agent e2_agent_arg e2_ran_func) + target_link_libraries(L2_NR PUBLIC e2_agent e2_agent_arg e2_ran_func_du_cucp_cuup) target_compile_definitions(L2_NR PRIVATE ${E2AP_VERSION} ${KPM_VERSION}) target_compile_definitions(L2_NR PRIVATE E2_AGENT) endif() @@ -2115,7 +2115,7 @@ target_link_libraries(nr-cuup PRIVATE z sctp dl pthread shlib_loader ${T_LIB}) target_link_libraries(nr-cuup PRIVATE asn1_lte_rrc_hdrs asn1_nr_rrc_hdrs) if(E2_AGENT) - target_link_libraries(nr-cuup PRIVATE e2_agent e2_agent_arg) # RAN functions to be added + target_link_libraries(nr-cuup PRIVATE e2_agent e2_agent_arg e2_ran_func_cuup) target_compile_definitions(nr-cuup PRIVATE ${E2AP_VERSION} ${KPM_VERSION} E2_AGENT) endif() diff --git a/executables/nr-cuup.c b/executables/nr-cuup.c index d78f671a05..51c53ce875 100644 --- a/executables/nr-cuup.c +++ b/executables/nr-cuup.c @@ -64,14 +64,13 @@ static void initialize_agent(ngran_node_t node_type, e2_agent_args_t oai_args) const int mcc = e1inst->cuup.setupReq.plmn[0].id.mcc; const int mnc = e1inst->cuup.setupReq.plmn[0].id.mnc; const int mnc_digit_len = e1inst->cuup.setupReq.plmn[0].id.mnc_digit_length; - // const ngran_node_t node_type = ngran_gNB_CUUP; printf("[E2 NODE]: mcc = %d mnc = %d mnc_digit = %d nb_id = %d \n", mcc, mnc, mnc_digit_len, nb_id); printf("[E2 NODE]: Args %s %s \n", args.ip, args.libs_dir); - // sm_io_ag_ran_t io = init_ran_func_ag(); - // init_agent_api(mcc, mnc, mnc_digit_len, nb_id, cu_up_id, node_type, io, &args); + sm_io_ag_ran_t io = init_ran_func_ag(); + init_agent_api(mcc, mnc, mnc_digit_len, nb_id, cu_up_id, node_type, io, &args); } #endif // E2_AGENT diff --git a/openair2/E2AP/RAN_FUNCTION/CMakeLists.txt b/openair2/E2AP/RAN_FUNCTION/CMakeLists.txt index da550029e0..7c8cb59cfd 100644 --- a/openair2/E2AP/RAN_FUNCTION/CMakeLists.txt +++ b/openair2/E2AP/RAN_FUNCTION/CMakeLists.txt @@ -1,17 +1,40 @@ -add_subdirectory(CUSTOMIZED) -add_subdirectory(O-RAN) +add_library(e2_ran_func_cuup STATIC + init_ran_func.c + read_setup_ran.c + ../flexric/test/rnd/fill_rnd_data_e2_setup_req.c # this is not rnd data; it is used to fill E2 Node Component Configuration Addition List in E2 Setup Request message + CUSTOMIZED/ran_func_gtp.c # current implementation doesn't take split architecture into account, neither CU/DU nor CU-UP/CU-CP + CUSTOMIZED/ran_func_pdcp.c # current implementation doesn't take split architecture into account, neither CU/DU nor CU-UP/CU-CP + CUSTOMIZED/ran_func_tc.c # currently, not implemented; therefore, filling rnd data + ../flexric/test/rnd/fill_rnd_data_tc.c + O-RAN/ran_func_kpm.c # this file should only contain PDCP-U/GTP; to be done in the future + ../flexric/test/rnd/fill_rnd_data_kpm.c # this dependancy will be taken out once RAN Function Definition is implemented + O-RAN/ran_func_rc.c # this file should only contain PDCP-U/GTP; to be done in the future + ../flexric/test/rnd/fill_rnd_data_rc.c # this dependancy will be taken out once RAN Function Definition is implemented + ) -add_library(e2_ran_func STATIC - init_ran_func.c - read_setup_ran.c - ../flexric/test/rnd/fill_rnd_data_e2_setup_req.c - ) +target_link_libraries(e2_ran_func_cuup PUBLIC asn1_nr_rrc nr_rrc asn1_nr_rrc_hdrs e2_time_obj kpm_ric_info_common_obj 3gpp_derived_ie_obj) +target_compile_definitions(e2_ran_func_cuup PUBLIC ${E2AP_VERSION} ${KPM_VERSION} NGRAN_GNB_CUUP) -target_link_libraries(e2_ran_func - PUBLIC - e2_ran_func_cust - e2_ran_func_oran - ) -# This dependency sucks! Create pointers and forward declarations! -target_compile_definitions(e2_ran_func PRIVATE ${E2AP_VERSION} ${KPM_VERSION}) +add_library(e2_ran_func_du_cucp_cuup STATIC + init_ran_func.c + read_setup_ran.c + ../flexric/test/rnd/fill_rnd_data_e2_setup_req.c # this is not rnd data; it is used to fill E2 Node Component Configuration Addition List in E2 Setup Request message + CUSTOMIZED/ran_func_gtp.c # current implementation doesn't take split architecture into account, neither CU/DU nor CU-UP/CU-CP + CUSTOMIZED/ran_func_pdcp.c # current implementation doesn't take split architecture into account, neither CU/DU nor CU-UP/CU-CP + O-RAN/ran_func_kpm.c # this file should only contain RRC/PDCP-C; to be done in the future + # when nr-softmodem is divided in separate executables + ../flexric/test/rnd/fill_rnd_data_kpm.c # this dependancy will be taken out once RAN Function Definition is implemented + O-RAN/ran_func_rc.c # this file should only contain RRC/PDCP-C; to be done in the future + # when nr-softmodem is divided in separate executables + ../flexric/test/rnd/fill_rnd_data_rc.c # this dependancy will be taken out once RAN Function Definition is implemented + CUSTOMIZED/ran_func_mac.c + CUSTOMIZED/ran_func_rlc.c + CUSTOMIZED/ran_func_slice.c + CUSTOMIZED/ran_func_tc.c + ../flexric/test/rnd/fill_rnd_data_tc.c + ../flexric/test/rnd/fill_rnd_data_slice.c + ) + +target_link_libraries(e2_ran_func_du_cucp_cuup PUBLIC asn1_nr_rrc nr_rrc asn1_nr_rrc_hdrs e2_time_obj kpm_ric_info_common_obj 3gpp_derived_ie_obj) +target_compile_definitions(e2_ran_func_du_cucp_cuup PUBLIC ${E2AP_VERSION} ${KPM_VERSION} NGRAN_GNB_DU NGRAN_GNB_CUCP NGRAN_GNB_CUUP) diff --git a/openair2/E2AP/RAN_FUNCTION/CUSTOMIZED/CMakeLists.txt b/openair2/E2AP/RAN_FUNCTION/CUSTOMIZED/CMakeLists.txt deleted file mode 100644 index f2560ff838..0000000000 --- a/openair2/E2AP/RAN_FUNCTION/CUSTOMIZED/CMakeLists.txt +++ /dev/null @@ -1,20 +0,0 @@ -add_library(e2_ran_func_cust STATIC - ran_func_gtp.c - ran_func_mac.c - ran_func_pdcp.c - ran_func_rlc.c - ran_func_slice.c - ran_func_tc.c - # For testing purposes - ../../flexric/test/rnd/fill_rnd_data_gtp.c - ../../flexric/test/rnd/fill_rnd_data_tc.c - ../../flexric/test/rnd/fill_rnd_data_mac.c - ../../flexric/test/rnd/fill_rnd_data_rlc.c - ../../flexric/test/rnd/fill_rnd_data_pdcp.c - ../../flexric/test/rnd/fill_rnd_data_slice.c - ../../flexric/src/util/time_now_us.c - ) - -target_link_libraries(e2_ran_func_cust PUBLIC asn1_nr_rrc nr_rrc asn1_nr_rrc_hdrs) -# This dependency sucks! Create pointers and forward declarations! -target_compile_definitions(e2_ran_func_cust PRIVATE ${E2AP_VERSION} ${KPM_VERSION} ) diff --git a/openair2/E2AP/RAN_FUNCTION/CUSTOMIZED/ran_func_gtp.c b/openair2/E2AP/RAN_FUNCTION/CUSTOMIZED/ran_func_gtp.c index 6f9f776014..c1d2a0f0b7 100644 --- a/openair2/E2AP/RAN_FUNCTION/CUSTOMIZED/ran_func_gtp.c +++ b/openair2/E2AP/RAN_FUNCTION/CUSTOMIZED/ran_func_gtp.c @@ -23,15 +23,15 @@ #include -#include "openair2/E2AP/flexric/test/rnd/fill_rnd_data_gtp.h" #include "common/ran_context.h" #include "openair2/LAYER2/NR_MAC_gNB/mac_proto.h" #include "openair2/E2AP/flexric/src/util/time_now_us.h" +#include "openair2/LAYER2/nr_pdcp/nr_pdcp_oai_api.h" + + +#if defined (NGRAN_GNB_CUCP) #include "openair2/RRC/NR/rrc_gNB_UE_context.h" - - -static -const int mod_id = 0; +#endif bool read_gtp_sm(void * data) { @@ -42,45 +42,46 @@ bool read_gtp_sm(void * data) gtp->msg.tstamp = time_now_us(); - NR_UEs_t *UE_info = &RC.nrmac[mod_id]->UE_info; - size_t num_ues = 0; - UE_iterator(UE_info->list, ue) { - if (ue) - num_ues += 1; - } - + uint64_t ue_id_list[MAX_MOBILES_PER_GNB]; + size_t num_ues = nr_pdcp_get_num_ues(ue_id_list, MAX_MOBILES_PER_GNB); + gtp->msg.len = num_ues; if(gtp->msg.len > 0){ gtp->msg.ngut = calloc(gtp->msg.len, sizeof(gtp_ngu_t_stats_t) ); assert(gtp->msg.ngut != NULL); } - - size_t i = 0; - UE_iterator(UE_info->list, UE) - { - uint16_t const rnti = UE->rnti; - struct rrc_gNB_ue_context_s *ue_context_p = rrc_gNB_get_ue_context_by_rnti_any_du(RC.nrrrc[mod_id], rnti); - if (ue_context_p != NULL) { - gtp->msg.ngut[i].rnti = ue_context_p->ue_context.rnti; - int nb_pdu_session = ue_context_p->ue_context.nb_of_pdusessions; - if (nb_pdu_session > 0) { - int nb_pdu_idx = nb_pdu_session - 1; - gtp->msg.ngut[i].teidgnb = ue_context_p->ue_context.pduSession[nb_pdu_idx].param.gNB_teid_N3; - gtp->msg.ngut[i].teidupf = ue_context_p->ue_context.pduSession[nb_pdu_idx].param.UPF_teid_N3; - // TODO: one PDU session has multiple QoS Flow - int nb_qos_flow = ue_context_p->ue_context.pduSession[nb_pdu_idx].param.nb_qos; - if (nb_qos_flow > 0) { - gtp->msg.ngut[i].qfi = ue_context_p->ue_context.pduSession[nb_pdu_idx].param.qos[nb_qos_flow - 1].qfi; - } - } - } else { - LOG_W(NR_RRC,"rrc_gNB_get_ue_context return NULL\n"); - // if (gtp->msg.ngut != NULL) free(gtp->msg.ngut); - } - i++; + else { + return false; } - return num_ues > 0; + #if defined (NGRAN_GNB_CUCP) && defined (NGRAN_GNB_CUUP) + if (RC.nrrrc[0]->node_type == ngran_gNB_DU || RC.nrrrc[0]->node_type == ngran_gNB_CUCP) return false; + assert((RC.nrrrc[0]->node_type == ngran_gNB_CU || RC.nrrrc[0]->node_type == ngran_gNB) && "Expected node types: CU or gNB-mono"); + + for (size_t i = 0; i < num_ues; i++) { + rrc_gNB_ue_context_t *ue_context_p = rrc_gNB_get_ue_context(RC.nrrrc[0], ue_id_list[i]); + + gtp->msg.ngut[i].rnti = ue_id_list[i]; + int nb_pdu_session = ue_context_p->ue_context.nb_of_pdusessions; + if (nb_pdu_session > 0) { + int nb_pdu_idx = nb_pdu_session - 1; + gtp->msg.ngut[i].teidgnb = ue_context_p->ue_context.pduSession[nb_pdu_idx].param.gNB_teid_N3; + gtp->msg.ngut[i].teidupf = ue_context_p->ue_context.pduSession[nb_pdu_idx].param.UPF_teid_N3; + // TODO: one PDU session has multiple QoS Flow + int nb_qos_flow = ue_context_p->ue_context.pduSession[nb_pdu_idx].param.nb_qos; + if (nb_qos_flow > 0) { + gtp->msg.ngut[i].qfi = ue_context_p->ue_context.pduSession[nb_pdu_idx].param.qos[nb_qos_flow - 1].qfi; + } + } + } + + return true; + + #elif defined (NGRAN_GNB_CUUP) + // For the moment, CU-UP doesn't store PDU session information + printf("GTP SM not yet implemented in CU-UP\n"); + return false; + #endif } void read_gtp_setup_sm(void* data) diff --git a/openair2/E2AP/RAN_FUNCTION/CUSTOMIZED/ran_func_mac.c b/openair2/E2AP/RAN_FUNCTION/CUSTOMIZED/ran_func_mac.c index 7619b0877b..f6a152627c 100644 --- a/openair2/E2AP/RAN_FUNCTION/CUSTOMIZED/ran_func_mac.c +++ b/openair2/E2AP/RAN_FUNCTION/CUSTOMIZED/ran_func_mac.c @@ -20,7 +20,6 @@ */ #include "ran_func_mac.h" -#include "openair2/E2AP/flexric/test/rnd/fill_rnd_data_mac.h" #include static diff --git a/openair2/E2AP/RAN_FUNCTION/CUSTOMIZED/ran_func_pdcp.c b/openair2/E2AP/RAN_FUNCTION/CUSTOMIZED/ran_func_pdcp.c index f123d67257..6c8c1268a7 100644 --- a/openair2/E2AP/RAN_FUNCTION/CUSTOMIZED/ran_func_pdcp.c +++ b/openair2/E2AP/RAN_FUNCTION/CUSTOMIZED/ran_func_pdcp.c @@ -19,41 +19,64 @@ * contact@openairinterface.org */ -#include "ran_func_pdcp.h" - #include #include #include -#include "openair2/E2AP/flexric/test/rnd/fill_rnd_data_pdcp.h" +#include "ran_func_pdcp.h" #include "common/ran_context.h" -#include "openair2/RRC/NR/rrc_gNB_UE_context.h" -#include "openair2/LAYER2/nr_pdcp/nr_pdcp_oai_api.h" -#include "openair2/LAYER2/nr_rlc/nr_rlc_oai_api.h" -#include "openair2/LAYER2/NR_MAC_gNB/mac_proto.h" #include "openair2/E2AP/flexric/src/util/time_now_us.h" +#if defined (NGRAN_GNB_DU) +#include "openair2/LAYER2/NR_MAC_gNB/mac_proto.h" +#include "openair2/LAYER2/nr_rlc/nr_rlc_oai_api.h" +#endif -static -const int mod_id = 0; +#if defined (NGRAN_GNB_CUCP) +#include "openair2/RRC/NR/rrc_gNB_UE_context.h" +#endif -static - uint32_t num_act_rb(NR_UEs_t* UE_info) +#if defined (NGRAN_GNB_CUUP) +#include "openair2/LAYER2/nr_pdcp/nr_pdcp_oai_api.h" +#endif + +#if defined (NGRAN_GNB_CUUP) +void fill_pdcp_stats_for_all_rbs(pdcp_radio_bearer_stats_t* rb, const size_t num_ues, const uint64_t* ue_id_list) { - assert(UE_info!= NULL); + size_t j = 0; + for (size_t i = 0; i < num_ues; i++) { + for (int rb_id = 1; rb_id < 6; ++rb_id) { + nr_pdcp_statistics_t rb_pdcp = {0}; - uint32_t act_rb = 0; - UE_iterator(UE_info->list, UE) { - uint16_t const rnti = UE->rnti; - for(int rb_id = 1; rb_id < 6; ++rb_id ){ - nr_rlc_statistics_t rlc = {0}; const int srb_flag = 0; - const bool rc = nr_rlc_get_statistics(rnti, srb_flag, rb_id, &rlc); - if(rc) ++act_rb; + const bool rc = nr_pdcp_get_statistics(ue_id_list[i], srb_flag, rb_id, &rb_pdcp); + + if (!rc) continue; + + pdcp_radio_bearer_stats_t *rd = &rb[j++]; + + rd->txpdu_pkts = rb_pdcp.txpdu_pkts; /* aggregated number of tx packets */ + rd->txpdu_bytes = rb_pdcp.txpdu_bytes; /* aggregated bytes of tx packets */ + rd->txpdu_sn = rb_pdcp.txpdu_sn; /* current sequence number of last tx packet (or TX_NEXT) */ + rd->rxpdu_pkts = rb_pdcp.rxpdu_pkts; /* aggregated number of rx packets */ + rd->rxpdu_bytes = rb_pdcp.rxpdu_bytes; /* aggregated bytes of rx packets */ + rd->rxpdu_sn = rb_pdcp.rxpdu_sn; /* current sequence number of last rx packet (or RX_NEXT) */ + rd->rxpdu_oo_pkts = rb_pdcp.rxpdu_oo_pkts; /* aggregated number of out-of-order rx pkts (or RX_REORD) */ + rd->rxpdu_oo_bytes = rb_pdcp.rxpdu_oo_bytes; /* aggregated amount of out-of-order rx bytes */ + rd->rxpdu_dd_pkts = rb_pdcp.rxpdu_dd_pkts; /* aggregated number of duplicated discarded packets (or dropped packets because of other reasons such as integrity failure) (or RX_DELIV) */ + rd->rxpdu_dd_bytes = rb_pdcp.rxpdu_dd_bytes; /* aggregated amount of discarded packets' bytes */ + rd->rxpdu_ro_count = rb_pdcp.rxpdu_ro_count; /* this state variable indicates the COUNT value following the COUNT value associated with the PDCP Data PDU which triggered t-Reordering. (RX_REORD) */ + rd->txsdu_pkts = rb_pdcp.txsdu_pkts; /* number of SDUs delivered */ + rd->txsdu_bytes = rb_pdcp.txsdu_bytes; /* number of bytes of SDUs delivered */ + rd->rxsdu_pkts = rb_pdcp.rxsdu_pkts; /* number of SDUs received */ + rd->rxsdu_bytes = rb_pdcp.rxsdu_bytes; /* number of bytes of SDUs received */ + rd->rnti = ue_id_list[i]; + rd->mode = rb_pdcp.mode; /* 0: PDCP AM, 1: PDCP UM, 2: PDCP TM */ + rd->rbid = rb_id; } } - return act_rb; } +#endif bool read_pdcp_sm(void* data) { @@ -61,127 +84,60 @@ bool read_pdcp_sm(void* data) //assert(data->type == PDCP_STATS_V0); pdcp_ind_data_t* pdcp = (pdcp_ind_data_t*)data; - //fill_pdcp_ind_data(pdcp); - // TODO: Need to improve, not good - if (NODE_IS_CU(RC.nrrrc[mod_id]->node_type)) { - uint32_t act_rb = 0; - struct rrc_gNB_ue_context_s *ue_context_p1 = NULL; - RB_FOREACH(ue_context_p1, rrc_nr_ue_tree_s, &RC.nrrrc[mod_id]->rrc_ue_head) { - uint16_t const rnti = ue_context_p1->ue_context.rnti; - for(int rb_id = 1; rb_id < 6; ++rb_id ){ - nr_pdcp_statistics_t rb_pdcp = {0}; - const int srb_flag = 0; - const bool rc = nr_pdcp_get_statistics(rnti, srb_flag, rb_id, &rb_pdcp); - if(rc) ++act_rb; - } + pdcp->msg.tstamp = time_now_us(); + + size_t num_ues = 0; + uint64_t ue_id_list[MAX_MOBILES_PER_GNB]; + size_t total_num_rb = 0; + + #if defined (NGRAN_GNB_CUCP) && defined (NGRAN_GNB_CUUP) + if (RC.nrrrc[0]->node_type == ngran_gNB_DU || RC.nrrrc[0]->node_type == ngran_gNB_CUCP) return false; + assert((RC.nrrrc[0]->node_type == ngran_gNB_CU || RC.nrrrc[0]->node_type == ngran_gNB) && "Expected node types: CU or gNB-mono"); + + struct rrc_gNB_ue_context_s *ue_context_p = NULL; + RB_FOREACH(ue_context_p, rrc_nr_ue_tree_s, &RC.nrrrc[0]->rrc_ue_head) { + ue_id_list[num_ues] = ue_context_p->ue_context.rrc_ue_id; + + for(int rb_id = 1; rb_id < 6; ++rb_id ){ + nr_pdcp_statistics_t rb_pdcp = {0}; + const int srb_flag = 0; + const bool rc = nr_pdcp_get_statistics(ue_id_list[num_ues], srb_flag, rb_id, &rb_pdcp); + if(rc) ++total_num_rb; } + num_ues++; - pdcp->msg.tstamp = time_now_us(); - - pdcp->msg.len = act_rb; - if (pdcp->msg.len > 0) { - pdcp->msg.rb = calloc(pdcp->msg.len, sizeof(pdcp_radio_bearer_stats_t)); - assert(pdcp->msg.rb != NULL && "Memory exhausted!"); - } - - size_t i = 0; - struct rrc_gNB_ue_context_s *ue_context_p2 = NULL; - RB_FOREACH(ue_context_p2, rrc_nr_ue_tree_s, &RC.nrrrc[mod_id]->rrc_ue_head) { - // TODO: Need to handel multiple UEs - uint16_t const rnti = ue_context_p2->ue_context.rnti; - - for (size_t rb_id = 1; rb_id < 6; ++rb_id) { - nr_pdcp_statistics_t rb_pdcp = {0}; - - const int srb_flag = 0; - const bool rc = nr_pdcp_get_statistics(rnti, srb_flag, rb_id, &rb_pdcp); - - if (!rc) continue; - - pdcp_radio_bearer_stats_t *rd = &pdcp->msg.rb[i]; - - rd->txpdu_pkts = rb_pdcp.txpdu_pkts; /* aggregated number of tx packets */ - rd->txpdu_bytes = rb_pdcp.txpdu_bytes; /* aggregated bytes of tx packets */ - rd->txpdu_sn = rb_pdcp.txpdu_sn; /* current sequence number of last tx packet (or TX_NEXT) */ - rd->rxpdu_pkts = rb_pdcp.rxpdu_pkts; /* aggregated number of rx packets */ - rd->rxpdu_bytes = rb_pdcp.rxpdu_bytes; /* aggregated bytes of rx packets */ - rd->rxpdu_sn = rb_pdcp.rxpdu_sn; /* current sequence number of last rx packet (or RX_NEXT) */ - rd->rxpdu_oo_pkts = rb_pdcp.rxpdu_oo_pkts; /* aggregated number of out-of-order rx pkts (or RX_REORD) */ - rd->rxpdu_oo_bytes = rb_pdcp.rxpdu_oo_bytes; /* aggregated amount of out-of-order rx bytes */ - rd->rxpdu_dd_pkts = rb_pdcp.rxpdu_dd_pkts; /* aggregated number of duplicated discarded packets (or dropped packets because of other reasons such as integrity failure) (or RX_DELIV) */ - rd->rxpdu_dd_bytes = rb_pdcp.rxpdu_dd_bytes; /* aggregated amount of discarded packets' bytes */ - rd->rxpdu_ro_count = rb_pdcp.rxpdu_ro_count; /* this state variable indicates the COUNT value following the COUNT value associated with the PDCP Data PDU which triggered t-Reordering. (RX_REORD) */ - rd->txsdu_pkts = rb_pdcp.txsdu_pkts; /* number of SDUs delivered */ - rd->txsdu_bytes = rb_pdcp.txsdu_bytes; /* number of bytes of SDUs delivered */ - rd->rxsdu_pkts = rb_pdcp.rxsdu_pkts; /* number of SDUs received */ - rd->rxsdu_bytes = rb_pdcp.rxsdu_bytes; /* number of bytes of SDUs received */ - rd->rnti = rnti; - rd->mode = rb_pdcp.mode; /* 0: PDCP AM, 1: PDCP UM, 2: PDCP TM */ - rd->rbid = rb_id; - - ++i; - } - } - - return act_rb > 0; - - } else { - - //assert(0!=0 && "Calling PDCP"); - // for the moment and while we don't have a split base station, we use the - // MAC structures to obtain the RNTIs which we use to query the PDCP - NR_UEs_t *UE_info = &RC.nrmac[mod_id]->UE_info; - uint32_t const act_rb = num_act_rb(UE_info); - - pdcp->msg.tstamp = time_now_us(); - - pdcp->msg.len = act_rb; - if (pdcp->msg.len > 0) { - pdcp->msg.rb = calloc(pdcp->msg.len, sizeof(pdcp_radio_bearer_stats_t)); - assert(pdcp->msg.rb != NULL && "Memory exhausted!"); - } - - size_t i = 0; - UE_iterator(UE_info->list, UE) - { - - const int rnti = UE->rnti; - for (size_t rb_id = 1; rb_id < 6; ++rb_id) { - nr_pdcp_statistics_t rb_pdcp = {0}; - - const int srb_flag = 0; - const bool rc = nr_pdcp_get_statistics(rnti, srb_flag, rb_id, &rb_pdcp); - - if (!rc) continue; - - pdcp_radio_bearer_stats_t *rd = &pdcp->msg.rb[i]; - - rd->txpdu_pkts = rb_pdcp.txpdu_pkts; /* aggregated number of tx packets */ - rd->txpdu_bytes = rb_pdcp.txpdu_bytes; /* aggregated bytes of tx packets */ - rd->txpdu_sn = rb_pdcp.txpdu_sn; /* current sequence number of last tx packet (or TX_NEXT) */ - rd->rxpdu_pkts = rb_pdcp.rxpdu_pkts; /* aggregated number of rx packets */ - rd->rxpdu_bytes = rb_pdcp.rxpdu_bytes; /* aggregated bytes of rx packets */ - rd->rxpdu_sn = rb_pdcp.rxpdu_sn; /* current sequence number of last rx packet (or RX_NEXT) */ - rd->rxpdu_oo_pkts = rb_pdcp.rxpdu_oo_pkts; /* aggregated number of out-of-order rx pkts (or RX_REORD) */ - rd->rxpdu_oo_bytes = rb_pdcp.rxpdu_oo_bytes; /* aggregated amount of out-of-order rx bytes */ - rd->rxpdu_dd_pkts = rb_pdcp.rxpdu_dd_pkts; /* aggregated number of duplicated discarded packets (or dropped packets because of other reasons such as integrity failure) (or RX_DELIV) */ - rd->rxpdu_dd_bytes = rb_pdcp.rxpdu_dd_bytes; /* aggregated amount of discarded packets' bytes */ - rd->rxpdu_ro_count = rb_pdcp.rxpdu_ro_count; /* this state variable indicates the COUNT value following the COUNT value associated with the PDCP Data PDU which triggered t-Reordering. (RX_REORD) */ - rd->txsdu_pkts = rb_pdcp.txsdu_pkts; /* number of SDUs delivered */ - rd->txsdu_bytes = rb_pdcp.txsdu_bytes; /* number of bytes of SDUs delivered */ - rd->rxsdu_pkts = rb_pdcp.rxsdu_pkts; /* number of SDUs received */ - rd->rxsdu_bytes = rb_pdcp.rxsdu_bytes; /* number of bytes of SDUs received */ - rd->rnti = rnti; - rd->mode = rb_pdcp.mode; /* 0: PDCP AM, 1: PDCP UM, 2: PDCP TM */ - rd->rbid = rb_id; - - ++i; - } - } - - return act_rb > 0; + AssertFatal(num_ues < MAX_MOBILES_PER_GNB, "cannot have more UEs than global UE number maximum\n"); } + + #elif defined (NGRAN_GNB_CUUP) + num_ues = nr_pdcp_get_num_ues(ue_id_list, MAX_MOBILES_PER_GNB); + for (size_t i = 0; i < num_ues; i++) { + for(int rb_id = 1; rb_id < 6; ++rb_id ){ + nr_pdcp_statistics_t rb_pdcp = {0}; + const int srb_flag = 0; + const bool rc = nr_pdcp_get_statistics(ue_id_list[i], srb_flag, rb_id, &rb_pdcp); + if(rc) ++total_num_rb; + } + } + + #endif + + pdcp->msg.len = total_num_rb; + if (pdcp->msg.len > 0) { + pdcp->msg.rb = calloc(pdcp->msg.len, sizeof(pdcp_radio_bearer_stats_t)); + assert(pdcp->msg.rb != NULL && "Memory exhausted!"); + + // Filling Radio Bearer Statistics + #if defined (NGRAN_GNB_CUUP) + fill_pdcp_stats_for_all_rbs(pdcp->msg.rb, num_ues, ue_id_list); + #endif + return true; + } + else { + return false; + } + } void read_pdcp_setup_sm(void* data) @@ -200,5 +156,3 @@ sm_ag_if_ans_t write_ctrl_pdcp_sm(void const* data) sm_ag_if_ans_t ans = {0}; return ans; } - - diff --git a/openair2/E2AP/RAN_FUNCTION/CUSTOMIZED/ran_func_rlc.c b/openair2/E2AP/RAN_FUNCTION/CUSTOMIZED/ran_func_rlc.c index 0e6359e9fa..d78c103fbf 100644 --- a/openair2/E2AP/RAN_FUNCTION/CUSTOMIZED/ran_func_rlc.c +++ b/openair2/E2AP/RAN_FUNCTION/CUSTOMIZED/ran_func_rlc.c @@ -28,7 +28,6 @@ #include "openair2/LAYER2/NR_MAC_gNB/mac_proto.h" #include "openair2/LAYER2/nr_rlc/nr_rlc_oai_api.h" #include "openair2/E2AP/flexric/src/util/time_now_us.h" -#include "openair2/E2AP/flexric/test/rnd/fill_rnd_data_rlc.h" static const int mod_id = 0; diff --git a/openair2/E2AP/RAN_FUNCTION/O-RAN/CMakeLists.txt b/openair2/E2AP/RAN_FUNCTION/O-RAN/CMakeLists.txt deleted file mode 100644 index 3a1c042785..0000000000 --- a/openair2/E2AP/RAN_FUNCTION/O-RAN/CMakeLists.txt +++ /dev/null @@ -1,10 +0,0 @@ -add_library(e2_ran_func_oran STATIC - ran_func_kpm.c - ran_func_rc.c - # For testing purposes - ../../flexric/test/rnd/fill_rnd_data_kpm.c - ../../flexric/test/rnd/fill_rnd_data_rc.c - ) - -target_link_libraries(e2_ran_func_oran PUBLIC asn1_nr_rrc nr_rrc asn1_nr_rrc_hdrs) -target_compile_definitions(e2_ran_func_oran PRIVATE ${E2AP_VERSION} ${KPM_VERSION}) diff --git a/openair2/E2AP/RAN_FUNCTION/O-RAN/ran_func_kpm.c b/openair2/E2AP/RAN_FUNCTION/O-RAN/ran_func_kpm.c index d56d39542b..357a82b277 100644 --- a/openair2/E2AP/RAN_FUNCTION/O-RAN/ran_func_kpm.c +++ b/openair2/E2AP/RAN_FUNCTION/O-RAN/ran_func_kpm.c @@ -20,24 +20,39 @@ */ #include "ran_func_kpm.h" -#include "openair2/E2AP/flexric/test/rnd/fill_rnd_data_kpm.h" +#include "openair2/E2AP/flexric/test/rnd/fill_rnd_data_kpm.h" // this dependancy will be taken out once RAN Function Definition is implemented #include "openair2/E2AP/flexric/src/util/time_now_us.h" +#include "common/utils/assertions.h" + +#if defined (NGRAN_GNB_DU) #include "openair2/LAYER2/NR_MAC_gNB/nr_mac_gNB.h" -#include "openair2/RRC/NR/rrc_gNB_UE_context.h" -#include "openair3/NGAP/ngap_gNB_ue_context.h" -#include "openair2/LAYER2/nr_pdcp/nr_pdcp_entity.h" #include "openair2/LAYER2/nr_rlc/nr_rlc_entity.h" #include "openair2/LAYER2/nr_rlc/nr_rlc_oai_api.h" +#endif + +#if defined (NGRAN_GNB_CUCP) +#include "openair2/RRC/NR/rrc_gNB_UE_context.h" +#include "openair3/NGAP/ngap_gNB_ue_context.h" +#endif + +#if defined (NGRAN_GNB_CUUP) +#include "openair2/LAYER2/nr_pdcp/nr_pdcp_entity.h" #include "openair2/LAYER2/nr_pdcp/nr_pdcp_oai_api.h" +#include "openair2/E1AP/e1ap_common.h" +#endif + #include "openair2/F1AP/f1ap_ids.h" #include #include +/* Please note that only one executable nr-softmodem exists for DU, CU, CU-CP and gNB-mono nodes; + the layer separation should be done better in the future */ -typedef struct { - NR_UE_info_t* ue_list[MAX_MOBILES_PER_GNB]; - size_t num_ues; -} matched_ues_mac_t; +#if defined (NGRAN_GNB_CUUP) +typedef struct uldlcounter { + uint32_t dl; + uint32_t ul; +} uldlcounter_t; static bool nssai_matches(nssai_t a_nssai, uint8_t b_sst, const uint32_t *b_sd) { @@ -49,6 +64,231 @@ static bool nssai_matches(nssai_t a_nssai, uint8_t b_sst, const uint32_t *b_sd) } } +static uldlcounter_t last_pdcp_sdu_total_bytes[MAX_MOBILES_PER_GNB] = {0}; + +static gnb_cu_up_e2sm_t fill_gnb_cu_up_data(const ue_id_t cucp_ue_id) +{ + gnb_cu_up_e2sm_t gnb_cu_up = {0}; + + // 6.2.3.20 + // Mandatory + gnb_cu_up.gnb_cu_cp_ue_e1ap = cucp_ue_id; + + // 6.2.3.25 + // RAN UE ID + // Optional + gnb_cu_up.ran_ue_id = NULL; + + return gnb_cu_up; +} + +typedef struct { + ue_id_t pdcp_ue_id_list[MAX_MOBILES_PER_GNB]; // list of matched UEs on PDCP-U level + size_t num_ues; + +} matched_ues_pdcp_t; + + __attribute__((unused)) +static size_t filter_ues_by_s_nssai_in_cuup(test_cond_e const condition, uint8_t sst, const uint32_t *sd, matched_ues_pdcp_t* matches) +{ + DevAssert(matches != NULL); + AssertFatal(condition == EQUAL_TEST_COND, "Condition %d not yet implemented\n", condition); + + // Get NSSAI info from E1 context + const instance_t CUuniqInstance = 0; + const e1ap_upcp_inst_t *e1inst = getCxtE1(CUuniqInstance); + + // currently the CU-UP does not store the slices, so we can only do this "coarse filtering" + for(int s = 0; s < e1inst->cuup.setupReq.plmn[0].supported_slices; s++) { + if (nssai_matches(e1inst->cuup.setupReq.plmn[0].slice[s], sst, sd)) { + matches->num_ues = nr_pdcp_get_num_ues(matches->pdcp_ue_id_list, MAX_MOBILES_PER_GNB); + } + } + + return matches->num_ues; +} + +static nr_pdcp_statistics_t get_pdcp_stats_per_drb(const uint32_t rrc_ue_id) +{ + nr_pdcp_statistics_t pdcp = {0}; + const int srb_flag = 0; + const int rb_id = 1; // at the moment, only 1 DRB is supported + + // Get PDCP stats for specific DRB + const bool rc = nr_pdcp_get_statistics(rrc_ue_id, srb_flag, rb_id, &pdcp); + assert(rc == true && "Cannot get PDCP stats\n"); + + return pdcp; +} + +static meas_record_lst_t fill_ue_pdcp_data(const uint32_t rrc_ue_id, const size_t ue_idx, const char * meas_info_name_str) +{ + meas_record_lst_t meas_record = {0}; + + // Get PDCP stats per DRB + nr_pdcp_statistics_t pdcp = get_pdcp_stats_per_drb(rrc_ue_id); + + // Measurement Type as requested in Action Definition + if (strcmp(meas_info_name_str, "DRB.PdcpSduVolumeDL") == 0) { // 3GPP TS 28.522 - section 5.1.2.1.1.1 + meas_record.value = INTEGER_MEAS_VALUE; + + // Get DL data volume delivered to PDCP layer + meas_record.int_val = (pdcp.rxsdu_bytes - last_pdcp_sdu_total_bytes[ue_idx].dl)*8/1000; // [kb] + last_pdcp_sdu_total_bytes[ue_idx].dl = pdcp.rxsdu_bytes; + /* note: this measurement is calculated as per spec */ + } else if (strcmp(meas_info_name_str, "DRB.PdcpSduVolumeUL") == 0) { // 3GPP TS 28.522 - section 5.1.2.1.2.1 + meas_record.value = INTEGER_MEAS_VALUE; + + // Get UL data volume delivered from PDCP layer + meas_record.int_val = (pdcp.txsdu_bytes - last_pdcp_sdu_total_bytes[ue_idx].ul)*8/1000; // [kb] + last_pdcp_sdu_total_bytes[ue_idx].ul = pdcp.txsdu_bytes; + /* note: this measurement is calculated as per spec */ + } else { + assert(false && "Measurement Name not yet implemented"); + } + + + return meas_record; +} + +static kpm_ind_msg_format_1_t fill_kpm_ind_msg_frm_1_in_cu(const uint32_t rrc_ue_id, const size_t ue_idx, const kpm_act_def_format_1_t * act_def_fr_1) +{ + kpm_ind_msg_format_1_t msg_frm_1 = {0}; + + // Measurement Data contains a set of Meas Records, each collected at each granularity period + msg_frm_1.meas_data_lst_len = 1; /* this value is equal to (kpm_ric_event_trigger_format_1.report_period_ms/act_def_fr_1->gran_period_ms) + please, check their values in xApp */ + + msg_frm_1.meas_data_lst = calloc(msg_frm_1.meas_data_lst_len, sizeof(*msg_frm_1.meas_data_lst)); + assert(msg_frm_1.meas_data_lst != NULL && "Memory exhausted" ); + + for (size_t i = 0; imeas_info_lst_len; // record data list length corresponds to info list length from action definition + + msg_frm_1.meas_data_lst[i].meas_record_lst = calloc(msg_frm_1.meas_data_lst[i].meas_record_len, sizeof(meas_record_lst_t)); + assert(msg_frm_1.meas_data_lst[i].meas_record_lst != NULL && "Memory exhausted"); + + for (size_t j = 0; j < msg_frm_1.meas_data_lst[i].meas_record_len; j++) { // each meas record corresponds to one meas type + // Measurement Type as requested in Action Definition + switch (act_def_fr_1->meas_info_lst[j].meas_type.type) { + case NAME_MEAS_TYPE: { + char meas_info_name_str[act_def_fr_1->meas_info_lst[j].meas_type.name.len + 1]; + memcpy(meas_info_name_str, act_def_fr_1->meas_info_lst[j].meas_type.name.buf, act_def_fr_1->meas_info_lst[j].meas_type.name.len); + meas_info_name_str[act_def_fr_1->meas_info_lst[j].meas_type.name.len] = '\0'; + + msg_frm_1.meas_data_lst[i].meas_record_lst[j] = fill_ue_pdcp_data(rrc_ue_id, ue_idx, meas_info_name_str); + break; + } + case ID_MEAS_TYPE: + assert(false && "ID Measurement Type not yet implemented"); + + default: + assert(false && "Measurement Type not recognized"); + } + } + } + + // Measurement Information - OPTIONAL + msg_frm_1.meas_info_lst_len = act_def_fr_1->meas_info_lst_len; + msg_frm_1.meas_info_lst = calloc(msg_frm_1.meas_info_lst_len, sizeof(meas_info_format_1_lst_t)); + assert(msg_frm_1.meas_info_lst != NULL && "Memory exhausted"); + for (size_t i = 0; i < msg_frm_1.meas_info_lst_len; i++) { + msg_frm_1.meas_info_lst[i] = cp_meas_info_format_1_lst(&act_def_fr_1->meas_info_lst[i]); + } + + return msg_frm_1; +} + + __attribute__((unused)) +static kpm_ind_msg_format_3_t fill_kpm_ind_msg_frm_3_in_cuup(const matched_ues_pdcp_t* matched_ues, + const kpm_act_def_format_1_t* act_def_fr_1) +{ + assert(act_def_fr_1 != NULL); + + kpm_ind_msg_format_3_t msg_frm_3 = {0}; + + // Fill UE Measurement Reports + + msg_frm_3.ue_meas_report_lst_len = matched_ues->num_ues; + msg_frm_3.meas_report_per_ue = calloc(msg_frm_3.ue_meas_report_lst_len, sizeof(meas_report_per_ue_t)); + assert(msg_frm_3.meas_report_per_ue != NULL && "Memory exhausted"); + + for (size_t i = 0; ipdcp_ue_id_list[i]); + + // Fill UE related info + msg_frm_3.meas_report_per_ue[i].ind_msg_format_1 = + fill_kpm_ind_msg_frm_1_in_cu(matched_ues->pdcp_ue_id_list[i], i, act_def_fr_1); + } + + return msg_frm_3; +} +#endif + +#if defined (NGRAN_GNB_DU) +static uldlcounter_t last_rlc_pdu_total_bytes[MAX_MOBILES_PER_GNB] = {0}; +static uldlcounter_t last_total_prbs[MAX_MOBILES_PER_GNB] = {0}; + +static gnb_e2sm_t fill_gnb_data(rrc_gNB_ue_context_t * ue_context_p) +{ + gnb_e2sm_t gnb = {0}; + + // 6.2.3.16 + // Mandatory + // AMF UE NGAP ID + gnb.amf_ue_ngap_id = ue_context_p->ue_context.rrc_ue_id; + + // Mandatory + //GUAMI 6.2.3.17 + gnb.guami.plmn_id = (e2sm_plmn_t) { + .mcc = ue_context_p->ue_context.ue_guami.mcc, + .mnc = ue_context_p->ue_context.ue_guami.mnc, + .mnc_digit_len = ue_context_p->ue_context.ue_guami.mnc_len + }; + + gnb.guami.amf_region_id = ue_context_p->ue_context.ue_guami.amf_region_id; + gnb.guami.amf_set_id = ue_context_p->ue_context.ue_guami.amf_set_id; + gnb.guami.amf_ptr = ue_context_p->ue_context.ue_guami.amf_pointer; + + // gNB-CU UE F1AP ID List + // C-ifCUDUseparated + if (NODE_IS_CU(RC.nrrrc[0]->node_type)) { + gnb.gnb_cu_ue_f1ap_lst_len = 1; + gnb.gnb_cu_ue_f1ap_lst = calloc(gnb.gnb_cu_ue_f1ap_lst_len, sizeof(uint32_t)); + assert(gnb.gnb_cu_ue_f1ap_lst != NULL); + + for (size_t i = 0; i < gnb.gnb_cu_ue_f1ap_lst_len; i++) { + gnb.gnb_cu_ue_f1ap_lst[i] = ue_context_p->ue_context.rrc_ue_id; + } + } + + return gnb; +} + +static gnb_du_e2sm_t fill_gnb_du_data(const f1_ue_data_t * rrc_ue_id) +{ + gnb_du_e2sm_t gnb_du = {0}; + + // 6.2.3.21 + // gNB CU UE F1AP + // Mandatory + gnb_du.gnb_cu_ue_f1ap = rrc_ue_id->secondary_ue; + + // 6.2.3.25 + // RAN UE ID + // Optional + gnb_du.ran_ue_id = NULL; + + return gnb_du; +} +typedef struct { + NR_UE_info_t* ue_list[MAX_MOBILES_PER_GNB]; + size_t num_ues; +} matched_ues_mac_t; + static size_t filter_ues_by_s_nssai_in_du_or_monolithic(test_cond_e const condition, uint8_t sst, const uint32_t *sd, @@ -77,7 +317,241 @@ static size_t filter_ues_by_s_nssai_in_du_or_monolithic(test_cond_e const condit return i; } +static nr_rlc_statistics_t get_rlc_stats_per_drb(NR_UE_info_t const * UE) +{ + assert(UE != NULL); + nr_rlc_statistics_t rlc = {0}; + const int srb_flag = 0; + const int rb_id = 1; // at the moment, only 1 DRB is supported + + // Get RLC stats for specific DRB + const bool rc = nr_rlc_get_statistics(UE->rnti, srb_flag, rb_id, &rlc); + assert(rc == true && "Cannot get RLC stats\n"); + + // Activate average sojourn time at the RLC buffer for specific DRB + nr_rlc_activate_avg_time_to_tx(UE->rnti, rb_id+3, 1); + + return rlc; +} + +static meas_record_lst_t fill_ue_mac_rlc_data(const NR_UE_info_t* UE, const size_t ue_idx, const char * meas_info_name_str, const uint32_t gran_period_ms) +{ + assert(UE != NULL); + + meas_record_lst_t meas_record = {0}; + + // Get RLC stats per DRB + nr_rlc_statistics_t rlc = get_rlc_stats_per_drb(UE); + + // Measurement Type as requested in Action Definition + if (strcmp(meas_info_name_str, "DRB.UEThpDl") == 0) { // 3GPP TS 28.522 - section 5.1.1.3.1 + meas_record.value = REAL_MEAS_VALUE; + + // Calculate DL Thp + meas_record.real_val = (double)(rlc.txpdu_bytes - last_rlc_pdu_total_bytes[ue_idx].dl)*8/gran_period_ms; // [kbps] + last_rlc_pdu_total_bytes[ue_idx].dl = rlc.txpdu_bytes; + /* note: per spec, average UE throughput in DL (taken into consideration values from all UEs, and averaged) + here calculated as: UE specific throughput in DL */ + } else if (strcmp(meas_info_name_str, "DRB.UEThpUl") == 0) { // 3GPP TS 28.522 - section 5.1.1.3.3 + meas_record.value = REAL_MEAS_VALUE; + + // Calculate UL Thp + meas_record.real_val = (double)(rlc.rxpdu_bytes - last_rlc_pdu_total_bytes[ue_idx].ul)*8/gran_period_ms; // [kbps] + last_rlc_pdu_total_bytes[ue_idx].ul = rlc.rxpdu_bytes; + /* note: per spec, average UE throughput in UL (taken into consideration values from all UEs, and averaged) + here calculated as: UE specific throughput in UL */ + } else if (strcmp(meas_info_name_str, "DRB.RlcSduDelayDl") == 0) { // 3GPP TS 28.522 - section 5.1.3.3.3 + meas_record.value = REAL_MEAS_VALUE; + + // Get the value of sojourn time at the RLC buffer + meas_record.real_val = rlc.txsdu_avg_time_to_tx; // [μs] + /* note: by default this measurement is calculated for previous 100ms (openair2/LAYER2/nr_rlc/nr_rlc_entity.c:118, 173, 213); please, update according to your needs */ + } else if (strcmp(meas_info_name_str, "RRU.PrbTotDl") == 0) { // 3GPP TS 28.522 - section 5.1.1.2.1 + meas_record.value = INTEGER_MEAS_VALUE; + + // Get the number of DL PRBs + meas_record.int_val = UE->mac_stats.dl.total_rbs - last_total_prbs[ue_idx].dl; // [PRBs] + last_total_prbs[ue_idx].dl = UE->mac_stats.dl.total_rbs; + /* note: per spec, DL PRB usage [%] = (total used PRBs for DL traffic / total available PRBs for DL traffic) * 100 + here calculated as: aggregated DL PRBs (t) - aggregated DL PRBs (t-gran_period) */ + } else if (strcmp(meas_info_name_str, "RRU.PrbTotUl") == 0) { // 3GPP TS 28.522 - section 5.1.1.2.2 + meas_record.value = INTEGER_MEAS_VALUE; + + // Get the number of UL PRBs + meas_record.int_val = UE->mac_stats.ul.total_rbs - last_total_prbs[ue_idx].ul; // [PRBs] + last_total_prbs[ue_idx].ul = UE->mac_stats.ul.total_rbs; + /* note: per spec, UL PRB usage [%] = (total used PRBs for UL traffic / total available PRBs for UL traffic) * 100 + here calculated as: aggregated UL PRBs (t) - aggregated UL PRBs (t-gran_period) */ + } else { + assert(false && "Measurement Name not yet implemented"); + } + + return meas_record; +} + +static kpm_ind_msg_format_1_t fill_kpm_ind_msg_frm_1_in_du(const NR_UE_info_t* UE, const size_t ue_idx, const kpm_act_def_format_1_t * act_def_fr_1) +{ + kpm_ind_msg_format_1_t msg_frm_1 = {0}; + + // Measurement Data contains a set of Meas Records, each collected at each granularity period + msg_frm_1.meas_data_lst_len = 1; /* this value is equal to (kpm_ric_event_trigger_format_1.report_period_ms/act_def_fr_1->gran_period_ms) + please, check their values in xApp */ + + msg_frm_1.meas_data_lst = calloc(msg_frm_1.meas_data_lst_len, sizeof(*msg_frm_1.meas_data_lst)); + assert(msg_frm_1.meas_data_lst != NULL && "Memory exhausted" ); + + for (size_t i = 0; imeas_info_lst_len; // record data list length corresponds to info list length from action definition + + msg_frm_1.meas_data_lst[i].meas_record_lst = calloc(msg_frm_1.meas_data_lst[i].meas_record_len, sizeof(meas_record_lst_t)); + assert(msg_frm_1.meas_data_lst[i].meas_record_lst != NULL && "Memory exhausted"); + + for (size_t j = 0; j < msg_frm_1.meas_data_lst[i].meas_record_len; j++) { // each meas record corresponds to one meas type + // Measurement Type as requested in Action Definition + switch (act_def_fr_1->meas_info_lst[j].meas_type.type) { + case NAME_MEAS_TYPE: { + char meas_info_name_str[act_def_fr_1->meas_info_lst[j].meas_type.name.len + 1]; + memcpy(meas_info_name_str, act_def_fr_1->meas_info_lst[j].meas_type.name.buf, act_def_fr_1->meas_info_lst[j].meas_type.name.len); + meas_info_name_str[act_def_fr_1->meas_info_lst[j].meas_type.name.len] = '\0'; + + msg_frm_1.meas_data_lst[i].meas_record_lst[j] = fill_ue_mac_rlc_data(UE, ue_idx, meas_info_name_str, act_def_fr_1->gran_period_ms); + break; + } + case ID_MEAS_TYPE: + assert(false && "ID Measurement Type not yet implemented"); + + default: + assert(false && "Measurement Type not recognized"); + } + } + } + + // Measurement Information - OPTIONAL + msg_frm_1.meas_info_lst_len = act_def_fr_1->meas_info_lst_len; + msg_frm_1.meas_info_lst = calloc(msg_frm_1.meas_info_lst_len, sizeof(meas_info_format_1_lst_t)); + assert(msg_frm_1.meas_info_lst != NULL && "Memory exhausted"); + for (size_t i = 0; i < msg_frm_1.meas_info_lst_len; i++) { + msg_frm_1.meas_info_lst[i] = cp_meas_info_format_1_lst(&act_def_fr_1->meas_info_lst[i]); + } + + return msg_frm_1; +} + +static kpm_ind_msg_format_3_t fill_kpm_ind_msg_frm_3_in_du(const matched_ues_mac_t* matched_ues, + const kpm_act_def_format_1_t* act_def_fr_1) +{ + assert(act_def_fr_1 != NULL); + + + kpm_ind_msg_format_3_t msg_frm_3 = {0}; + + // Fill UE Measurement Reports + + msg_frm_3.ue_meas_report_lst_len = matched_ues->num_ues; + msg_frm_3.meas_report_per_ue = calloc(msg_frm_3.ue_meas_report_lst_len, sizeof(meas_report_per_ue_t)); + assert(msg_frm_3.meas_report_per_ue != NULL && "Memory exhausted"); + + for (size_t i = 0; iue_list[i]->rnti); // get gNB CU UE ID as rrc_ue_id + msg_frm_3.meas_report_per_ue[i].ue_meas_report_lst.type = GNB_DU_UE_ID_E2SM; + msg_frm_3.meas_report_per_ue[i].ue_meas_report_lst.gnb_du = fill_gnb_du_data(&rrc_ue_id); + + // Fill UE related info + msg_frm_3.meas_report_per_ue[i].ind_msg_format_1 = fill_kpm_ind_msg_frm_1_in_du(matched_ues->ue_list[i], i, act_def_fr_1); + } + + + return msg_frm_3; +} + +static kpm_ind_msg_format_1_t fill_kpm_ind_msg_frm_1_in_monolithic(const NR_UE_info_t* UE, const size_t ue_idx, const uint32_t rrc_ue_id, const kpm_act_def_format_1_t * act_def_fr_1) +{ + kpm_ind_msg_format_1_t msg_frm_1 = {0}; + + // Measurement Data contains a set of Meas Records, each collected at each granularity period + msg_frm_1.meas_data_lst_len = 1; /* this value is equal to (kpm_ric_event_trigger_format_1.report_period_ms/act_def_fr_1->gran_period_ms) + please, check their values in xApp */ + + msg_frm_1.meas_data_lst = calloc(msg_frm_1.meas_data_lst_len, sizeof(*msg_frm_1.meas_data_lst)); + assert(msg_frm_1.meas_data_lst != NULL && "Memory exhausted" ); + + for (size_t i = 0; imeas_info_lst_len; // record data list length corresponds to info list length from action definition + + msg_frm_1.meas_data_lst[i].meas_record_lst = calloc(msg_frm_1.meas_data_lst[i].meas_record_len, sizeof(meas_record_lst_t)); + assert(msg_frm_1.meas_data_lst[i].meas_record_lst != NULL && "Memory exhausted"); + + for (size_t j = 0; j < msg_frm_1.meas_data_lst[i].meas_record_len; j++) { // each meas record corresponds to one meas type + // Measurement Type as requested in Action Definition + switch (act_def_fr_1->meas_info_lst[j].meas_type.type) { + case NAME_MEAS_TYPE: { + char meas_info_name_str[act_def_fr_1->meas_info_lst[j].meas_type.name.len + 1]; + memcpy(meas_info_name_str, act_def_fr_1->meas_info_lst[j].meas_type.name.buf, act_def_fr_1->meas_info_lst[j].meas_type.name.len); + meas_info_name_str[act_def_fr_1->meas_info_lst[j].meas_type.name.len] = '\0'; + + if (strcmp(meas_info_name_str, "DRB.PdcpSduVolumeDL") == 0 || strcmp(meas_info_name_str, "DRB.PdcpSduVolumeUL") == 0) { + msg_frm_1.meas_data_lst[i].meas_record_lst[j] = fill_ue_pdcp_data(rrc_ue_id, ue_idx, meas_info_name_str); + } else { + msg_frm_1.meas_data_lst[i].meas_record_lst[j] = fill_ue_mac_rlc_data(UE, ue_idx, meas_info_name_str, act_def_fr_1->gran_period_ms); + } + + break; + } + case ID_MEAS_TYPE: + assert(false && "ID Measurement Type not yet implemented"); + + default: + assert(false && "Measurement Type not recognized"); + } + } + } + + // Measurement Information - OPTIONAL + msg_frm_1.meas_info_lst_len = act_def_fr_1->meas_info_lst_len; + msg_frm_1.meas_info_lst = calloc(msg_frm_1.meas_info_lst_len, sizeof(meas_info_format_1_lst_t)); + assert(msg_frm_1.meas_info_lst != NULL && "Memory exhausted"); + for (size_t i = 0; i < msg_frm_1.meas_info_lst_len; i++) { + msg_frm_1.meas_info_lst[i] = cp_meas_info_format_1_lst(&act_def_fr_1->meas_info_lst[i]); + } + + return msg_frm_1; +} + +static kpm_ind_msg_format_3_t fill_kpm_ind_msg_frm_3_in_monolithic(const matched_ues_mac_t* matched_ues, + const kpm_act_def_format_1_t* act_def_fr_1) +{ + assert(act_def_fr_1 != NULL); + + + kpm_ind_msg_format_3_t msg_frm_3 = {0}; + + // Fill UE Measurement Reports + + msg_frm_3.ue_meas_report_lst_len = matched_ues->num_ues; + msg_frm_3.meas_report_per_ue = calloc(msg_frm_3.ue_meas_report_lst_len, sizeof(meas_report_per_ue_t)); + assert(msg_frm_3.meas_report_per_ue != NULL && "Memory exhausted"); + + + for (size_t i = 0; iue_list[i]->rnti); + msg_frm_3.meas_report_per_ue[i].ue_meas_report_lst.type = GNB_UE_ID_E2SM; + msg_frm_3.meas_report_per_ue[i].ue_meas_report_lst.gnb = fill_gnb_data(rrc_ue_context_list); + + // Fill UE related info + msg_frm_3.meas_report_per_ue[i].ind_msg_format_1 = + fill_kpm_ind_msg_frm_1_in_monolithic(matched_ues->ue_list[i], i, rrc_ue_context_list->ue_context.rrc_ue_id, act_def_fr_1); + } + + return msg_frm_3; +} +#endif + +#if defined (NGRAN_GNB_CUCP) typedef struct { uint32_t rrc_ue_id_list[MAX_MOBILES_PER_GNB]; // list of matched UEs on RRC level containing only rrc_ue_id (gNB CU UE ID) size_t num_ues; @@ -108,384 +582,6 @@ static size_t filter_ues_by_s_nssai_in_cu(test_cond_e const condition, uint8_t s return i; } -static -nr_rlc_statistics_t get_rlc_stats_per_drb(NR_UE_info_t const * UE) -{ - assert(UE != NULL); - - nr_rlc_statistics_t rlc = {0}; - const int srb_flag = 0; - const int rb_id = 1; // at the moment, only 1 DRB is supported - - // Get RLC stats for specific DRB - const bool rc = nr_rlc_get_statistics(UE->rnti, srb_flag, rb_id, &rlc); - assert(rc == true && "Cannot get RLC stats\n"); - - // Activate average sojourn time at the RLC buffer for specific DRB - nr_rlc_activate_avg_time_to_tx(UE->rnti, rb_id+3, 1); - - return rlc; -} - -static -nr_pdcp_statistics_t get_pdcp_stats_per_drb(const uint32_t rrc_ue_id) -{ - nr_pdcp_statistics_t pdcp = {0}; - const int srb_flag = 0; - const int rb_id = 1; // at the moment, only 1 DRB is supported - - // Get PDCP stats for specific DRB - const bool rc = nr_pdcp_get_statistics(rrc_ue_id, srb_flag, rb_id, &pdcp); - assert(rc == true && "Cannot get PDCP stats\n"); - - return pdcp; -} - -static -gnb_e2sm_t fill_gnb_data(rrc_gNB_ue_context_t * ue_context_p) -{ - gnb_e2sm_t gnb = {0}; - - // 6.2.3.16 - // Mandatory - // AMF UE NGAP ID - gnb.amf_ue_ngap_id = ue_context_p->ue_context.rrc_ue_id; - - // Mandatory - //GUAMI 6.2.3.17 - gnb.guami.plmn_id = (e2sm_plmn_t) { - .mcc = ue_context_p->ue_context.ue_guami.mcc, - .mnc = ue_context_p->ue_context.ue_guami.mnc, - .mnc_digit_len = ue_context_p->ue_context.ue_guami.mnc_len - }; - - gnb.guami.amf_region_id = ue_context_p->ue_context.ue_guami.amf_region_id; - gnb.guami.amf_set_id = ue_context_p->ue_context.ue_guami.amf_set_id; - gnb.guami.amf_ptr = ue_context_p->ue_context.ue_guami.amf_pointer; - - // gNB-CU UE F1AP ID List - // C-ifCUDUseparated - if (NODE_IS_CU(RC.nrrrc[0]->node_type)) - { - gnb.gnb_cu_ue_f1ap_lst_len = 1; - gnb.gnb_cu_ue_f1ap_lst = calloc(gnb.gnb_cu_ue_f1ap_lst_len, sizeof(uint32_t)); - assert(gnb.gnb_cu_ue_f1ap_lst != NULL); - - for (size_t i = 0; i < gnb.gnb_cu_ue_f1ap_lst_len; i++) - { - gnb.gnb_cu_ue_f1ap_lst[i] = ue_context_p->ue_context.rrc_ue_id; - } - } - - - return gnb; -} - -static -gnb_du_e2sm_t fill_gnb_du_data(const f1_ue_data_t * rrc_ue_id) -{ - gnb_du_e2sm_t gnb_du = {0}; - - // 6.2.3.21 - // gNB CU UE F1AP - // Mandatory - gnb_du.gnb_cu_ue_f1ap = rrc_ue_id->secondary_ue; - - - // 6.2.3.25 - // RAN UE ID - // Optional - gnb_du.ran_ue_id = NULL; - - return gnb_du; -} - -// Bad bad bad. Create a proper exponential moving average filter or at least, only read statistics -// Avoid coupling among sublayers -static uint32_t last_dl_rlc_pdu_total_bytes[MAX_MOBILES_PER_GNB] = {0}; -static uint32_t last_ul_rlc_pdu_total_bytes[MAX_MOBILES_PER_GNB] = {0}; -static uint32_t last_dl_total_prbs[MAX_MOBILES_PER_GNB] = {0}; -static uint32_t last_ul_total_prbs[MAX_MOBILES_PER_GNB] = {0}; -static uint32_t last_dl_pdcp_sdu_total_bytes[MAX_MOBILES_PER_GNB] = {0}; -static uint32_t last_ul_pdcp_sdu_total_bytes[MAX_MOBILES_PER_GNB] = {0}; - - -static -meas_record_lst_t fill_ue_mac_rlc_data(const NR_UE_info_t* UE, const size_t ue_idx, const char * meas_info_name_str, const uint32_t gran_period_ms) -{ - assert(UE != NULL); - - meas_record_lst_t meas_record = {0}; - - // Get RLC stats per DRB - nr_rlc_statistics_t rlc = get_rlc_stats_per_drb(UE); - - // Measurement Type as requested in Action Definition - if (strcmp(meas_info_name_str, "DRB.UEThpDl") == 0) // 3GPP TS 28.522 - section 5.1.1.3.1 - { - meas_record.value = REAL_MEAS_VALUE; - - // Calculate DL Thp - meas_record.real_val = (double)(rlc.txpdu_bytes - last_dl_rlc_pdu_total_bytes[ue_idx])*8/gran_period_ms; // [kbps] - last_dl_rlc_pdu_total_bytes[ue_idx] = rlc.txpdu_bytes; - /* note: per spec, average UE throughput in DL (taken into consideration values from all UEs, and averaged) - here calculated as: UE specific throughput in DL */ - } - else if (strcmp(meas_info_name_str, "DRB.UEThpUl") == 0) // 3GPP TS 28.522 - section 5.1.1.3.3 - { - meas_record.value = REAL_MEAS_VALUE; - - // Calculate UL Thp - meas_record.real_val = (double)(rlc.rxpdu_bytes - last_ul_rlc_pdu_total_bytes[ue_idx])*8/gran_period_ms; // [kbps] - last_ul_rlc_pdu_total_bytes[ue_idx] = rlc.rxpdu_bytes; - /* note: per spec, average UE throughput in UL (taken into consideration values from all UEs, and averaged) - here calculated as: UE specific throughput in UL */ - } - else if (strcmp(meas_info_name_str, "DRB.RlcSduDelayDl") == 0) // 3GPP TS 28.522 - section 5.1.3.3.3 - { - meas_record.value = REAL_MEAS_VALUE; - - // Get the value of sojourn time at the RLC buffer - meas_record.real_val = rlc.txsdu_avg_time_to_tx; // [μs] - /* note: by default this measurement is calculated for previous 100ms (openair2/LAYER2/nr_rlc/nr_rlc_entity.c:118, 173, 213); please, update according to your needs */ - } - else if (strcmp(meas_info_name_str, "RRU.PrbTotDl") == 0) // 3GPP TS 28.522 - section 5.1.1.2.1 - { - meas_record.value = INTEGER_MEAS_VALUE; - - // Get the number of DL PRBs - meas_record.int_val = UE->mac_stats.dl.total_rbs - last_dl_total_prbs[ue_idx]; // [PRBs] - last_dl_total_prbs[ue_idx] = UE->mac_stats.dl.total_rbs; - /* note: per spec, DL PRB usage [%] = (total used PRBs for DL traffic / total available PRBs for DL traffic) * 100 - here calculated as: aggregated DL PRBs (t) - aggregated DL PRBs (t-gran_period) */ - } - else if (strcmp(meas_info_name_str, "RRU.PrbTotUl") == 0) // 3GPP TS 28.522 - section 5.1.1.2.2 - { - meas_record.value = INTEGER_MEAS_VALUE; - - // Get the number of UL PRBs - meas_record.int_val = UE->mac_stats.ul.total_rbs - last_ul_total_prbs[ue_idx]; // [PRBs] - last_ul_total_prbs[ue_idx] = UE->mac_stats.ul.total_rbs; - /* note: per spec, UL PRB usage [%] = (total used PRBs for UL traffic / total available PRBs for UL traffic) * 100 - here calculated as: aggregated UL PRBs (t) - aggregated UL PRBs (t-gran_period) */ - } - else - { - assert(false && "Measurement Name not yet implemented"); - } - - - return meas_record; -} - -static -meas_record_lst_t fill_ue_pdcp_data(const uint32_t rrc_ue_id, const size_t ue_idx, const char * meas_info_name_str) -{ - meas_record_lst_t meas_record = {0}; - - // Get PDCP stats per DRB - nr_pdcp_statistics_t pdcp = get_pdcp_stats_per_drb(rrc_ue_id); - - // Measurement Type as requested in Action Definition - if (strcmp(meas_info_name_str, "DRB.PdcpSduVolumeDL") == 0) // 3GPP TS 28.522 - section 5.1.2.1.1.1 - { - meas_record.value = INTEGER_MEAS_VALUE; - - // Get DL data volume delivered to PDCP layer - meas_record.int_val = (pdcp.rxsdu_bytes - last_dl_pdcp_sdu_total_bytes[ue_idx])*8/1000; // [kb] - last_dl_pdcp_sdu_total_bytes[ue_idx] = pdcp.rxsdu_bytes; - /* note: this measurement is calculated as per spec */ - } - else if (strcmp(meas_info_name_str, "DRB.PdcpSduVolumeUL") == 0) // 3GPP TS 28.522 - section 5.1.2.1.2.1 - { - meas_record.value = INTEGER_MEAS_VALUE; - - // Get UL data volume delivered from PDCP layer - meas_record.int_val = (pdcp.txsdu_bytes - last_ul_pdcp_sdu_total_bytes[ue_idx])*8/1000; // [kb] - last_ul_pdcp_sdu_total_bytes[ue_idx] = pdcp.txsdu_bytes; - /* note: this measurement is calculated as per spec */ - } - else - { - assert(false && "Measurement Name not yet implemented"); - } - - - return meas_record; -} - -static -meas_info_format_1_lst_t * fill_kpm_meas_info_frm_1(const size_t len, const kpm_act_def_format_1_t * act_def_fr_1) -{ - meas_info_format_1_lst_t * meas_info_lst = calloc(len, sizeof(meas_info_format_1_lst_t)); - assert(meas_info_lst != NULL && "Memory exhausted" ); - - // Get measInfo from action definition - for (size_t i = 0; i < len; i++) - { - // Measurement Type - meas_info_lst[i].meas_type.type = act_def_fr_1->meas_info_lst[i].meas_type.type; - // Measurement Name - if (act_def_fr_1->meas_info_lst[i].meas_type.type == NAME_MEAS_TYPE) { - meas_info_lst[i].meas_type.name.buf = calloc(act_def_fr_1->meas_info_lst[i].meas_type.name.len, sizeof(uint8_t)); - memcpy(meas_info_lst[i].meas_type.name.buf, act_def_fr_1->meas_info_lst[i].meas_type.name.buf, act_def_fr_1->meas_info_lst[i].meas_type.name.len); - meas_info_lst[i].meas_type.name.len = act_def_fr_1->meas_info_lst[i].meas_type.name.len; - } else { - meas_info_lst[i].meas_type.id = act_def_fr_1->meas_info_lst[i].meas_type.id; - } - - - // Label Information - meas_info_lst[i].label_info_lst_len = 1; - meas_info_lst[i].label_info_lst = calloc(meas_info_lst[i].label_info_lst_len, sizeof(label_info_lst_t)); - assert(meas_info_lst[i].label_info_lst != NULL && "Memory exhausted" ); - - for (size_t j = 0; j < meas_info_lst[i].label_info_lst_len; j++) { - meas_info_lst[i].label_info_lst[j].noLabel = malloc(sizeof(enum_value_e)); - *meas_info_lst[i].label_info_lst[j].noLabel = TRUE_ENUM_VALUE; - } - } - - return meas_info_lst; -} - -static -kpm_ind_msg_format_1_t fill_kpm_ind_msg_frm_1_in_du(const NR_UE_info_t* UE, const size_t ue_idx, const kpm_act_def_format_1_t * act_def_fr_1) -{ - kpm_ind_msg_format_1_t msg_frm_1 = {0}; - - // Measurement Data contains a set of Meas Records, each collected at each granularity period - msg_frm_1.meas_data_lst_len = 1; /* this value is equal to (kpm_ric_event_trigger_format_1.report_period_ms/act_def_fr_1->gran_period_ms) - please, check their values in xApp */ - - msg_frm_1.meas_data_lst = calloc(msg_frm_1.meas_data_lst_len, sizeof(*msg_frm_1.meas_data_lst)); - assert(msg_frm_1.meas_data_lst != NULL && "Memory exhausted" ); - - for (size_t i = 0; imeas_info_lst_len; // record data list length corresponds to info list length from action definition - - msg_frm_1.meas_data_lst[i].meas_record_lst = calloc(msg_frm_1.meas_data_lst[i].meas_record_len, sizeof(meas_record_lst_t)); - assert(msg_frm_1.meas_data_lst[i].meas_record_lst != NULL && "Memory exhausted"); - - for (size_t j = 0; j < msg_frm_1.meas_data_lst[i].meas_record_len; j++) // each meas record corresponds to one meas type - { - // Measurement Type as requested in Action Definition - switch (act_def_fr_1->meas_info_lst[j].meas_type.type) - { - case NAME_MEAS_TYPE: - { - char meas_info_name_str[act_def_fr_1->meas_info_lst[j].meas_type.name.len + 1]; - memcpy(meas_info_name_str, act_def_fr_1->meas_info_lst[j].meas_type.name.buf, act_def_fr_1->meas_info_lst[j].meas_type.name.len); - meas_info_name_str[act_def_fr_1->meas_info_lst[j].meas_type.name.len] = '\0'; - - msg_frm_1.meas_data_lst[i].meas_record_lst[j] = fill_ue_mac_rlc_data(UE, ue_idx, meas_info_name_str, act_def_fr_1->gran_period_ms); - break; - } - - case ID_MEAS_TYPE: - assert(false && "ID Measurement Type not yet implemented"); - break; - - default: - assert(false && "Measurement Type not recognized"); - break; - } - - } - } - - // Measurement Information - OPTIONAL - msg_frm_1.meas_info_lst_len = act_def_fr_1->meas_info_lst_len; - msg_frm_1.meas_info_lst = fill_kpm_meas_info_frm_1(msg_frm_1.meas_info_lst_len, act_def_fr_1); - - return msg_frm_1; -} - -static kpm_ind_msg_format_3_t fill_kpm_ind_msg_frm_3_in_du(const matched_ues_mac_t* matched_ues, - const kpm_act_def_format_1_t* act_def_fr_1) -{ - assert(act_def_fr_1 != NULL); - - - kpm_ind_msg_format_3_t msg_frm_3 = {0}; - - // Fill UE Measurement Reports - - msg_frm_3.ue_meas_report_lst_len = matched_ues->num_ues; - msg_frm_3.meas_report_per_ue = calloc(msg_frm_3.ue_meas_report_lst_len, sizeof(meas_report_per_ue_t)); - assert(msg_frm_3.meas_report_per_ue != NULL && "Memory exhausted"); - - for (size_t i = 0; iue_list[i]->rnti); // get gNB CU UE ID as rrc_ue_id - msg_frm_3.meas_report_per_ue[i].ue_meas_report_lst.type = GNB_DU_UE_ID_E2SM; - msg_frm_3.meas_report_per_ue[i].ue_meas_report_lst.gnb_du = fill_gnb_du_data(&rrc_ue_id); - - // Fill UE related info - msg_frm_3.meas_report_per_ue[i].ind_msg_format_1 = fill_kpm_ind_msg_frm_1_in_du(matched_ues->ue_list[i], i, act_def_fr_1); - } - - - return msg_frm_3; -} - -static -kpm_ind_msg_format_1_t fill_kpm_ind_msg_frm_1_in_cu(const uint32_t rrc_ue_id, const size_t ue_idx, const kpm_act_def_format_1_t * act_def_fr_1) -{ - kpm_ind_msg_format_1_t msg_frm_1 = {0}; - - // Measurement Data contains a set of Meas Records, each collected at each granularity period - msg_frm_1.meas_data_lst_len = 1; /* this value is equal to (kpm_ric_event_trigger_format_1.report_period_ms/act_def_fr_1->gran_period_ms) - please, check their values in xApp */ - - msg_frm_1.meas_data_lst = calloc(msg_frm_1.meas_data_lst_len, sizeof(*msg_frm_1.meas_data_lst)); - assert(msg_frm_1.meas_data_lst != NULL && "Memory exhausted" ); - - for (size_t i = 0; imeas_info_lst_len; // record data list length corresponds to info list length from action definition - - msg_frm_1.meas_data_lst[i].meas_record_lst = calloc(msg_frm_1.meas_data_lst[i].meas_record_len, sizeof(meas_record_lst_t)); - assert(msg_frm_1.meas_data_lst[i].meas_record_lst != NULL && "Memory exhausted"); - - for (size_t j = 0; j < msg_frm_1.meas_data_lst[i].meas_record_len; j++) // each meas record corresponds to one meas type - { - // Measurement Type as requested in Action Definition - switch (act_def_fr_1->meas_info_lst[j].meas_type.type) - { - case NAME_MEAS_TYPE: - { - char meas_info_name_str[act_def_fr_1->meas_info_lst[j].meas_type.name.len + 1]; - memcpy(meas_info_name_str, act_def_fr_1->meas_info_lst[j].meas_type.name.buf, act_def_fr_1->meas_info_lst[j].meas_type.name.len); - meas_info_name_str[act_def_fr_1->meas_info_lst[j].meas_type.name.len] = '\0'; - - msg_frm_1.meas_data_lst[i].meas_record_lst[j] = fill_ue_pdcp_data(rrc_ue_id, ue_idx, meas_info_name_str); - break; - } - - case ID_MEAS_TYPE: - assert(false && "ID Measurement Type not yet implemented"); - break; - - default: - assert(false && "Measurement Type not recognized"); - break; - } - - } - } - - // Measurement Information - OPTIONAL - msg_frm_1.meas_info_lst_len = act_def_fr_1->meas_info_lst_len; - msg_frm_1.meas_info_lst = fill_kpm_meas_info_frm_1(msg_frm_1.meas_info_lst_len, act_def_fr_1); - - return msg_frm_1; -} - static kpm_ind_msg_format_3_t fill_kpm_ind_msg_frm_3_in_cu(const matched_ues_rrc_t* matched_ues, const kpm_act_def_format_1_t* act_def_fr_1) { @@ -500,8 +596,7 @@ static kpm_ind_msg_format_3_t fill_kpm_ind_msg_frm_3_in_cu(const matched_ues_rrc msg_frm_3.meas_report_per_ue = calloc(msg_frm_3.ue_meas_report_lst_len, sizeof(meas_report_per_ue_t)); assert(msg_frm_3.meas_report_per_ue != NULL && "Memory exhausted"); - for (size_t i = 0; irrc_ue_id_list[i]); msg_frm_3.meas_report_per_ue[i].ue_meas_report_lst.type = GNB_UE_ID_E2SM; @@ -514,101 +609,9 @@ static kpm_ind_msg_format_3_t fill_kpm_ind_msg_frm_3_in_cu(const matched_ues_rrc return msg_frm_3; } +#endif -static -kpm_ind_msg_format_1_t fill_kpm_ind_msg_frm_1_in_monolithic(const NR_UE_info_t* UE, const size_t ue_idx, const uint32_t rrc_ue_id, const kpm_act_def_format_1_t * act_def_fr_1) -{ - kpm_ind_msg_format_1_t msg_frm_1 = {0}; - - // Measurement Data contains a set of Meas Records, each collected at each granularity period - msg_frm_1.meas_data_lst_len = 1; /* this value is equal to (kpm_ric_event_trigger_format_1.report_period_ms/act_def_fr_1->gran_period_ms) - please, check their values in xApp */ - - msg_frm_1.meas_data_lst = calloc(msg_frm_1.meas_data_lst_len, sizeof(*msg_frm_1.meas_data_lst)); - assert(msg_frm_1.meas_data_lst != NULL && "Memory exhausted" ); - - for (size_t i = 0; imeas_info_lst_len; // record data list length corresponds to info list length from action definition - - msg_frm_1.meas_data_lst[i].meas_record_lst = calloc(msg_frm_1.meas_data_lst[i].meas_record_len, sizeof(meas_record_lst_t)); - assert(msg_frm_1.meas_data_lst[i].meas_record_lst != NULL && "Memory exhausted"); - - for (size_t j = 0; j < msg_frm_1.meas_data_lst[i].meas_record_len; j++) // each meas record corresponds to one meas type - { - // Measurement Type as requested in Action Definition - switch (act_def_fr_1->meas_info_lst[j].meas_type.type) - { - case NAME_MEAS_TYPE: - { - char meas_info_name_str[act_def_fr_1->meas_info_lst[j].meas_type.name.len + 1]; - memcpy(meas_info_name_str, act_def_fr_1->meas_info_lst[j].meas_type.name.buf, act_def_fr_1->meas_info_lst[j].meas_type.name.len); - meas_info_name_str[act_def_fr_1->meas_info_lst[j].meas_type.name.len] = '\0'; - - if (strcmp(meas_info_name_str, "DRB.PdcpSduVolumeDL") == 0 || strcmp(meas_info_name_str, "DRB.PdcpSduVolumeUL") == 0) - { - msg_frm_1.meas_data_lst[i].meas_record_lst[j] = fill_ue_pdcp_data(rrc_ue_id, ue_idx, meas_info_name_str); - } - else - { - msg_frm_1.meas_data_lst[i].meas_record_lst[j] = fill_ue_mac_rlc_data(UE, ue_idx, meas_info_name_str, act_def_fr_1->gran_period_ms); - } - - break; - } - - case ID_MEAS_TYPE: - assert(false && "ID Measurement Type not yet implemented"); - break; - - default: - assert(false && "Measurement Type not recognized"); - break; - } - } - } - - // Measurement Information - OPTIONAL - msg_frm_1.meas_info_lst_len = act_def_fr_1->meas_info_lst_len; - msg_frm_1.meas_info_lst = fill_kpm_meas_info_frm_1(msg_frm_1.meas_info_lst_len, act_def_fr_1); - - - return msg_frm_1; -} - -static kpm_ind_msg_format_3_t fill_kpm_ind_msg_frm_3_in_monolithic(const matched_ues_mac_t* matched_ues, - const kpm_act_def_format_1_t* act_def_fr_1) -{ - assert(act_def_fr_1 != NULL); - - - kpm_ind_msg_format_3_t msg_frm_3 = {0}; - - // Fill UE Measurement Reports - - msg_frm_3.ue_meas_report_lst_len = matched_ues->num_ues; - msg_frm_3.meas_report_per_ue = calloc(msg_frm_3.ue_meas_report_lst_len, sizeof(meas_report_per_ue_t)); - assert(msg_frm_3.meas_report_per_ue != NULL && "Memory exhausted"); - - - for (size_t i = 0; iue_list[i]->rnti); - msg_frm_3.meas_report_per_ue[i].ue_meas_report_lst.type = GNB_UE_ID_E2SM; - msg_frm_3.meas_report_per_ue[i].ue_meas_report_lst.gnb = fill_gnb_data(rrc_ue_context_list); - - // Fill UE related info - msg_frm_3.meas_report_per_ue[i].ind_msg_format_1 = - fill_kpm_ind_msg_frm_1_in_monolithic(matched_ues->ue_list[i], i, rrc_ue_context_list->ue_context.rrc_ue_id, act_def_fr_1); - } - - return msg_frm_3; -} - -static -kpm_ric_ind_hdr_format_1_t kpm_ind_hdr_frm_1(void) +static kpm_ric_ind_hdr_format_1_t kpm_ind_hdr_frm_1(void) { kpm_ric_ind_hdr_format_1_t hdr_frm_1 = {0}; @@ -624,44 +627,55 @@ kpm_ric_ind_hdr_format_1_t kpm_ind_hdr_frm_1(void) hdr_frm_1.fileformat_version = NULL; // Check E2 Node NG-RAN Type - if (NODE_IS_DU(RC.nrrrc[0]->node_type)) - { + #if defined (NGRAN_GNB_DU) + if (RC.nrrrc[0]->node_type == ngran_gNB_DU) { hdr_frm_1.sender_name = calloc(1, sizeof(byte_array_t)); - hdr_frm_1.sender_name->buf = calloc(strlen("My OAI-DU") + 1, sizeof(char)); - memcpy(hdr_frm_1.sender_name->buf, "My OAI-DU", strlen("My OAI-DU")); - hdr_frm_1.sender_name->len = strlen("My OAI-DU"); + hdr_frm_1.sender_name->buf = calloc(strlen("OAI-DU") + 1, sizeof(char)); + memcpy(hdr_frm_1.sender_name->buf, "OAI-DU", strlen("OAI-DU")); + hdr_frm_1.sender_name->len = strlen("OAI-DU"); hdr_frm_1.sender_type = calloc(1, sizeof(byte_array_t)); hdr_frm_1.sender_type->buf = calloc(strlen("DU") + 1, sizeof(char)); memcpy(hdr_frm_1.sender_type->buf, "DU", strlen("DU")); hdr_frm_1.sender_type->len = strlen("DU"); - } - else if (NODE_IS_CU(RC.nrrrc[0]->node_type)) - { + } else if (RC.nrrrc[0]->node_type == ngran_gNB_CU) { hdr_frm_1.sender_name = calloc(1, sizeof(byte_array_t)); - hdr_frm_1.sender_name->buf = calloc(strlen("My OAI-CU") + 1, sizeof(char)); - memcpy(hdr_frm_1.sender_name->buf, "My OAI-CU", strlen("My OAI-CU")); - hdr_frm_1.sender_name->len = strlen("My OAI-CU"); + hdr_frm_1.sender_name->buf = calloc(strlen("OAI-CU") + 1, sizeof(char)); + memcpy(hdr_frm_1.sender_name->buf, "OAI-CU", strlen("OAI-CU")); + hdr_frm_1.sender_name->len = strlen("OAI-CU"); hdr_frm_1.sender_type = calloc(1, sizeof(byte_array_t)); hdr_frm_1.sender_type->buf = calloc(strlen("CU") + 1, sizeof(char)); memcpy(hdr_frm_1.sender_type->buf, "CU", strlen("CU")); hdr_frm_1.sender_type->len = strlen("CU"); - } - else if (NODE_IS_MONOLITHIC(RC.nrrrc[0]->node_type)) - { + } else if (RC.nrrrc[0]->node_type == ngran_gNB) { hdr_frm_1.sender_name = calloc(1, sizeof(byte_array_t)); - hdr_frm_1.sender_name->buf = calloc(strlen("My OAI-MONO") + 1, sizeof(char)); - memcpy(hdr_frm_1.sender_name->buf, "My OAI-MONO", strlen("My OAI-MONO")); - hdr_frm_1.sender_name->len = strlen("My OAI-MONO"); + hdr_frm_1.sender_name->buf = calloc(strlen("OAI-MONO") + 1, sizeof(char)); + memcpy(hdr_frm_1.sender_name->buf, "OAI-MONO", strlen("OAI-MONO")); + hdr_frm_1.sender_name->len = strlen("OAI-MONO"); hdr_frm_1.sender_type = calloc(1, sizeof(byte_array_t)); hdr_frm_1.sender_type->buf = calloc(strlen("MONO") + 1, sizeof(char)); memcpy(hdr_frm_1.sender_type->buf, "MONO", strlen("MONO")); hdr_frm_1.sender_type->len = strlen("MONO"); + } else if (RC.nrrrc[0]->node_type == ngran_gNB_CUCP) { + return hdr_frm_1; // nothing to fill } else { assert(0!=0 && "Unknown node type"); } + #endif + + #if defined (NGRAN_GNB_CUUP) + hdr_frm_1.sender_name = calloc(1, sizeof(byte_array_t)); + hdr_frm_1.sender_name->buf = calloc(strlen("OAI-CU-UP") + 1, sizeof(char)); + memcpy(hdr_frm_1.sender_name->buf, "OAI-CU-UP", strlen("OAI-CU-UP")); + hdr_frm_1.sender_name->len = strlen("OAI-CU-UP"); + + hdr_frm_1.sender_type = calloc(1, sizeof(byte_array_t)); + hdr_frm_1.sender_type->buf = calloc(strlen("CU-UP") + 1, sizeof(char)); + memcpy(hdr_frm_1.sender_type->buf, "CU-UP", strlen("CU-UP")); + hdr_frm_1.sender_type->len = strlen("CU-UP"); + #endif hdr_frm_1.vendor_name = calloc(1, sizeof(byte_array_t)); hdr_frm_1.vendor_name->buf = calloc(strlen("OAI") + 1, sizeof(char)); @@ -691,12 +705,13 @@ static void capture_sst_sd(test_info_lst_t* test, uint8_t *sst, uint32_t **sd) // but earlier version of the RAN function and the xApp used integer, so // handle this gracefully by accepting integer as well switch (test->test_cond_value->type) { - case INTEGER_TEST_COND_VALUE: + case INTEGER_TEST_COND_VALUE: { AssertFatal(*test->test_cond_value->int_value <= 0xff, "illegal SST %ld\n", *test->test_cond_value->int_value); *sst = *test->test_cond_value->int_value; *sd = NULL; break; - case OCTET_STRING_TEST_COND_VALUE: + } + case OCTET_STRING_TEST_COND_VALUE: { if (test->test_cond_value->octet_string_value->len == 1) { *sst = test->test_cond_value->octet_string_value->buf[0]; *sd = NULL; @@ -708,9 +723,9 @@ static void capture_sst_sd(test_info_lst_t* test, uint8_t *sst, uint32_t **sd) **sd = buf[1] << 16 | buf[2] << 8 | buf[3]; } break; + } default: AssertFatal(false, "test condition value %d impossible\n", test->test_cond_value->type); - break; } } @@ -791,24 +806,45 @@ bool read_kpm_sm(void* data) uint32_t *sd = NULL; capture_sst_sd(&frm_4->matching_cond_lst[i].test_info_lst, &sst, &sd); // Check E2 Node NG-RAN Type - if (NODE_IS_DU(RC.nrrrc[0]->node_type)) { + /* Current implementation: + - we only have one executable nr-softmodem for 4 node types: DU, CU, gNB-mono, CU-CP + In the future, when nr-softmodem is separated, linking should be done as following: + DU: e2_ran_func_du + CU-CP : e2_ran_func_cucp + CU-UP: e2_ran_func_cuup (this is available at the moment, executable nr-cuup) + CU: e2_ran_func_cucp + e2_ran_func_cuup + gNB-mono: e2_ran_func_du + e2_ran_func_cucp + e2_ran_func_cuup */ + #if defined (NGRAN_GNB_DU) + if (RC.nrrrc[0]->node_type == ngran_gNB_DU) { matched_ues_mac_t matched_ues = {0}; matched_ues.num_ues = filter_ues_by_s_nssai_in_du_or_monolithic(test_cond, sst, sd, &matched_ues); if (matched_ues.num_ues == 0) return false; kpm->ind.msg.frm_3 = fill_kpm_ind_msg_frm_3_in_du(&matched_ues, &frm_4->action_def_format_1); - } else if (NODE_IS_CU(RC.nrrrc[0]->node_type)) { + } else if (RC.nrrrc[0]->node_type == ngran_gNB_CU) { matched_ues_rrc_t matched_ues = {0}; matched_ues.num_ues = filter_ues_by_s_nssai_in_cu(test_cond, sst, sd, &matched_ues); if (matched_ues.num_ues == 0) return false; kpm->ind.msg.frm_3 = fill_kpm_ind_msg_frm_3_in_cu(&matched_ues, &frm_4->action_def_format_1); - } else if (NODE_IS_MONOLITHIC(RC.nrrrc[0]->node_type)) { + } else if (RC.nrrrc[0]->node_type == ngran_gNB) { matched_ues_mac_t matched_ues = {0}; matched_ues.num_ues = filter_ues_by_s_nssai_in_du_or_monolithic(test_cond, sst, sd, &matched_ues); if (matched_ues.num_ues == 0) return false; kpm->ind.msg.frm_3 = fill_kpm_ind_msg_frm_3_in_monolithic(&matched_ues, &frm_4->action_def_format_1); + } else if (RC.nrrrc[0]->node_type == ngran_gNB_CUCP) { + return false; // at the moment, measurements regarding CU-CP node are not yet implemented } else { assert(false && "NG-RAN Type not implemented"); } + + + #elif defined (NGRAN_GNB_CUUP) + matched_ues_pdcp_t matched_ues = {0}; + matched_ues.num_ues = filter_ues_by_s_nssai_in_cuup(test_cond, sst, sd, &matched_ues); + if (matched_ues.num_ues == 0) return false; + kpm->ind.msg.frm_3 = fill_kpm_ind_msg_frm_3_in_cuup(&matched_ues, &frm_4->action_def_format_1); + #endif + + free(sd); // if NULL, nothing happens break; @@ -846,4 +882,3 @@ sm_ag_if_ans_t write_ctrl_kpm_sm(void const* src) sm_ag_if_ans_t ans = {0}; return ans; } - diff --git a/openair2/E2AP/RAN_FUNCTION/O-RAN/ran_func_rc.c b/openair2/E2AP/RAN_FUNCTION/O-RAN/ran_func_rc.c index 6d6db167df..7c22fe5726 100644 --- a/openair2/E2AP/RAN_FUNCTION/O-RAN/ran_func_rc.c +++ b/openair2/E2AP/RAN_FUNCTION/O-RAN/ran_func_rc.c @@ -20,7 +20,7 @@ */ #include "ran_func_rc.h" -#include "../../flexric/test/rnd/fill_rnd_data_rc.h" +#include "../../flexric/test/rnd/fill_rnd_data_rc.h" // this dependancy will be taken out once RAN Function Definition is implemented #include "../../flexric/src/sm/rc_sm/ie/ir/lst_ran_param.h" #include "../../flexric/src/sm/rc_sm/ie/ir/ran_param_list.h" #include "../../flexric/src/agent/e2_agent_api.h" @@ -30,6 +30,8 @@ #include #include +// Please note: current implementation doesn't take split architecture into account, neither CU/DU nor CU-UP/CU-CP + bool read_rc_sm(void* data) { assert(data != NULL); diff --git a/openair2/E2AP/RAN_FUNCTION/init_ran_func.c b/openair2/E2AP/RAN_FUNCTION/init_ran_func.c index abf503c62c..5e9f214795 100644 --- a/openair2/E2AP/RAN_FUNCTION/init_ran_func.c +++ b/openair2/E2AP/RAN_FUNCTION/init_ran_func.c @@ -22,24 +22,35 @@ #include "init_ran_func.h" #include "read_setup_ran.h" #include "../flexric/src/agent/e2_agent_api.h" + +#if defined (NGRAN_GNB_DU) #include "CUSTOMIZED/ran_func_mac.h" #include "CUSTOMIZED/ran_func_rlc.h" -#include "CUSTOMIZED/ran_func_pdcp.h" #include "CUSTOMIZED/ran_func_slice.h" +#endif +#if defined (NGRAN_GNB_CUUP) #include "CUSTOMIZED/ran_func_tc.h" #include "CUSTOMIZED/ran_func_gtp.h" +#include "CUSTOMIZED/ran_func_pdcp.h" +#endif + #include "O-RAN/ran_func_kpm.h" #include "O-RAN/ran_func_rc.h" static void init_read_ind_tbl(read_ind_fp (*read_ind_tbl)[SM_AGENT_IF_READ_V0_END]) { + #if defined (NGRAN_GNB_DU) (*read_ind_tbl)[MAC_STATS_V0] = read_mac_sm; (*read_ind_tbl)[RLC_STATS_V0] = read_rlc_sm ; - (*read_ind_tbl)[PDCP_STATS_V0] = read_pdcp_sm ; (*read_ind_tbl)[SLICE_STATS_V0] = read_slice_sm ; + #endif + #if defined (NGRAN_GNB_CUUP) (*read_ind_tbl)[TC_STATS_V0] = read_tc_sm ; (*read_ind_tbl)[GTP_STATS_V0] = read_gtp_sm ; + (*read_ind_tbl)[PDCP_STATS_V0] = read_pdcp_sm ; + #endif + (*read_ind_tbl)[KPM_STATS_V3_0] = read_kpm_sm ; (*read_ind_tbl)[RAN_CTRL_STATS_V1_03] = read_rc_sm; } @@ -47,12 +58,17 @@ void init_read_ind_tbl(read_ind_fp (*read_ind_tbl)[SM_AGENT_IF_READ_V0_END]) static void init_read_setup_tbl(read_e2_setup_fp (*read_setup_tbl)[SM_AGENT_IF_E2_SETUP_ANS_V0_END]) { + #if defined (NGRAN_GNB_DU) (*read_setup_tbl)[MAC_AGENT_IF_E2_SETUP_ANS_V0] = read_mac_setup_sm; (*read_setup_tbl)[RLC_AGENT_IF_E2_SETUP_ANS_V0] = read_rlc_setup_sm ; - (*read_setup_tbl)[PDCP_AGENT_IF_E2_SETUP_ANS_V0] = read_pdcp_setup_sm ; (*read_setup_tbl)[SLICE_AGENT_IF_E2_SETUP_ANS_V0] = read_slice_setup_sm ; + #endif + #if defined (NGRAN_GNB_CUUP) (*read_setup_tbl)[TC_AGENT_IF_E2_SETUP_ANS_V0] = read_tc_setup_sm ; (*read_setup_tbl)[GTP_AGENT_IF_E2_SETUP_ANS_V0] = read_gtp_setup_sm ; + (*read_setup_tbl)[PDCP_AGENT_IF_E2_SETUP_ANS_V0] = read_pdcp_setup_sm ; + #endif + (*read_setup_tbl)[KPM_V3_0_AGENT_IF_E2_SETUP_ANS_V0] = read_kpm_setup_sm ; (*read_setup_tbl)[RAN_CTRL_V1_3_AGENT_IF_E2_SETUP_ANS_V0] = read_rc_setup_sm; } @@ -60,24 +76,34 @@ void init_read_setup_tbl(read_e2_setup_fp (*read_setup_tbl)[SM_AGENT_IF_E2_SETUP static void init_write_ctrl( write_ctrl_fp (*write_ctrl_tbl)[SM_AGENT_IF_WRITE_CTRL_V0_END]) { + #if defined (NGRAN_GNB_DU) (*write_ctrl_tbl)[MAC_CTRL_REQ_V0] = write_ctrl_mac_sm; (*write_ctrl_tbl)[RLC_CTRL_REQ_V0] = write_ctrl_rlc_sm; - (*write_ctrl_tbl)[PDCP_CTRL_REQ_V0] = write_ctrl_pdcp_sm; (*write_ctrl_tbl)[SLICE_CTRL_REQ_V0] = write_ctrl_slice_sm; + #endif + #if defined (NGRAN_GNB_CUUP) (*write_ctrl_tbl)[TC_CTRL_REQ_V0] = write_ctrl_tc_sm; (*write_ctrl_tbl)[GTP_CTRL_REQ_V0] = write_ctrl_gtp_sm; + (*write_ctrl_tbl)[PDCP_CTRL_REQ_V0] = write_ctrl_pdcp_sm; + #endif + (*write_ctrl_tbl)[RAN_CONTROL_CTRL_V1_03] = write_ctrl_rc_sm; } static void init_write_subs(write_subs_fp (*write_subs_tbl)[SM_AGENT_IF_WRITE_SUBS_V0_END]) { + #if defined (NGRAN_GNB_DU) (*write_subs_tbl)[MAC_SUBS_V0] = NULL; (*write_subs_tbl)[RLC_SUBS_V0] = NULL; - (*write_subs_tbl)[PDCP_SUBS_V0] = NULL; (*write_subs_tbl)[SLICE_SUBS_V0] = NULL; + #endif + #if defined (NGRAN_GNB_CUUP) (*write_subs_tbl)[TC_SUBS_V0] = NULL; (*write_subs_tbl)[GTP_SUBS_V0] = NULL; + (*write_subs_tbl)[PDCP_SUBS_V0] = NULL; + #endif + (*write_subs_tbl)[KPM_SUBS_V3_0] = NULL; (*write_subs_tbl)[RAN_CTRL_SUBS_V1_03] = write_subs_rc_sm; } @@ -96,4 +122,3 @@ sm_io_ag_ran_t init_ran_func_ag(void) return io; } - diff --git a/openair2/LAYER2/nr_pdcp/nr_pdcp_oai_api.c b/openair2/LAYER2/nr_pdcp/nr_pdcp_oai_api.c index db57aa63f0..458a520b25 100644 --- a/openair2/LAYER2/nr_pdcp/nr_pdcp_oai_api.c +++ b/openair2/LAYER2/nr_pdcp/nr_pdcp_oai_api.c @@ -1307,3 +1307,15 @@ bool nr_pdcp_get_statistics(ue_id_t ue_id, int srb_flag, int rb_id, nr_pdcp_stat return ret; } + +int nr_pdcp_get_num_ues(ue_id_t *ue_list, int len) +{ + nr_pdcp_manager_lock(nr_pdcp_ue_manager); + int num_ues = nr_pdcp_manager_get_ue_count(nr_pdcp_ue_manager); + nr_pdcp_ue_t **nr_pdcp_ue_list = nr_pdcp_manager_get_ue_list(nr_pdcp_ue_manager); + for (int i = 0; i < num_ues && i < len; i++) + ue_list[i] = nr_pdcp_ue_list[i]->rntiMaybeUEid; + nr_pdcp_manager_unlock(nr_pdcp_ue_manager); + + return num_ues; +} diff --git a/openair2/LAYER2/nr_pdcp/nr_pdcp_oai_api.h b/openair2/LAYER2/nr_pdcp/nr_pdcp_oai_api.h index 05e18c23c2..1151c11f08 100644 --- a/openair2/LAYER2/nr_pdcp/nr_pdcp_oai_api.h +++ b/openair2/LAYER2/nr_pdcp/nr_pdcp_oai_api.h @@ -125,6 +125,8 @@ void nr_pdcp_tick(int frame, int subframe); nr_pdcp_ue_manager_t *nr_pdcp_sdap_get_ue_manager(); +int nr_pdcp_get_num_ues(ue_id_t *ue_list, int len); + bool nr_pdcp_get_statistics(ue_id_t ue_id, int srb_flag, int rb_id, nr_pdcp_statistics_t *out); #endif /* NR_PDCP_OAI_API_H */ From 9f699fcfee0679adcbe12aec230a9c5c1ccd30c7 Mon Sep 17 00:00:00 2001 From: Teodora Date: Fri, 12 Jan 2024 17:46:13 +0100 Subject: [PATCH 08/29] Add node type in read_setup_ran function --- openair2/E2AP/RAN_FUNCTION/read_setup_ran.c | 58 +++++++++++++++++++-- openair2/E2AP/RAN_FUNCTION/read_setup_ran.h | 4 +- 2 files changed, 56 insertions(+), 6 deletions(-) diff --git a/openair2/E2AP/RAN_FUNCTION/read_setup_ran.c b/openair2/E2AP/RAN_FUNCTION/read_setup_ran.c index 9967a23902..2bc481d527 100644 --- a/openair2/E2AP/RAN_FUNCTION/read_setup_ran.c +++ b/openair2/E2AP/RAN_FUNCTION/read_setup_ran.c @@ -25,18 +25,66 @@ #include #include -void read_setup_ran(void* data) +void read_setup_ran(void* data, const ngran_node_t node_type) { assert(data != NULL); #ifdef E2AP_V1 #elif defined(E2AP_V2) || defined(E2AP_V3) - *((e2ap_node_component_config_add_t*)data) = fill_e2ap_node_component_config_add(); + + arr_node_component_config_add_t* dst = (arr_node_component_config_add_t*)data; + if(node_type == ngran_gNB){ + dst->len_cca = 1; + dst->cca = calloc(1, sizeof(e2ap_node_component_config_add_t)); + assert(dst->cca != NULL); + // NGAP + dst->cca[0] = fill_ngap_e2ap_node_component_config_add(); + } else if(node_type == ngran_gNB_CU){ + dst->len_cca = 2; + dst->cca = calloc(2, sizeof(e2ap_node_component_config_add_t)); + assert(dst->cca != NULL); + // NGAP + dst->cca[0] = fill_ngap_e2ap_node_component_config_add(); + // F1AP + dst->cca[1] = fill_f1ap_e2ap_node_component_config_add(); + } else if(node_type == ngran_gNB_DU){ + dst->len_cca = 1; + dst->cca = calloc(1, sizeof(e2ap_node_component_config_add_t)); + assert(dst->cca != NULL); + // F1AP + dst->cca[0] = fill_f1ap_e2ap_node_component_config_add(); + } else if(node_type == ngran_gNB_CUCP){ + dst->len_cca = 3; + dst->cca = calloc(3, sizeof(e2ap_node_component_config_add_t)); + assert(dst->cca != NULL); + // NGAP + dst->cca[0] = fill_ngap_e2ap_node_component_config_add(); + // F1AP + dst->cca[1] = fill_f1ap_e2ap_node_component_config_add(); + // E1AP + dst->cca[2] = fill_e1ap_e2ap_node_component_config_add(); + } else if(node_type == ngran_gNB_CUUP){ + dst->len_cca = 3; + dst->cca = calloc(3, sizeof(e2ap_node_component_config_add_t)); + assert(dst->cca != NULL); + // NGAP + dst->cca[0] = fill_ngap_e2ap_node_component_config_add(); + // F1AP + dst->cca[1] = fill_f1ap_e2ap_node_component_config_add(); + // E1AP + dst->cca[2] = fill_e1ap_e2ap_node_component_config_add(); + } else if(node_type == ngran_eNB){ + dst->len_cca = 1; + dst->cca = calloc(1, sizeof(e2ap_node_component_config_add_t)); + assert(dst->cca != NULL); + // S1AP + dst->cca[0] = fill_s1ap_e2ap_node_component_config_add(); + } else { + assert(0 != 0 && "Not implemented"); + } + #else static_assert(0!=0, "Unknown E2AP version"); #endif } - - - diff --git a/openair2/E2AP/RAN_FUNCTION/read_setup_ran.h b/openair2/E2AP/RAN_FUNCTION/read_setup_ran.h index 2b4c83f2e1..42162f625c 100644 --- a/openair2/E2AP/RAN_FUNCTION/read_setup_ran.h +++ b/openair2/E2AP/RAN_FUNCTION/read_setup_ran.h @@ -22,6 +22,8 @@ #ifndef READ_SETUP_RAN_E2_AGENT_H #define READ_SETUP_RAN_E2_AGENT_H -void read_setup_ran(void* data); +#include "common/ngran_types.h" + +void read_setup_ran(void* data, const ngran_node_t node_type); #endif From dcf215e5d2f3a6697e9d1bd0aa3372e3b98b668a Mon Sep 17 00:00:00 2001 From: Teodora Date: Wed, 17 Jan 2024 14:10:04 +0100 Subject: [PATCH 09/29] Correct FlexRIC commit and update E2AP README --- openair2/E2AP/README.md | 60 +++++++++++++++++++++++++++++------------ openair2/E2AP/flexric | 2 +- 2 files changed, 44 insertions(+), 18 deletions(-) diff --git a/openair2/E2AP/README.md b/openair2/E2AP/README.md index c496605f2f..20d5dcd0ac 100644 --- a/openair2/E2AP/README.md +++ b/openair2/E2AP/README.md @@ -62,6 +62,15 @@ cd oai/ - By default, OAI will build the E2 Agent with E2AP v2 and KPM v2. If you want a different version, edit the variable E2AP\_VERSION and KPM\_VERSION at OAI's CMakeLists.txt file. +Currently available versions: +| |KPM v2.03|KPM v3.00| +|:-----------|:--------|:--------| +| E2AP v1.01 | Y | Y | +| E2AP v2.03 | Y | Y | +| E2AP v3.01 | Y | Y | + + Please note that KPM SM v2.01 is supported only in FlexRIC, but not in OAI. + ```bash cd cmake_targets/ ./build_oai -I -w SIMU --gNB --nrUE --build-e2 --ninja @@ -89,7 +98,7 @@ git submodule update ```bash git clone https://gitlab.eurecom.fr/mosaic5g/flexric flexric cd flexric/ -git checkout 93961d2480b2c7a5721e03435cb34cf9446d1ad1 +git checkout 70dd779f5339f4dac3ac176a24b49c45046a59fa ``` ### 2.2.2 Build FlexRIC @@ -104,11 +113,21 @@ sudo make install By default the service model libraries will be installed in the path `/usr/local/lib/flexric` while the configuration file in `/usr/local/etc/flexric`. -Available SMs in this version are: -* KPM v02.03 and KPM v03.00 (xapp_kpm_moni) -* RC v01.03 (xapp_kpm_rc) -* GTP (xapp_gtp_moni) -* MAC + RLC + PDCP (xapp_mac_rlc_pdcp_moni) +#### 2.2.3.1 Available Service Models +1. KPM v02.03 and KPM v03.00 (`xapp_kpm_moni`) +At the moment, the following measurements are supported in OAI RAN: +* "DRB.PdcpSduVolumeDL" +* "DRB.PdcpSduVolumeUL" +* "DRB.RlcSduDelayDl" +* "DRB.UEThpDl" +* "DRB.UEThpUl" +* "RRU.PrbTotDl" +* "RRU.PrbTotUl" + +2. RC v01.03 (`xapp_kpm_rc`) +At the moment, OAI RAN supports the RAN control function "QoS flow mapping configuration", i.e. creating a new DRB. + +3. MAC + RLC + PDCP + GTP (`xapp_gtp_mac_rlc_pdcp_moni`) If you are interested in TC and SLICE SMs, please follow the instructions at https://gitlab.eurecom.fr/mosaic5g/flexric. @@ -122,16 +141,23 @@ e2_agent = { } ``` -* start the gNB +* start the gNB-mono ```bash cd oai/cmake_targets/ran_build/build sudo ./nr-softmodem -O ../../../targets/PROJECTS/GENERIC-NR-5GC/CONF/gnb.sa.band78.fr1.106PRB.usrpb210.conf --rfsim --sa -E ``` -* if CU-DU split is used, start the gNB as follows +* if CU/DU split is used, start the gNB as follows ```bash sudo ./nr-softmodem -O --rfsim --sa -E -sudo ./nr-softmodem -O --rfsim --sa -E +sudo ./nr-softmodem -O --sa +``` + +* if CU-CP/CU-UP/DU split is used, start the gNB as follows +```bash +sudo ./nr-softmodem -O --rfsim --sa -E +sudo ./nr-softmodem -O --sa +sudo ./nr-cuup -O --sa ``` * start the nrUE @@ -152,17 +178,17 @@ cd flexric ./build/examples/xApp/c/monitor/xapp_kpm_moni ``` -* start the GTP xApp +* start the (MAC + RLC + PDCP + GTP) xApp ```bash cd flexric -./build/examples/xApp/c/monitor/xapp_gtp_moni -``` - -* start the (MAC + RLC + PDCP) xApp -```bash -cd flexric -./build/examples/xApp/c/monitor/xapp_mac_rlc_pdcp_moni +./build/examples/xApp/c/monitor/xapp_gtp_mac_rlc_pdcp_moni ``` +The latency that you observe in your monitor xApp is the latency from the E2 Agent to the nearRT-RIC and xApp. +Therefore, FlexRIC is well suited for use cases with ultra low-latency requirements. +Additionally, all the data received in the `xapp_gtp_mac_rlc_pdcp_moni` xApp is also written to /tmp/xapp_db in case that offline data processing is wanted (e.g., Machine Learning/Artificial Intelligence applications). You can browse the data using e.g., sqlitebrowser. +Please note: +* KPM SM database is not been updated, therefore commented in `flexric/src/xApp/db/sqlite3/sqlite3_wrapper.c:1152` +* RC SM database is not yet implemented. # Optional - Multiple UEs diff --git a/openair2/E2AP/flexric b/openair2/E2AP/flexric index 93961d2480..70dd779f53 160000 --- a/openair2/E2AP/flexric +++ b/openair2/E2AP/flexric @@ -1 +1 @@ -Subproject commit 93961d2480b2c7a5721e03435cb34cf9446d1ad1 +Subproject commit 70dd779f5339f4dac3ac176a24b49c45046a59fa From d89dfafb510a1912027a6dd332a1976c96bb2cb7 Mon Sep 17 00:00:00 2001 From: Robert Schmidt Date: Thu, 11 Jan 2024 13:43:31 +0100 Subject: [PATCH 10/29] Add read_version() to convert version string to numbers read_version() takes a version string in format "x.y.z" with x being major, y minor, and z patch number. It transforms reads them into separate numbers, and outputs in the correspondingly named variables. --- common/utils/utils.c | 18 ++++++++++++++++++ common/utils/utils.h | 4 ++++ 2 files changed, 22 insertions(+) diff --git a/common/utils/utils.c b/common/utils/utils.c index 831b4afbd3..66b840c7d9 100644 --- a/common/utils/utils.c +++ b/common/utils/utils.c @@ -132,3 +132,21 @@ void set_priority(int priority) abort(); } } + +/** + * @brief Convert a version string x.y.z into numbers. + * + * The function takes a version string of format "x.y.z" where x is the major + * version number, y minor, z patch. It tries to match version, and outputs the + * numbers in the correspondingly named variables. + * + * @return The number of version parts matched (should be three on x.y.z). + */ +int read_version(const char *version, uint8_t *major, uint8_t *minor, uint8_t *patch) +{ + int ret = sscanf(version, "%hhu.%hhu.%hhu", major, minor, patch); + // EOF means "end of input reached or matching failure" + if (ret == EOF) + return 3; + return ret; // ret has number of items matched +} diff --git a/common/utils/utils.h b/common/utils/utils.h index 52f94fb3ce..b1a7305cd4 100644 --- a/common/utils/utils.h +++ b/common/utils/utils.h @@ -107,6 +107,10 @@ void set_priority(int priority); char *itoa(int i); +#define STRINGIFY(S) #S +#define TO_STRING(S) STRINGIFY(S) +int read_version(const char *version, uint8_t *major, uint8_t *minor, uint8_t *patch); + #define findInList(keY, result, list, element_type) {\ int i;\ for (i=0; i Date: Fri, 24 Nov 2023 12:08:54 +0100 Subject: [PATCH 11/29] Do not require F1 System Information when handling new DU gNB-DU System Information may be sent after setup to update the system information, and the RRC can "do without". See next commit. --- openair2/F1AP/f1ap_cu_interface_management.c | 30 +++++----- openair2/RRC/NR/rrc_gNB_du.c | 58 +++++++++----------- 2 files changed, 44 insertions(+), 44 deletions(-) diff --git a/openair2/F1AP/f1ap_cu_interface_management.c b/openair2/F1AP/f1ap_cu_interface_management.c index 3f4ff32f47..fad6b100ac 100644 --- a/openair2/F1AP/f1ap_cu_interface_management.c +++ b/openair2/F1AP/f1ap_cu_interface_management.c @@ -180,20 +180,24 @@ int CU_handle_F1_SETUP_REQUEST(instance_t instance, sctp_assoc_t assoc_id, uint3 } else { AssertFatal(false, "unknown NR Mode info %d\n", servedCellInformation->nR_Mode_Info.present); } - + struct F1AP_GNB_DU_System_Information * DUsi=served_cells_item->gNB_DU_System_Information; - // System Information - req->cell[i].sys_info = calloc(1, sizeof(*req->cell[i].sys_info)); - AssertFatal(req->cell[i].sys_info != NULL, "out of memory\n"); - f1ap_gnb_du_system_info_t *sys_info = req->cell[i].sys_info; - /* mib */ - sys_info->mib = calloc(DUsi->mIB_message.size, sizeof(char)); - memcpy(sys_info->mib, DUsi->mIB_message.buf, DUsi->mIB_message.size); - sys_info->mib_length = DUsi->mIB_message.size; - /* sib1 */ - sys_info->sib1 = calloc(DUsi->sIB1_message.size, sizeof(char)); - memcpy(sys_info->sib1, DUsi->sIB1_message.buf, DUsi->sIB1_message.size); - sys_info->sib1_length = DUsi->sIB1_message.size; + if (DUsi != NULL) { + // System Information + req->cell[i].sys_info = calloc(1, sizeof(*req->cell[i].sys_info)); + AssertFatal(req->cell[i].sys_info != NULL, "out of memory\n"); + f1ap_gnb_du_system_info_t *sys_info = req->cell[i].sys_info; + /* mib */ + sys_info->mib = calloc(DUsi->mIB_message.size, sizeof(char)); + memcpy(sys_info->mib, DUsi->mIB_message.buf, DUsi->mIB_message.size); + sys_info->mib_length = DUsi->mIB_message.size; + /* sib1 */ + sys_info->sib1 = calloc(DUsi->sIB1_message.size, sizeof(char)); + memcpy(sys_info->sib1, DUsi->sIB1_message.buf, DUsi->sIB1_message.size); + sys_info->sib1_length = DUsi->sIB1_message.size; + } else { + LOG_D(F1AP, "No SysInfo in F1SetupReq, expecting GNB DU Config Update\n"); + } } itti_send_msg_to_task(TASK_RRC_GNB, GNB_MODULE_ID_TO_INSTANCE(instance), message_p); diff --git a/openair2/RRC/NR/rrc_gNB_du.c b/openair2/RRC/NR/rrc_gNB_du.c index 25763c7ae7..122ae46202 100644 --- a/openair2/RRC/NR/rrc_gNB_du.c +++ b/openair2/RRC/NR/rrc_gNB_du.c @@ -112,40 +112,34 @@ void rrc_gNB_process_f1_setup_req(f1ap_setup_req_t *req, sctp_assoc_t assoc_id) // if there is no system info or no SIB1 and we run in SA mode, we cannot handle it const f1ap_gnb_du_system_info_t *sys_info = req->cell[0].sys_info; - if (sys_info == NULL || sys_info->mib == NULL || (sys_info->sib1 == NULL && get_softmodem_params()->sa)) { - LOG_E(NR_RRC, "no system information provided by DU, rejecting\n"); - f1ap_setup_failure_t fail = {.cause = F1AP_CauseProtocol_semantic_error}; - rrc->mac_rrc.f1_setup_failure(assoc_id, &fail); - return; - } - - /* do we need the MIB? for the moment, just check it is valid, then drop it */ NR_BCCH_BCH_Message_t *mib = NULL; - asn_dec_rval_t dec_rval = - uper_decode_complete(NULL, &asn_DEF_NR_BCCH_BCH_Message, (void **)&mib, sys_info->mib, sys_info->mib_length); - if (dec_rval.code != RC_OK || mib->message.present != NR_BCCH_BCH_MessageType_PR_mib - || mib->message.choice.messageClassExtension == NULL) { - LOG_E(RRC, "Failed to decode NR_BCCH_BCH_MESSAGE (%zu bits) of DU, rejecting DU\n", dec_rval.consumed); - f1ap_setup_failure_t fail = {.cause = F1AP_CauseProtocol_semantic_error}; - rrc->mac_rrc.f1_setup_failure(assoc_id, &fail); - ASN_STRUCT_FREE(asn_DEF_NR_BCCH_BCH_Message, mib); - return; - } - NR_SIB1_t *sib1 = NULL; - if (sys_info->sib1) { - dec_rval = uper_decode_complete(NULL, &asn_DEF_NR_SIB1, (void **)&sib1, sys_info->sib1, sys_info->sib1_length); - if (dec_rval.code != RC_OK) { - LOG_E(RRC, "Failed to decode NR_SIB1 (%zu bits) of DU, rejecting DU\n", dec_rval.consumed); + + if (sys_info != NULL && sys_info->mib != NULL && !(sys_info->sib1 == NULL && get_softmodem_params()->sa)) { + asn_dec_rval_t dec_rval = + uper_decode_complete(NULL, &asn_DEF_NR_BCCH_BCH_Message, (void **)&mib, sys_info->mib, sys_info->mib_length); + if (dec_rval.code != RC_OK || mib->message.present != NR_BCCH_BCH_MessageType_PR_mib + || mib->message.choice.messageClassExtension == NULL) { + LOG_E(RRC, "Failed to decode NR_BCCH_BCH_MESSAGE (%zu bits) of DU, rejecting DU\n", dec_rval.consumed); f1ap_setup_failure_t fail = {.cause = F1AP_CauseProtocol_semantic_error}; rrc->mac_rrc.f1_setup_failure(assoc_id, &fail); - ASN_STRUCT_FREE(asn_DEF_NR_SIB1, sib1); + ASN_STRUCT_FREE(asn_DEF_NR_BCCH_BCH_Message, mib); return; } - if (LOG_DEBUGFLAG(DEBUG_ASN1)) - xer_fprint(stdout, &asn_DEF_NR_SIB1, sib1); - } + if (sys_info->sib1) { + dec_rval = uper_decode_complete(NULL, &asn_DEF_NR_SIB1, (void **)&sib1, sys_info->sib1, sys_info->sib1_length); + if (dec_rval.code != RC_OK) { + LOG_E(RRC, "Failed to decode NR_SIB1 (%zu bits) of DU, rejecting DU\n", dec_rval.consumed); + f1ap_setup_failure_t fail = {.cause = F1AP_CauseProtocol_semantic_error}; + rrc->mac_rrc.f1_setup_failure(assoc_id, &fail); + ASN_STRUCT_FREE(asn_DEF_NR_SIB1, sib1); + return; + } + if (LOG_DEBUGFLAG(DEBUG_ASN1)) + xer_fprint(stdout, &asn_DEF_NR_SIB1, sib1); + } + } LOG_I(RRC, "Accepting DU %ld (%s), sending F1 Setup Response\n", req->gNB_DU_id, req->gNB_DU_name); // we accept the DU @@ -159,10 +153,12 @@ void rrc_gNB_process_f1_setup_req(f1ap_setup_req_t *req, sctp_assoc_t assoc_id) du->setup_req = malloc(sizeof(*du->setup_req)); AssertFatal(du->setup_req != NULL, "out of memory\n"); *du->setup_req = *req; - du->mib = mib->message.choice.mib; - mib->message.choice.mib = NULL; - ASN_STRUCT_FREE(asn_DEF_NR_BCCH_BCH_MessageType, mib); - du->sib1 = sib1; + if (mib != NULL && sib1 != NULL) { + du->mib = mib->message.choice.mib; + mib->message.choice.mib = NULL; + ASN_STRUCT_FREE(asn_DEF_NR_BCCH_BCH_MessageType, mib); + du->sib1 = sib1; + } RB_INSERT(rrc_du_tree, &rrc->dus, du); rrc->num_dus++; From 3df31b0e551f7031800d5b762a774e0949f4975f Mon Sep 17 00:00:00 2001 From: Robert Schmidt Date: Wed, 3 Jan 2024 17:05:02 +0100 Subject: [PATCH 12/29] RRC: check for DU MIB1/SIB and handle accordingly For LiteOn DU, we do not receive the MIB/SIB1 in the F1 Setup Request. This is not a problem in itself, but it might happen that certain procedures are executed without MIB/SIB1. Check for it and handle appropriately: - During normal connection establishment, we might not be able to calculate measurement config - During reestablishment, we might not be able to calculate ARFCN SSB and cannot do reestablishment; do RRC setup instead. --- openair2/RRC/NR/rrc_gNB.c | 23 +++++++++++++++++++---- 1 file changed, 19 insertions(+), 4 deletions(-) diff --git a/openair2/RRC/NR/rrc_gNB.c b/openair2/RRC/NR/rrc_gNB.c index fe51b6c54e..e455acae09 100644 --- a/openair2/RRC/NR/rrc_gNB.c +++ b/openair2/RRC/NR/rrc_gNB.c @@ -576,8 +576,13 @@ static void rrc_gNB_generate_defaultRRCReconfiguration(const protocol_ctxt_t *co f1ap_served_cell_info_t *cell_info = &du->setup_req->cell[0].info; int scs = get_ssb_scs(cell_info); int band = get_dl_band(cell_info); - uint32_t ssb_arfcn = get_ssb_arfcn(cell_info, du->mib, du->sib1); - NR_MeasConfig_t *measconfig = get_defaultMeasConfig(ssb_arfcn, band, scs); + NR_MeasConfig_t *measconfig = NULL; + if (du->mib != NULL && du->sib1 != NULL) { + /* we cannot calculate the default measurement config without MIB&SIB1, as + * we don't know the DU's SSB ARFCN */ + uint32_t ssb_arfcn = get_ssb_arfcn(cell_info, du->mib, du->sib1); + measconfig = get_defaultMeasConfig(ssb_arfcn, band, scs); + } uint8_t buffer[RRC_BUF_SIZE] = {0}; int size = do_RRCReconfiguration(ue_p, @@ -1288,12 +1293,22 @@ static void rrc_handle_RRCReestablishmentRequest(gNB_RRC_INST *rrc, sctp_assoc_t return; } - rnti_t old_rnti = req->ue_Identity.c_RNTI; - rrc_gNB_ue_context_t *ue_context_p = rrc_gNB_get_ue_context_by_rnti(rrc, assoc_id, old_rnti); /* in case we need to do RRC Setup, give the UE a new random identity */ uint64_t random_value; fill_random(&random_value, sizeof(random_value)); random_value = random_value & 0x7fffffffff; /* random value is 39 bits */ + if (du->mib == NULL || du->sib1 == NULL) { + /* we don't have MIB/SIB1 of the DU, and therefore cannot generate the + * Reestablishment (as we would need the SSB's ARFCN, which we cannot + * compute). So generate RRC Setup instead */ + LOG_E(NR_RRC, "Reestablishment request: no MIB/SIB1 of DU present, cannot do reestablishment, force setup request\n"); + rrc_gNB_ue_context_t *ue_context_p = rrc_gNB_create_ue_context(assoc_id, msg->crnti, rrc, random_value, msg->gNB_DU_ue_id); + ue_context_p->ue_context.Srb[1].Active = 1; + rrc_gNB_generate_RRCSetup(0, msg->crnti, ue_context_p, msg->du2cu_rrc_container, msg->du2cu_rrc_container_length); + } + + rnti_t old_rnti = req->ue_Identity.c_RNTI; + rrc_gNB_ue_context_t *ue_context_p = rrc_gNB_get_ue_context_by_rnti(rrc, assoc_id, old_rnti); if (ue_context_p == NULL) { LOG_E(NR_RRC, "NR_RRCReestablishmentRequest without UE context, fallback to RRC setup\n"); ue_context_p = rrc_gNB_create_ue_context(assoc_id, msg->crnti, rrc, random_value, msg->gNB_DU_ue_id); From d425f08b16b82db6ee4b0467ff9a1c910c8d53d4 Mon Sep 17 00:00:00 2001 From: Giulio Carota Date: Fri, 24 Nov 2023 12:24:31 +0100 Subject: [PATCH 13/29] Add transaction ID for Setup Req&Resp and use it CU's TransactionID in F1SetupResponse didn't match Setup Request for some DUs, so implement this correctly and answer with correct transaction ID. --- openair2/COMMON/f1ap_messages_types.h | 4 ++++ openair2/F1AP/f1ap_cu_interface_management.c | 8 +++++++- openair2/RRC/NR/rrc_gNB_du.c | 2 +- 3 files changed, 12 insertions(+), 2 deletions(-) diff --git a/openair2/COMMON/f1ap_messages_types.h b/openair2/COMMON/f1ap_messages_types.h index cb4c65e9e2..e91df060a3 100644 --- a/openair2/COMMON/f1ap_messages_types.h +++ b/openair2/COMMON/f1ap_messages_types.h @@ -146,6 +146,8 @@ typedef struct f1ap_gnb_du_system_info_t { } f1ap_gnb_du_system_info_t; typedef struct f1ap_setup_req_s { + /// ulong transaction id + uint64_t transaction_id; // F1_Setup_Req payload uint64_t gNB_DU_id; @@ -179,6 +181,8 @@ typedef struct served_cells_to_activate_s { } served_cells_to_activate_t; typedef struct f1ap_setup_resp_s { + /// ulong transaction id + uint64_t transaction_id; /// string holding gNB_CU_name char *gNB_CU_name; /// number of DU cells to activate diff --git a/openair2/F1AP/f1ap_cu_interface_management.c b/openair2/F1AP/f1ap_cu_interface_management.c index fad6b100ac..a6abaf9a54 100644 --- a/openair2/F1AP/f1ap_cu_interface_management.c +++ b/openair2/F1AP/f1ap_cu_interface_management.c @@ -89,6 +89,12 @@ int CU_handle_F1_SETUP_REQUEST(instance_t instance, sctp_assoc_t assoc_id, uint3 MessageDef *message_p = itti_alloc_new_message(TASK_CU_F1, 0, F1AP_SETUP_REQ); message_p->ittiMsgHeader.originInstance = assoc_id; f1ap_setup_req_t *req = &F1AP_SETUP_REQ(message_p); + + /* Transaction ID*/ + F1AP_FIND_PROTOCOLIE_BY_ID(F1AP_F1SetupRequestIEs_t, ie, container, F1AP_ProtocolIE_ID_id_TransactionID, true); + req->transaction_id = ie->value.choice.TransactionID; + LOG_D(F1AP, "req->transaction_id %lu \n", req->transaction_id); + /* gNB_DU_id */ // this function exits if the ie is mandatory F1AP_FIND_PROTOCOLIE_BY_ID(F1AP_F1SetupRequestIEs_t, ie, container, @@ -224,7 +230,7 @@ int CU_send_F1_SETUP_RESPONSE(sctp_assoc_t assoc_id, f1ap_setup_resp_t *f1ap_set ie1->id = F1AP_ProtocolIE_ID_id_TransactionID; ie1->criticality = F1AP_Criticality_reject; ie1->value.present = F1AP_F1SetupResponseIEs__value_PR_TransactionID; - ie1->value.choice.TransactionID = F1AP_get_next_transaction_identifier(0, 0); + ie1->value.choice.TransactionID = f1ap_setup_resp->transaction_id; /* optional */ /* c2. GNB_CU_Name */ diff --git a/openair2/RRC/NR/rrc_gNB_du.c b/openair2/RRC/NR/rrc_gNB_du.c index 122ae46202..14a146154b 100644 --- a/openair2/RRC/NR/rrc_gNB_du.c +++ b/openair2/RRC/NR/rrc_gNB_du.c @@ -168,7 +168,7 @@ void rrc_gNB_process_f1_setup_req(f1ap_setup_req_t *req, sctp_assoc_t assoc_id) .nrpci = cell_info->nr_pci, .num_SI = 0, }; - f1ap_setup_resp_t resp = {.num_cells_to_activate = 1, .cells_to_activate[0] = cell}; + f1ap_setup_resp_t resp = {.transaction_id = req->transaction_id, .num_cells_to_activate = 1, .cells_to_activate[0] = cell}; if (rrc->node_name != NULL) resp.gNB_CU_name = strdup(rrc->node_name); rrc->mac_rrc.f1_setup_response(assoc_id, &resp); From 5fbd40d1490370b3a9d20d6caa164d31704e4d12 Mon Sep 17 00:00:00 2001 From: Giulio Carota Date: Mon, 18 Dec 2023 15:23:29 +0100 Subject: [PATCH 14/29] Remove debug log --- openair2/F1AP/f1ap_cu_interface_management.c | 2 -- 1 file changed, 2 deletions(-) diff --git a/openair2/F1AP/f1ap_cu_interface_management.c b/openair2/F1AP/f1ap_cu_interface_management.c index a6abaf9a54..509953f3aa 100644 --- a/openair2/F1AP/f1ap_cu_interface_management.c +++ b/openair2/F1AP/f1ap_cu_interface_management.c @@ -201,8 +201,6 @@ int CU_handle_F1_SETUP_REQUEST(instance_t instance, sctp_assoc_t assoc_id, uint3 sys_info->sib1 = calloc(DUsi->sIB1_message.size, sizeof(char)); memcpy(sys_info->sib1, DUsi->sIB1_message.buf, DUsi->sIB1_message.size); sys_info->sib1_length = DUsi->sIB1_message.size; - } else { - LOG_D(F1AP, "No SysInfo in F1SetupReq, expecting GNB DU Config Update\n"); } } From 0869aae72bafb9ad8169dfc589b913b3fe74b039 Mon Sep 17 00:00:00 2001 From: Giulio Carota Date: Mon, 18 Dec 2023 15:26:57 +0100 Subject: [PATCH 15/29] Initialize RRC's DU SetupReq to zero --- openair2/RRC/NR/rrc_gNB_du.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/openair2/RRC/NR/rrc_gNB_du.c b/openair2/RRC/NR/rrc_gNB_du.c index 14a146154b..a44ca4d6cf 100644 --- a/openair2/RRC/NR/rrc_gNB_du.c +++ b/openair2/RRC/NR/rrc_gNB_du.c @@ -150,7 +150,7 @@ void rrc_gNB_process_f1_setup_req(f1ap_setup_req_t *req, sctp_assoc_t assoc_id) /* ITTI will free the setup request message via free(). So the memory * "inside" of the message will remain, but the "outside" container no, so * allocate memory and copy it in */ - du->setup_req = malloc(sizeof(*du->setup_req)); + du->setup_req = calloc(1,sizeof(*du->setup_req)); AssertFatal(du->setup_req != NULL, "out of memory\n"); *du->setup_req = *req; if (mib != NULL && sib1 != NULL) { From f021b8b5be6b4db7ffb121eff87d1392bd1eede0 Mon Sep 17 00:00:00 2001 From: Robert Schmidt Date: Wed, 3 Jan 2024 17:34:07 +0100 Subject: [PATCH 16/29] Bugfix: only fill DU system information if SA In NSA, we don't have SIB1. However, the DU system information requires both MIB and SIB1, but is itself optional. So, in NSA, don't fill the DU system information. --- openair2/GNB_APP/gnb_config.c | 24 +++++++++++++----------- 1 file changed, 13 insertions(+), 11 deletions(-) diff --git a/openair2/GNB_APP/gnb_config.c b/openair2/GNB_APP/gnb_config.c index bc12793140..7e102e2a5e 100644 --- a/openair2/GNB_APP/gnb_config.c +++ b/openair2/GNB_APP/gnb_config.c @@ -1153,18 +1153,20 @@ static f1ap_setup_req_t *RC_read_F1Setup(uint64_t id, req->cell[0].info.measurement_timing_information = "0"; - int buf_len = 3; // this is what we assume in monolithic - req->cell[0].sys_info = calloc(1, sizeof(*req->cell[0].sys_info)); - AssertFatal(req->cell[0].sys_info != NULL, "out of memory\n"); - f1ap_gnb_du_system_info_t *sys_info = req->cell[0].sys_info; - sys_info->mib = calloc(buf_len, sizeof(*sys_info->mib)); - DevAssert(sys_info->mib != NULL); - DevAssert(mib != NULL); - sys_info->mib_length = encode_MIB_NR(mib, 0, sys_info->mib, buf_len); - DevAssert(sys_info->mib_length == buf_len); - if (get_softmodem_params()->sa) { - // in NSA we don't transmit SIB1 + // in NSA we don't transmit SIB1, so cannot fill DU system information + // so cannot send MIB either + + int buf_len = 3; // this is what we assume in monolithic + req->cell[0].sys_info = calloc(1, sizeof(*req->cell[0].sys_info)); + AssertFatal(req->cell[0].sys_info != NULL, "out of memory\n"); + f1ap_gnb_du_system_info_t *sys_info = req->cell[0].sys_info; + sys_info->mib = calloc(buf_len, sizeof(*sys_info->mib)); + DevAssert(sys_info->mib != NULL); + DevAssert(mib != NULL); + sys_info->mib_length = encode_MIB_NR(mib, 0, sys_info->mib, buf_len); + DevAssert(sys_info->mib_length == buf_len); + DevAssert(sib1 != NULL); NR_SIB1_t *bcch_SIB1 = sib1->message.choice.c1->choice.systemInformationBlockType1; sys_info->sib1 = calloc(NR_MAX_SIB_LENGTH / 8, sizeof(*sys_info->sib1)); From e379291ffd78d3e081a0c0d701b842390f9aa874 Mon Sep 17 00:00:00 2001 From: Robert Schmidt Date: Wed, 3 Jan 2024 17:38:28 +0100 Subject: [PATCH 17/29] F1AP: Bugfix: system information is not required The F1AP DU F1 Setup Request encoder made the sytem information required, but it is optional. Handle correctly. --- openair2/F1AP/f1ap_du_interface_management.c | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/openair2/F1AP/f1ap_du_interface_management.c b/openair2/F1AP/f1ap_du_interface_management.c index 91454a8b66..322c31e61b 100644 --- a/openair2/F1AP/f1ap_du_interface_management.c +++ b/openair2/F1AP/f1ap_du_interface_management.c @@ -274,12 +274,16 @@ int DU_send_F1_SETUP_REQUEST(sctp_assoc_t assoc_id, f1ap_setup_req_t *setup_req) OCTET_STRING_fromBuf(&served_cell_information->measurementTimingConfiguration, measurementTimingConfiguration, strlen(measurementTimingConfiguration)); - asn1cCalloc(gnb_du_served_cells_item->gNB_DU_System_Information, gNB_DU_System_Information); + /* 4.1.2 gNB-DU System Information */ - AssertFatal(setup_req->cell[i].sys_info != NULL, "assume that sys_info is present, which is not the case\n"); - const f1ap_gnb_du_system_info_t *sys_info = setup_req->cell[i].sys_info; - OCTET_STRING_fromBuf(&gNB_DU_System_Information->mIB_message, (const char *)sys_info->mib, sys_info->mib_length); - OCTET_STRING_fromBuf(&gNB_DU_System_Information->sIB1_message, (const char *)sys_info->sib1, sys_info->sib1_length); + if (setup_req->cell[i].sys_info != NULL) { + asn1cCalloc(gnb_du_served_cells_item->gNB_DU_System_Information, gNB_DU_System_Information); + const f1ap_gnb_du_system_info_t *sys_info = setup_req->cell[i].sys_info; + AssertFatal(sys_info->mib != NULL, "MIB must be present in DU sys info\n"); + OCTET_STRING_fromBuf(&gNB_DU_System_Information->mIB_message, (const char *)sys_info->mib, sys_info->mib_length); + AssertFatal(sys_info->sib1 != NULL, "SIB1 must be present in DU sys info\n"); + OCTET_STRING_fromBuf(&gNB_DU_System_Information->sIB1_message, (const char *)sys_info->sib1, sys_info->sib1_length); + } } /* mandatory */ From 20710c9a91ef7fec2ab4077e58dad0c7646ced10 Mon Sep 17 00:00:00 2001 From: Giulio Carota Date: Fri, 24 Nov 2023 12:34:05 +0100 Subject: [PATCH 18/29] Implement F1AP RRC Version encoding/decoding in CU&DU RRC Version is a required IE. Hence, implement the encoder and decoder for this message. At the DU and CU, read the RRC Version we use and fill the corresponding field. Co-authored-by: Robert Schmidt --- openair2/COMMON/f1ap_messages_types.h | 9 +++- openair2/F1AP/f1ap_cu_interface_management.c | 46 ++++++++++++++++ openair2/F1AP/f1ap_du_interface_management.c | 52 +++++++++++++++---- openair2/GNB_APP/gnb_config.c | 3 ++ .../LAYER2/NR_MAC_gNB/mac_rrc_dl_handler.c | 1 + .../LAYER2/NR_MAC_gNB/mac_rrc_ul_direct.c | 1 + openair2/LAYER2/NR_MAC_gNB/mac_rrc_ul_f1ap.c | 1 + openair2/RRC/NR/rrc_gNB_du.c | 10 +++- 8 files changed, 111 insertions(+), 12 deletions(-) diff --git a/openair2/COMMON/f1ap_messages_types.h b/openair2/COMMON/f1ap_messages_types.h index e91df060a3..c5ffe0f738 100644 --- a/openair2/COMMON/f1ap_messages_types.h +++ b/openair2/COMMON/f1ap_messages_types.h @@ -152,7 +152,10 @@ typedef struct f1ap_setup_req_s { // F1_Setup_Req payload uint64_t gNB_DU_id; char *gNB_DU_name; - + + /// rrc version + uint8_t rrc_ver[3]; + /// number of DU cells available uint16_t num_cells_available; //0< num_cells_available <= 512; struct { @@ -188,6 +191,10 @@ typedef struct f1ap_setup_resp_s { /// number of DU cells to activate uint16_t num_cells_to_activate; //0< num_cells_to_activate <= 512; served_cells_to_activate_t cells_to_activate[F1AP_MAX_NB_CELLS]; + + /// rrc version + uint8_t rrc_ver[3]; + } f1ap_setup_resp_t; typedef struct f1ap_gnb_cu_configuration_update_s { diff --git a/openair2/F1AP/f1ap_cu_interface_management.c b/openair2/F1AP/f1ap_cu_interface_management.c index 509953f3aa..41c783a2db 100644 --- a/openair2/F1AP/f1ap_cu_interface_management.c +++ b/openair2/F1AP/f1ap_cu_interface_management.c @@ -204,6 +204,22 @@ int CU_handle_F1_SETUP_REQUEST(instance_t instance, sctp_assoc_t assoc_id, uint3 } } + /* Handle RRC Version */ + F1AP_FIND_PROTOCOLIE_BY_ID(F1AP_F1SetupRequestIEs_t, ie, container, + F1AP_ProtocolIE_ID_id_GNB_DU_RRC_Version, true); + // Latest RRC Version: "This IE is not used in this release." + // BIT_STRING_to_uint8(&ie->value.choice.RRC_Version.latest_RRC_Version); + if (ie->value.choice.RRC_Version.iE_Extensions) { + F1AP_ProtocolExtensionContainer_10696P228_t *ext = + (F1AP_ProtocolExtensionContainer_10696P228_t *)ie->value.choice.RRC_Version.iE_Extensions; + if (ext->list.count > 0) { + F1AP_RRC_Version_ExtIEs_t *rrcext = ext->list.array[0]; + OCTET_STRING_t *os = &rrcext->extensionValue.choice.OCTET_STRING_SIZE_3_; + DevAssert(os->size == 3); + for (int i = 0; i < 3; ++i) + req->rrc_ver[i] = os->buf[i]; + } + } itti_send_msg_to_task(TASK_RRC_GNB, GNB_MODULE_ID_TO_INSTANCE(instance), message_p); return 0; @@ -300,6 +316,36 @@ int CU_send_F1_SETUP_RESPONSE(sctp_assoc_t assoc_id, f1ap_setup_resp_t *f1ap_set } } + /* c5. RRC VERSION */ + asn1cSequenceAdd(out->protocolIEs.list, F1AP_F1SetupResponseIEs_t, ie4); + ie4->id = F1AP_ProtocolIE_ID_id_GNB_CU_RRC_Version; + ie4->criticality = F1AP_Criticality_reject; + ie4->value.present = F1AP_F1SetupResponseIEs__value_PR_RRC_Version; + // RRC Version: "This IE is not used in this release." + // we put one bit for each byte in rrc_ver that is != 0 + uint8_t bits = 0; + for (int i = 0; i < 3; ++i) + bits |= (f1ap_setup_resp->rrc_ver[i] != 0) << i; + BIT_STRING_t *bs = &ie4->value.choice.RRC_Version.latest_RRC_Version; + bs->buf = calloc(1, sizeof(char)); + AssertFatal(bs->buf != NULL, "out of memory\n"); + bs->buf[0] = bits; + bs->size = 1; + bs->bits_unused = 5; + + F1AP_ProtocolExtensionContainer_10696P228_t *p = (F1AP_ProtocolExtensionContainer_10696P228_t*)calloc(1, sizeof(F1AP_ProtocolExtensionContainer_10696P228_t)); + asn1cSequenceAdd(p->list, F1AP_RRC_Version_ExtIEs_t, rrcv_ext); + rrcv_ext->id = F1AP_ProtocolIE_ID_id_latest_RRC_Version_Enhanced; + rrcv_ext->criticality = F1AP_Criticality_ignore; + rrcv_ext->extensionValue.present = F1AP_RRC_Version_ExtIEs__extensionValue_PR_OCTET_STRING_SIZE_3_; + OCTET_STRING_t *os = &rrcv_ext->extensionValue.choice.OCTET_STRING_SIZE_3_; + os->size = 3; + os->buf = malloc(3 * sizeof(*os->buf)); + AssertFatal(os->buf != NULL, "out of memory\n"); + for (int i = 0; i < 3; ++i) + os->buf[i] = f1ap_setup_resp->rrc_ver[i]; + ie4->value.choice.RRC_Version.iE_Extensions = (struct F1AP_ProtocolExtensionContainer *)p; + /* encode */ if (f1ap_encode_pdu(&pdu, &buffer, &len) < 0) { LOG_E(F1AP, "Failed to encode F1 setup response\n"); diff --git a/openair2/F1AP/f1ap_du_interface_management.c b/openair2/F1AP/f1ap_du_interface_management.c index 322c31e61b..3fa2c1b65d 100644 --- a/openair2/F1AP/f1ap_du_interface_management.c +++ b/openair2/F1AP/f1ap_du_interface_management.c @@ -289,14 +289,34 @@ int DU_send_F1_SETUP_REQUEST(sctp_assoc_t assoc_id, f1ap_setup_req_t *setup_req) /* mandatory */ /* c5. RRC VERSION */ asn1cSequenceAdd(f1Setup->protocolIEs.list, F1AP_F1SetupRequestIEs_t, ie2); - ie2->id = F1AP_ProtocolIE_ID_id_GNB_DU_RRC_Version; - ie2->criticality = F1AP_Criticality_reject; - ie2->value.present = F1AP_F1SetupRequestIEs__value_PR_RRC_Version; - ie2->value.choice.RRC_Version.latest_RRC_Version.buf=calloc(1,sizeof(char)); - ie2->value.choice.RRC_Version.latest_RRC_Version.buf[0] = 0xe0; - ie2->value.choice.RRC_Version.latest_RRC_Version.size = 1; - ie2->value.choice.RRC_Version.latest_RRC_Version.bits_unused = 5; + ie2->id = F1AP_ProtocolIE_ID_id_GNB_DU_RRC_Version; + ie2->criticality = F1AP_Criticality_reject; + ie2->value.present = F1AP_F1SetupRequestIEs__value_PR_RRC_Version; + // RRC Version: "This IE is not used in this release." + // we put one bit for each byte in rrc_ver that is != 0 + uint8_t bits = 0; + for (int i = 0; i < 3; ++i) + bits |= (setup_req->rrc_ver[i] != 0) << i; + BIT_STRING_t *bs = &ie2->value.choice.RRC_Version.latest_RRC_Version; + bs->buf = calloc(1, sizeof(char)); + AssertFatal(bs->buf != NULL, "out of memory\n"); + bs->buf[0] = bits; + bs->size = 1; + bs->bits_unused = 5; + F1AP_ProtocolExtensionContainer_10696P228_t *p = calloc(1, sizeof(F1AP_ProtocolExtensionContainer_10696P228_t)); + asn1cSequenceAdd(p->list, F1AP_RRC_Version_ExtIEs_t, rrcv_ext); + rrcv_ext->id = F1AP_ProtocolIE_ID_id_latest_RRC_Version_Enhanced; + rrcv_ext->criticality = F1AP_Criticality_ignore; + rrcv_ext->extensionValue.present = F1AP_RRC_Version_ExtIEs__extensionValue_PR_OCTET_STRING_SIZE_3_; + OCTET_STRING_t *os = &rrcv_ext->extensionValue.choice.OCTET_STRING_SIZE_3_; + os->size = 3; + os->buf = malloc(3 * sizeof(*os->buf)); + AssertFatal(os->buf != NULL, "out of memory\n"); + for (int i = 0; i < 3; ++i) + os->buf[i] = setup_req->rrc_ver[i]; + ie2->value.choice.RRC_Version.iE_Extensions = (struct F1AP_ProtocolExtensionContainer*)p; + /* encode */ if (f1ap_encode_pdu(&pdu, &buffer, &len) < 0) { LOG_E(F1AP, "Failed to encode F1 setup request\n"); @@ -343,7 +363,7 @@ int DU_handle_F1_SETUP_RESPONSE(instance_t instance, sctp_assoc_t assoc_id, uint AssertFatal(ie->criticality == F1AP_Criticality_ignore, "ie->criticality != F1AP_Criticality_ignore\n"); AssertFatal(ie->value.present == F1AP_F1SetupResponseIEs__value_PR_GNB_CU_Name, - "ie->value.present != F1AP_F1SetupResponseIEs__value_PR_TransactionID\n"); + "ie->value.present != F1AP_F1SetupResponseIEs__value_PR_GNB_CU_Name\n"); resp.gNB_CU_name = malloc(ie->value.choice.GNB_CU_Name.size+1); memcpy(resp.gNB_CU_name, ie->value.choice.GNB_CU_Name.buf, ie->value.choice.GNB_CU_Name.size); resp.gNB_CU_name[ie->value.choice.GNB_CU_Name.size] = '\0'; @@ -351,7 +371,21 @@ int DU_handle_F1_SETUP_RESPONSE(instance_t instance, sctp_assoc_t assoc_id, uint break; case F1AP_ProtocolIE_ID_id_GNB_CU_RRC_Version: - LOG_D(F1AP, "F1AP: Received GNB-CU-RRC-Version, ignoring\n"); + AssertFatal(ie->criticality == F1AP_Criticality_reject, + "ie->criticality != F1AP_Criticality_reject\n"); + AssertFatal(ie->value.present == F1AP_F1SetupResponseIEs__value_PR_RRC_Version, + "ie->value.present != F1AP_F1SetupResponseIEs__value_PR_RRC_Version\n"); + // RRC Version: "This IE is not used in this release." + if(ie->value.choice.RRC_Version.iE_Extensions) { + F1AP_ProtocolExtensionContainer_10696P228_t *ext = + (F1AP_ProtocolExtensionContainer_10696P228_t *)ie->value.choice.RRC_Version.iE_Extensions; + if(ext->list.count > 0){ + F1AP_RRC_Version_ExtIEs_t *rrcext = ext->list.array[0]; + OCTET_STRING_t *os = &rrcext->extensionValue.choice.OCTET_STRING_SIZE_3_; + for (int i = 0; i < 3; i++) + resp.rrc_ver[i] = os->buf[i]; + } + } break; case F1AP_ProtocolIE_ID_id_Cells_to_be_Activated_List: { diff --git a/openair2/GNB_APP/gnb_config.c b/openair2/GNB_APP/gnb_config.c index 7e102e2a5e..a738012731 100644 --- a/openair2/GNB_APP/gnb_config.c +++ b/openair2/GNB_APP/gnb_config.c @@ -1175,6 +1175,9 @@ static f1ap_setup_req_t *RC_read_F1Setup(uint64_t id, sys_info->sib1_length = (enc_rval.encoded + 7) / 8; } + int num = read_version(TO_STRING(NR_RRC_VERSION), &req->rrc_ver[0], &req->rrc_ver[1], &req->rrc_ver[2]); + AssertFatal(num == 3, "could not read RRC version string %s\n", TO_STRING(NR_RRC_VERSION)); + return req; } diff --git a/openair2/LAYER2/NR_MAC_gNB/mac_rrc_dl_handler.c b/openair2/LAYER2/NR_MAC_gNB/mac_rrc_dl_handler.c index ab7977d4dc..c764ece582 100644 --- a/openair2/LAYER2/NR_MAC_gNB/mac_rrc_dl_handler.c +++ b/openair2/LAYER2/NR_MAC_gNB/mac_rrc_dl_handler.c @@ -52,6 +52,7 @@ static bool check_plmn_identity(const f1ap_plmn_t *check_plmn, const f1ap_plmn_t void f1_setup_response(const f1ap_setup_resp_t *resp) { LOG_I(MAC, "received F1 Setup Response from CU %s\n", resp->gNB_CU_name); + LOG_I(MAC, "CU uses RRC version %d.%d.%d\n", resp->rrc_ver[0], resp->rrc_ver[1], resp->rrc_ver[2]); if (resp->num_cells_to_activate == 0) { LOG_W(NR_MAC, "no cell to activate: cell remains blocked\n"); diff --git a/openair2/LAYER2/NR_MAC_gNB/mac_rrc_ul_direct.c b/openair2/LAYER2/NR_MAC_gNB/mac_rrc_ul_direct.c index 19289597e3..b9ca19300a 100644 --- a/openair2/LAYER2/NR_MAC_gNB/mac_rrc_ul_direct.c +++ b/openair2/LAYER2/NR_MAC_gNB/mac_rrc_ul_direct.c @@ -61,6 +61,7 @@ static void f1_setup_request_direct(const f1ap_setup_req_t *req) } } } + memcpy(f1ap_msg->rrc_ver, req->rrc_ver, sizeof(req->rrc_ver)); itti_send_msg_to_task(TASK_RRC_GNB, 0, msg); } diff --git a/openair2/LAYER2/NR_MAC_gNB/mac_rrc_ul_f1ap.c b/openair2/LAYER2/NR_MAC_gNB/mac_rrc_ul_f1ap.c index 8ee2913e0c..8e0a04cac8 100644 --- a/openair2/LAYER2/NR_MAC_gNB/mac_rrc_ul_f1ap.c +++ b/openair2/LAYER2/NR_MAC_gNB/mac_rrc_ul_f1ap.c @@ -93,6 +93,7 @@ static void f1_setup_request_f1ap(const f1ap_setup_req_t *req) } } } + memcpy(f1ap_setup->rrc_ver, req->rrc_ver, sizeof(req->rrc_ver)); F1AP_DU_REGISTER_REQ(msg).net_config = read_DU_IP_config(&RC.nrmac[0]->eth_params_n); diff --git a/openair2/RRC/NR/rrc_gNB_du.c b/openair2/RRC/NR/rrc_gNB_du.c index a44ca4d6cf..dc78d534e4 100644 --- a/openair2/RRC/NR/rrc_gNB_du.c +++ b/openair2/RRC/NR/rrc_gNB_du.c @@ -141,6 +141,7 @@ void rrc_gNB_process_f1_setup_req(f1ap_setup_req_t *req, sctp_assoc_t assoc_id) } } LOG_I(RRC, "Accepting DU %ld (%s), sending F1 Setup Response\n", req->gNB_DU_id, req->gNB_DU_name); + LOG_I(RRC, "DU uses RRC version %u.%u.%u\n", req->rrc_ver[0], req->rrc_ver[1], req->rrc_ver[2]); // we accept the DU nr_rrc_du_container_t *du = calloc(1, sizeof(*du)); @@ -167,8 +168,13 @@ void rrc_gNB_process_f1_setup_req(f1ap_setup_req_t *req, sctp_assoc_t assoc_id) .nr_cellid = cell_info->nr_cellid, .nrpci = cell_info->nr_pci, .num_SI = 0, - }; - f1ap_setup_resp_t resp = {.transaction_id = req->transaction_id, .num_cells_to_activate = 1, .cells_to_activate[0] = cell}; + }; + + f1ap_setup_resp_t resp = {.transaction_id = req->transaction_id, + .num_cells_to_activate = 1, + .cells_to_activate[0] = cell}; + int num = read_version(TO_STRING(NR_RRC_VERSION), &resp.rrc_ver[0], &resp.rrc_ver[1], &resp.rrc_ver[2]); + AssertFatal(num == 3, "could not read RRC version string %s\n", TO_STRING(NR_RRC_VERSION)); if (rrc->node_name != NULL) resp.gNB_CU_name = strdup(rrc->node_name); rrc->mac_rrc.f1_setup_response(assoc_id, &resp); From c8afb25d3b08dc0e9fd51b1dcb92a366ffbbce9e Mon Sep 17 00:00:00 2001 From: francescomani Date: Wed, 8 Mar 2023 11:10:48 +0100 Subject: [PATCH 19/29] moving generation of precoding matrices at MAC and trying to adapt to SCF (1st version) --- common/utils/nr/nr_common.h | 2 + .../nfapi/public_inc/nfapi_nr_interface_scf.h | 87 +-- openair1/PHY/INIT/nr_init.c | 391 +----------- openair1/PHY/MODULATION/nr_modulation.c | 86 +-- openair1/PHY/MODULATION/nr_modulation.h | 7 +- openair1/PHY/NR_TRANSPORT/nr_dlsch.c | 88 ++- openair1/PHY/defs_gNB.h | 7 - openair1/PHY/defs_nr_common.h | 1 - openair1/SIMULATION/NR_PHY/dlsim.c | 36 +- openair2/LAYER2/NR_MAC_gNB/config.c | 598 +++++++++++++----- .../LAYER2/NR_MAC_gNB/gNB_scheduler_dlsch.c | 3 +- .../NR_MAC_gNB/gNB_scheduler_primitives.c | 27 +- openair2/LAYER2/NR_MAC_gNB/mac_proto.h | 3 +- openair2/LAYER2/NR_MAC_gNB/nr_mac_gNB.h | 1 + 14 files changed, 631 insertions(+), 706 deletions(-) diff --git a/common/utils/nr/nr_common.h b/common/utils/nr/nr_common.h index 7764b0ee8f..3cc3844cc4 100644 --- a/common/utils/nr/nr_common.h +++ b/common/utils/nr/nr_common.h @@ -76,6 +76,8 @@ static inline const char *rnti_types(nr_rnti_type_t rr) } #undef R +#define NR_MAX_NB_LAYERS 4 // 8 + typedef enum { nr_FR1 = 0, nr_FR2 diff --git a/nfapi/open-nFAPI/nfapi/public_inc/nfapi_nr_interface_scf.h b/nfapi/open-nFAPI/nfapi/public_inc/nfapi_nr_interface_scf.h index 8f4d083256..a70e18af11 100644 --- a/nfapi/open-nFAPI/nfapi/public_inc/nfapi_nr_interface_scf.h +++ b/nfapi/open-nFAPI/nfapi/public_inc/nfapi_nr_interface_scf.h @@ -74,17 +74,17 @@ typedef enum { NFAPI_NR_PHY_MSG_TYPE_RACH_INDICATION= 0X89, //RESERVED 0X8a ~ 0xff NFAPI_NR_PHY_MSG_TYPE_PNF_PARAM_REQUEST = 0x0100, - NFAPI_NR_PHY_MSG_TYPE_PNF_PARAM_RESPONSE = 0x0101, - NFAPI_NR_PHY_MSG_TYPE_PNF_CONFIG_REQUEST= 0x0102, - NFAPI_NR_PHY_MSG_TYPE_PNF_CONFIG_RESPONSE= 0x0103, - NFAPI_NR_PHY_MSG_TYPE_PNF_START_REQUEST= 0x0104, - NFAPI_NR_PHY_MSG_TYPE_PNF_START_RESPONSE= 0x0105, - NFAPI_NR_PHY_MSG_TYPE_PNF_STOP_REQUEST= 0x0106, - NFAPI_NR_PHY_MSG_TYPE_PNF_STOP_RESPONSE= 0x0107, + NFAPI_NR_PHY_MSG_TYPE_PNF_PARAM_RESPONSE = 0x0101, + NFAPI_NR_PHY_MSG_TYPE_PNF_CONFIG_REQUEST= 0x0102, + NFAPI_NR_PHY_MSG_TYPE_PNF_CONFIG_RESPONSE= 0x0103, + NFAPI_NR_PHY_MSG_TYPE_PNF_START_REQUEST= 0x0104, + NFAPI_NR_PHY_MSG_TYPE_PNF_START_RESPONSE= 0x0105, + NFAPI_NR_PHY_MSG_TYPE_PNF_STOP_REQUEST= 0x0106, + NFAPI_NR_PHY_MSG_TYPE_PNF_STOP_RESPONSE= 0x0107, NFAPI_NR_PHY_MSG_TYPE_UL_NODE_SYNC = 0x0180, - NFAPI_NR_PHY_MSG_TYPE_DL_NODE_SYNC, - NFAPI_NR_PHY_MSG_TYPE_TIMING_INFO + NFAPI_NR_PHY_MSG_TYPE_DL_NODE_SYNC, + NFAPI_NR_PHY_MSG_TYPE_TIMING_INFO } nfapi_nr_phy_msg_type_e; // SCF222_5G-FAPI_PHY_SPI_Specificayion.pdf Section 3.3 @@ -449,6 +449,26 @@ typedef struct } nfapi_nr_measurement_config_t; +// Table 3–62 Precoding matrix (PM) PDU (v.222.10.04) +typedef struct { + int16_t precoder_weight_Re; + int16_t precoder_weight_Im; +} nfapi_nr_pm_weights_t; + + +typedef struct { + uint16_t pm_idx; + uint16_t numLayers; + uint16_t num_ant_ports; + nfapi_nr_pm_weights_t weights[4][4]; // TODO temporary hardcoding +} nfapi_nr_pm_pdu_t; + + +typedef struct { + uint16_t num_pm_idx; + nfapi_nr_pm_pdu_t *pmi_pdu; +} nfapi_nr_pm_list_t; + // ERROR enums typedef enum { // Table 2-22 NFAPI_NR_PARAM_MSG_OK = 0, @@ -560,6 +580,7 @@ typedef struct { nfapi_nr_tdd_table_t tdd_table; nfapi_nr_measurement_config_t measurement_config; nfapi_nr_nfapi_t nfapi_config; + nfapi_nr_pm_list_t pmi_list; } nfapi_nr_config_request_scf_t; @@ -592,24 +613,24 @@ typedef struct { //3.3.4 STOP typedef struct { - nfapi_p4_p5_message_header_t header; - nfapi_vendor_extension_tlv_t vendor_extension; + nfapi_p4_p5_message_header_t header; + nfapi_vendor_extension_tlv_t vendor_extension; } nfapi_nr_stop_request_t; typedef struct { - nfapi_p4_p5_message_header_t header; - nfapi_vendor_extension_tlv_t vendor_extension; + nfapi_p4_p5_message_header_t header; + nfapi_vendor_extension_tlv_t vendor_extension; } nfapi_nr_stop_indication_t; typedef enum { - NFAPI_NR_STOP_MSG_INVALID_STATE + NFAPI_NR_STOP_MSG_INVALID_STATE } nfapi_nr_stop_errors_e; //3.3.5 PHY Notifications typedef enum { NFAPI_NR_PHY_API_MSG_OK =0x0, - NFAPI_NR_PHY_API_MSG_INVALID_STATE =0x1, + NFAPI_NR_PHY_API_MSG_INVALID_STATE =0x1, NFAPI_NR_PHY_API_MSG_INVALID_CONFIG =0x2, NFAPI_NR_PHY_API_SFN_OUT_OF_SYNC =0X3, NFAPI_NR_PHY_API_MSG_SLOR_ERR =0X4, @@ -620,7 +641,7 @@ typedef enum { } nfapi_nr_phy_notifications_errors_e; typedef struct { - uint16_t sfn; //0~1023 + uint16_t sfn; //0~1023 uint16_t slot;//0~319 nfapi_nr_phy_msg_type_e msg_id;//Indicate which message received by the PHY has an error. Values taken from Table 3-4. nfapi_nr_phy_notifications_errors_e error_code; @@ -632,42 +653,22 @@ typedef struct { //table 3-32 //? typedef struct { - uint16_t beam_idx; //0~65535 + uint16_t beam_idx; //0~65535 } nfapi_nr_dig_beam_t; typedef struct { - uint16_t dig_beam_weight_Re; + uint16_t dig_beam_weight_Re; uint16_t dig_beam_weight_Im; } nfapi_nr_txru_t; typedef struct { - uint16_t num_dig_beams; //0~65535 + uint16_t num_dig_beams; //0~65535 uint16_t num_txrus; //0~65535 nfapi_nr_dig_beam_t* dig_beam_list; nfapi_nr_txru_t* txru_list; } nfapi_nr_dbt_pdu_t; -//table 3-33 -//? -typedef struct { - uint16_t num_ant_ports; - int16_t precoder_weight_Re; - int16_t precoder_weight_Im; -} nfapi_nr_num_ant_ports_t; - -typedef struct { - uint16_t numLayers; //0~65535 - nfapi_nr_num_ant_ports_t* num_ant_ports_list; -} nfapi_nr_num_layers_t; - -typedef struct { - uint16_t pm_idx; //0~65535 - nfapi_nr_num_layers_t* num_layers_list; //0~65535 - //nfapi_nr_num_ant_ports_t* num_ant_ports_list; -} nfapi_nr_pm_pdu_t; - - // Section 3.4 // Section 3.4.1 slot indication @@ -678,7 +679,7 @@ typedef struct { typedef struct { nfapi_p7_message_header_t header; - uint16_t sfn; //0->1023 + uint16_t sfn; //0->1023 uint16_t slot;//0->319 } nfapi_nr_slot_indication_scf_t; @@ -1441,7 +1442,7 @@ typedef struct { //3.4.5 slot_errors typedef enum { - NFAPI_NR_SLOT_UL_TTI_MSG_INVALID_STATE, + NFAPI_NR_SLOT_UL_TTI_MSG_INVALID_STATE, NFAPI_NR_SLOT_UL_TTI_SFN_OUT_OF_SYNC, NFAPI_NR_SLOT_UL_TTI_MSG_BCH_MISSING, NFAPI_NR_SLOT_UL_TTI_MSG_SLOT_ERR @@ -1449,14 +1450,14 @@ typedef enum { } nfapi_nr_slot_errors_ul_tti_e; typedef enum { - NFAPI_NR_SLOT_DL_TTI_MSG_INVALID_STATE, + NFAPI_NR_SLOT_DL_TTI_MSG_INVALID_STATE, NFAPI_NR_SLOT_DL_TTI_MSG_SLOT_ERR } nfapi_nr_slot_errors_dl_tti_e; typedef enum { - NFAPI_NR_SLOT_UL_DCI_MSG_INVALID_STATE, + NFAPI_NR_SLOT_UL_DCI_MSG_INVALID_STATE, NFAPI_NR_SLOT_UL_DCI_MSG_INVALID_SFN, NFAPI_NR_SLOT_UL_DCI_MSG_UL_DCI_ERR diff --git a/openair1/PHY/INIT/nr_init.c b/openair1/PHY/INIT/nr_init.c index 9a83ed801b..06c26b6923 100644 --- a/openair1/PHY/INIT/nr_init.c +++ b/openair1/PHY/INIT/nr_init.c @@ -99,381 +99,6 @@ void reset_active_stats(PHY_VARS_gNB *gNB, int frame) } } -int init_codebook_gNB(PHY_VARS_gNB *gNB) { - - if(gNB->frame_parms.nb_antennas_tx>1){ - int CSI_RS_antenna_ports = gNB->frame_parms.nb_antennas_tx; - //NR Codebook Generation for codebook type1 SinglePanel - int N1 = gNB->ap_N1; - int N2 = gNB->ap_N2; - //Uniform Planner Array: UPA - // X X X X ... X - // X X X X ... X - // N2 . . . . ... . - // X X X X ... X - // |<-----N1---->| - int x_polarization = gNB->ap_XP; - AssertFatal(CSI_RS_antenna_ports == N1 * N2 * x_polarization, - "Nb of antenna ports at PHY %d does not correspond to what passed down with fapi %d\n", - N1 * N2 * x_polarization, CSI_RS_antenna_ports); - - //Get the uniform planar array parameters - // To be confirmed - int O2 = N2 > 1 ? 4 : 1; //Vertical beam oversampling (1 or 4) - int O1 = CSI_RS_antenna_ports > 2 ? 4 : 1; //Horizontal beam oversampling (1 or 4) - - // num of allowed k1 and k2 according to 5.2.2.2.1-3 and -4 in 38.214 - int K1; - if(N2 == N1 || N1 == 2) - K1 = 2; - else if (N2 == 1) - K1 = 5; - else - K1 = 3; - int K2 = N2 > 1 ? 2 : 1; - - // Generation of codebook Type1 with codebookMode 1 (CSI_RS_antenna_ports < 16) - if (CSI_RS_antenna_ports < 16) { - //Generate DFT vertical beams - //ll: index of a vertical beams vector (represented by i1_1 in TS 38.214) - const int max_l = N1 * O1 + (K1 - 1) * O1; - double complex v[max_l][N1]; - for (int ll = 0; ll < max_l; ll++) { //i1_1 - for (int nn = 0; nn < N1; nn++) { - v[ll][nn] = cexp(I * (2 * M_PI * nn * ll) / (N1 * O1)); - LOG_D(PHY,"v[%d][%d] = %f +j %f\n", ll, nn, creal(v[ll][nn]), cimag(v[ll][nn])); - } - } - //Generate DFT Horizontal beams - //mm: index of a Horizontal beams vector (represented by i1_2 in TS 38.214) - const int max_m = N2 * O2 + (K2 - 1) * O2; - double complex u[max_m][N2]; - for (int mm = 0; mm < max_m; mm++) { //i1_2 - for (int nn = 0; nn < N2; nn++) { - u[mm][nn] = cexp(I * (2 * M_PI * nn * mm) / (N2 * O2)); - LOG_D(PHY,"u[%d][%d] = %f +j %f\n", mm, nn, creal(u[mm][nn]), cimag(u[mm][nn])); - } - } - //Generate co-phasing angles - //i_2: index of a co-phasing vector - //i1_1, i1_2, and i_2 are reported from UEs - double complex theta_n[4]; - for (int nn = 0; nn < 4; nn++) { - theta_n[nn] = cexp(I * M_PI * nn / 2); - LOG_D(PHY,"theta_n[%d] = %f +j %f\n", nn, creal(theta_n[nn]), cimag(theta_n[nn])); - } - //Kronecker product v_lm - double complex v_lm[max_l][max_m][N2 * N1]; - //v_ll_mm_codebook denotes the elements of a precoding matrix W_i1,1_i_1,2 - for(int ll = 0; ll < max_l; ll++) { //i_1_1 - for (int mm = 0; mm < max_m; mm++) { //i_1_2 - for (int nn1 = 0; nn1 < N1; nn1++) { - for (int nn2 = 0; nn2 < N2; nn2++) { - v_lm[ll][mm][nn1 * N2 + nn2] = v[ll][nn1] * u[mm][nn2]; - LOG_D(PHY,"v_lm[%d][%d][%d] = %f +j %f\n",ll, mm, nn1 * N2 + nn2, creal(v_lm[ll][mm][nn1*N2+nn2]), cimag(v_lm[ll][mm][nn1*N2+nn2])); - } - } - } - } - - int max_mimo_layers = (CSI_RS_antenna_ports < NR_MAX_NB_LAYERS) ? CSI_RS_antenna_ports : NR_MAX_NB_LAYERS; - AssertFatal(max_mimo_layers <= 4, "Max number of layers supported is 4\n"); - - gNB->nr_mimo_precoding_matrix = (int32_t ***)malloc16(max_mimo_layers * sizeof(int32_t **)); - int32_t ***mat = gNB->nr_mimo_precoding_matrix; - double complex res_code; - - //Table 5.2.2.2.1-5: - //Codebook for 1-layer CSI reporting using antenna ports 3000 to 2999+PCSI-RS - gNB->pmiq_size[0] = N1*O1*N2*O2*4+1; - mat[0] = (int32_t **)malloc16(gNB->pmiq_size[0]*sizeof(int32_t *)); - - //pmi=0 corresponds to unit matrix - mat[0][0] = (int32_t *)calloc(2*N1*N2,sizeof(int32_t)); - for(int j_col=0; j_col<1; j_col++) { //1 layer - for (int i_rows=0; i_rows<2*N1*N2; i_rows++) { //2-x polarized antenna - if(j_col==i_rows) { - mat[0][0][i_rows+j_col] = 0x7fff; - } - } - } - - for(int ll=0; ll0) - ((short*) &mat[0][pmiq][len])[0] = (short) ((creal(res_code)*32768)+0.5);//convert to Q15 - else - ((short*) &mat[0][pmiq][len])[0] = (short) ((creal(res_code)*32768)-0.5);//convert to Q15 - if (cimag(res_code)>0) - ((short*) &mat[0][pmiq][len])[1] = (short) ((cimag(res_code)*32768)+0.5);//convert to Q15 - else - ((short*) &mat[0][pmiq][len])[1] = (short) ((cimag(res_code)*32768)-0.5);//convert to Q15 - LOG_D(PHY, "1 Layer Precoding Matrix[0][pmi %d][antPort %d]= %f+j %f -> Fixed Point %d+j %d \n", - pmiq, len, creal(res_code), cimag(res_code),((short*) &mat[0][pmiq][len])[0],((short*) &mat[0][pmiq][len])[1]); - } - - for(int len=N1*N2; len<2*N1*N2; len++) { - res_code=sqrt(1/(double)CSI_RS_antenna_ports)*theta_n[nn]*v_lm[ll][mm][len-N1*N2]; - if (creal(res_code)>0) - ((short*) &mat[0][pmiq][len])[0] = (short) ((creal(res_code)*32768)+0.5);//convert to Q15 - else - ((short*) &mat[0][pmiq][len])[0] = (short) ((creal(res_code)*32768)-0.5);//convert to Q15 - if (cimag(res_code)>0) - ((short*) &mat[0][pmiq][len])[1] = (short) ((cimag(res_code)*32768)+0.5);//convert to Q15 - else - ((short*) &mat[0][pmiq][len])[1] = (short) ((cimag(res_code)*32768)-0.5);//convert to Q15 - LOG_D(PHY, "1 Layer Precoding Matrix[0][pmi %d][antPort %d]= %f+j %f -> Fixed Point %d+j %d \n", - pmiq, len, creal(res_code), cimag(res_code),((short*) &mat[0][pmiq][len])[0],((short*) &mat[0][pmiq][len])[1]); - } - } - } - } - - int llc = 0; - int mmc = 0; - double complex phase_sign = 0; - //Table 5.2.2.2.1-6: - //Codebook for 2-layer CSI reporting using antenna ports 3000 to 2999+PCSI-RS - //Compute the code book size for generating 2 layers out of Tx antenna ports - - //pmi_size is computed as follows - gNB->pmiq_size[1] = 1 + (2 * N1 * O1 * N2 * O2 * K1 * K2); - mat[1] = (int32_t **)malloc16(gNB->pmiq_size[1] * sizeof(int32_t *)); - - //pmi=0 corresponds to unit matrix - mat[1][0] = (int32_t *)calloc((2 * N1 * N2) * 2, sizeof(int32_t)); - for(int j_col=0; j_col<2; j_col++) { //2 layers - for (int i_rows=0; i_rows<2*N1*N2; i_rows++) { //2-x polarized antenna - if(j_col==i_rows) { - mat[1][0][i_rows*2+j_col] = 0x7fff; - } - } - } - - //pmi=1,...,pmi_size, we construct - int pmiq = 0; - for(int ll = 0; ll < N1 * O1; ll++) { //i_1_1 - for (int mm = 0; mm < N2 * O2; mm++) { // i_1_2 - for(int k1 = 0; k1 < K1; k1++) { - for (int k2 = 0; k2 < K2; k2++) { - for (int nn = 0; nn < 2; nn++) { // i_2 - pmiq += 1; - mat[1][pmiq] = (int32_t *)malloc16((2 * N1 * N2) * 2 * sizeof(int32_t)); - LOG_D(PHY, "layer 2 Codebook pmiq = %d\n", pmiq); - for(int j_col = 0; j_col < 2; j_col++) { - if (j_col == 0) { - llc = ll; - mmc = mm; - phase_sign = 1; - } - if (j_col == 1) { - llc = ll + k1 * O1; - mmc = mm + k2 * O2; - phase_sign = -1; - } - for (int i_rows=0; i_rows0) - ((short*) &mat[1][pmiq][i_rows*2+j_col])[0] = (short) ((creal(res_code)*32768)+0.5);//convert to Q15 - else - ((short*) &mat[1][pmiq][i_rows*2+j_col])[0] = (short) ((creal(res_code)*32768)-0.5);//convert to Q15 - if (cimag(res_code)>0) - ((short*) &mat[1][pmiq][i_rows*2+j_col])[1] = (short) ((cimag(res_code)*32768)+0.5);//convert to Q15 - else - ((short*) &mat[1][pmiq][i_rows*2+j_col])[1] = (short) ((cimag(res_code)*32768)-0.5);//convert to Q15 - LOG_D(PHY, "2 Layer Precoding Matrix[1][pmi %d][antPort %d][layerIdx %d]= %f+j %f -> Fixed Point %d+j %d \n", - pmiq, i_rows, j_col, creal(res_code), cimag(res_code), ((short*) &mat[1][pmiq][i_rows*2+j_col])[0], ((short*) &mat[1][pmiq][i_rows*2+j_col])[1]); - } - for (int i_rows=N1*N2; i_rows<2*N1*N2; i_rows++) { - res_code=sqrt(1/(double)(2*CSI_RS_antenna_ports))*(phase_sign)*theta_n[nn]*v_lm[llc][mmc][i_rows-N1*N2]; - if (creal(res_code)>0) - ((short*) &mat[1][pmiq][i_rows*2+j_col])[0] = (short) ((creal(res_code)*32768)+0.5);//convert to Q15 - else - ((short*) &mat[1][pmiq][i_rows*2+j_col])[0] = (short) ((creal(res_code)*32768)-0.5);//convert to Q15 - if (cimag(res_code)>0) - ((short*) &mat[1][pmiq][i_rows*2+j_col])[1] = (short) ((cimag(res_code)*32768)+0.5);//convert to Q15 - else - ((short*) &mat[1][pmiq][i_rows*2+j_col])[1] = (short) ((cimag(res_code)*32768)-0.5);//convert to Q15 - LOG_D(PHY, "2 Layer Precoding Matrix[1][pmi %d][antPort %d][layerIdx %d]= %f+j %f -> Fixed Point %d+j %d \n", - pmiq, i_rows, j_col, creal(res_code), cimag(res_code), ((short*) &mat[1][pmiq][i_rows*2+j_col])[0], ((short*) &mat[1][pmiq][i_rows*2+j_col])[1]); - } - } - } - } - } - } - } - - //Table 5.2.2.2.1-7: - //Codebook for 3-layer CSI reporting using antenna ports 3000 to 2999+PCSI-RS - if(max_mimo_layers >= 3) { - - //pmi_size is computed as follows - gNB->pmiq_size[2] = 1 + (2 * N1 * O1 * N2 * O2 * K1 * K2); - mat[2] = (int32_t **)malloc16(gNB->pmiq_size[2] * sizeof(int32_t *)); - //pmi=0 corresponds to unit matrix - mat[2][0] = (int32_t *)calloc(2 * N1 * N2 * 3, sizeof(int32_t)); - for(int j_col = 0; j_col < 3; j_col++) { //3 layers - for (int i_rows = 0; i_rows < 2 * N1 * N2; i_rows++) { //2-x polarized antenna - if(j_col == i_rows) { - mat[2][0][i_rows * 3 + j_col] = 0x7fff; - } - } - } - - pmiq = 0; - //pmi=1,...,pmi_size are computed as follows - for(int ll = 0; ll < N1 * O1; ll++) { //i_1_1 - for (int mm = 0; mm < N2 * O2; mm++) { // i_1_2 - for(int k1 = 0; k1 < K1; k1++) { - for (int k2 = 0; k2 < K2; k2++) { - for (int nn = 0; nn < 2; nn++) { // i_2 - pmiq += 1; - mat[2][pmiq] = (int32_t *)malloc16((2 * N1 * N2 * 3) * sizeof(int32_t)); - LOG_D(PHY, "layer 3 Codebook pmiq = %d\n",pmiq); - for(int j_col = 0; j_col < 3; j_col++) { - if (j_col == 0) { - llc = ll; - mmc = mm; - phase_sign = 1; - } - if (j_col==1) { - llc = ll + k1 * O1; - mmc = mm + k2 * O2; - phase_sign = 1; - } - if (j_col==2) { - llc = ll; - mmc = mm; - phase_sign = -1; - } - for (int i_rows=0; i_rows0) - ((short*) &mat[2][pmiq][i_rows*3+j_col])[0] = (short) ((creal(res_code)*32768)+0.5);//convert to Q15 - else - ((short*) &mat[2][pmiq][i_rows*3+j_col])[0] = (short) ((creal(res_code)*32768)-0.5);//convert to Q15 - if (cimag(res_code)>0) - ((short*) &mat[2][pmiq][i_rows*3+j_col])[1] = (short) ((cimag(res_code)*32768)+0.5);//convert to Q15 - else - ((short*) &mat[2][pmiq][i_rows*3+j_col])[1] = (short) ((cimag(res_code)*32768)-0.5);//convert to Q15 - LOG_D(PHY, "3 Layer Precoding Matrix[2][pmi %d][antPort %d][layerIdx %d]= %f+j %f -> Fixed Point %d+j %d \n", - pmiq,i_rows,j_col, creal(res_code), cimag(res_code),((short*) &mat[2][pmiq][i_rows*3+j_col])[0],((short*) &mat[2][pmiq][i_rows*3+j_col])[1]); - } - for (int i_rows=N1*N2; i_rows<2*N1*N2; i_rows++) { - res_code=sqrt(1/(double)(3*CSI_RS_antenna_ports))*(phase_sign)*theta_n[nn]*v_lm[llc][mmc][i_rows-N1*N2]; - if (creal(res_code)>0) - ((short*) &mat[2][pmiq][i_rows*3+j_col])[0] = (short) ((creal(res_code)*32768)+0.5);//convert to Q15 - else - ((short*) &mat[2][pmiq][i_rows*3+j_col])[0] = (short) ((creal(res_code)*32768)-0.5);//convert to Q15 - if (cimag(res_code)>0) - ((short*) &mat[2][pmiq][i_rows*3+j_col])[1] = (short) ((cimag(res_code)*32768)+0.5);//convert to Q15 - else - ((short*) &mat[2][pmiq][i_rows*3+j_col])[1] = (short) ((cimag(res_code)*32768)-0.5);//convert to Q15 - LOG_D(PHY, "3 Layer Precoding Matrix[2][pmi %d][antPort %d][layerIdx %d]= %f+j %f -> Fixed Point %d+j %d \n", - pmiq,i_rows,j_col, creal(res_code), cimag(res_code),((short*) &mat[2][pmiq][i_rows*3+j_col])[0],((short*) &mat[2][pmiq][i_rows*3+j_col])[1]); - } - } - } - } - } - } - } - } - - //Table 5.2.2.2.1-8: - //Codebook for 4-layer CSI reporting using antenna ports 3000 to 2999+PCSI-RS - if(max_mimo_layers >= 4) { - //pmi_size is computed as follows - gNB->pmiq_size[3] = 1 + (2 * N1 * O1 * N2 * O2 * K1 * K2); - mat[3] = (int32_t **)malloc16(gNB->pmiq_size[3] * sizeof(int32_t *)); - //pmi=0 corresponds to unit matrix - mat[3][0] = (int32_t *)calloc((2 * N1 * N2 * 4), sizeof(int32_t)); - for(int j_col = 0; j_col < 4; j_col++) { //4 layers - for (int i_rows = 0; i_rows < 2 * N1 * N2; i_rows++) { //2-x polarized antenna - if(j_col == i_rows) { - mat[3][0][i_rows * 4 + j_col] = 0x7fff; - } - } - } - - pmiq = 0; - //pmi=1,...,pmi_size are computed as follows - for(int ll = 0; ll < N1 * O1; ll++) { //i_1_1 - for (int mm = 0; mm < N2 * O2; mm++) { // i_1_2 - for(int k1 = 0; k1 < K1; k1++) { - for (int k2 = 0; k2 < K2; k2++) { - for (int nn = 0; nn < 2; nn++) { // i_2 - pmiq += 1; - mat[3][pmiq] = (int32_t *)malloc16((2*N1*N2)*4*sizeof(int32_t)); - LOG_D(PHY, "layer 4 pmiq = %d\n",pmiq); - for(int j_col=0; j_col<4; j_col++) { - if (j_col==0) { - llc = ll; - mmc = mm; - phase_sign = 1; - } - if (j_col==1) { - llc = ll + k1 * O1; - mmc = mm + k2 * O2; - phase_sign = 1; - } - if (j_col==2) { - llc = ll; - mmc = mm; - phase_sign = -1; - } - if (j_col==3) { - llc = ll + k1 * O1; - mmc = mm + k2 * O2; - phase_sign = -1; - } - for (int i_rows=0; i_rows0) - ((short*) &mat[3][pmiq][i_rows*4+j_col])[0] = (short) ((creal(res_code)*32768)+0.5);//convert to Q15 - else - ((short*) &mat[3][pmiq][i_rows*4+j_col])[0] = (short) ((creal(res_code)*32768)-0.5);//convert to Q15 - if (cimag(res_code)>0) - ((short*) &mat[3][pmiq][i_rows*4+j_col])[1] = (short) ((cimag(res_code)*32768)+0.5);//convert to Q15 - else - ((short*) &mat[3][pmiq][i_rows*4+j_col])[1] = (short) ((cimag(res_code)*32768)-0.5);//convert to Q15 - LOG_D(PHY, "4 Layer Precoding Matrix[3][pmi %d][antPort %d][layerIdx %d]= %f+j %f -> Fixed Point %d+j %d \n", - pmiq,i_rows,j_col, creal(res_code), cimag(res_code),((short*) &mat[3][pmiq][i_rows*4+j_col])[0],((short*) &mat[3][pmiq][i_rows*4+j_col])[1]); - } - for (int i_rows=N1*N2; i_rows<2*N1*N2; i_rows++) { - res_code=sqrt(1/(double)(4*CSI_RS_antenna_ports))*(phase_sign)*theta_n[nn]*v_lm[llc][mmc][i_rows-N1*N2]; - if (creal(res_code)>0) - ((short*) &mat[3][pmiq][i_rows*4+j_col])[0] = (short) ((creal(res_code)*32768)+0.5);//convert to Q15 - else - ((short*) &mat[3][pmiq][i_rows*4+j_col])[0] = (short) ((creal(res_code)*32768)-0.5);//convert to Q15 - if (cimag(res_code)>0) - ((short*) &mat[3][pmiq][i_rows*4+j_col])[1] = (short) ((cimag(res_code)*32768)+0.5);//convert to Q15 - else - ((short*) &mat[3][pmiq][i_rows*4+j_col])[1] = (short) ((cimag(res_code)*32768)-0.5);//convert to Q15 - LOG_D(PHY, "4 Layer Precoding Matrix[3][pmi %d][antPort %d][layerIdx %d]= %f+j %f -> Fixed Point %d+j %d \n", - pmiq,i_rows,j_col, creal(res_code), cimag(res_code),((short*) &mat[3][pmiq][i_rows*4+j_col])[0],((short*) &mat[3][pmiq][i_rows*4+j_col])[1]); - } - } - } - } - } - } - } - } - } - else - AssertFatal(false, "Max number of antenna ports supported is 16\n"); - } - return 0; -} - // A global var to reduce the changes size ldpc_interface_t ldpc_interface = {0}, ldpc_interface_offload = {0}; @@ -509,8 +134,6 @@ int phy_init_nr_gNB(PHY_VARS_gNB *gNB) if (gNB->ldpc_offload_flag) load_LDPClib("_t2", &ldpc_interface_offload); gNB->max_nb_pdsch = MAX_MOBILES_PER_GNB; - - init_codebook_gNB(gNB); init_delay_table(fp->ofdm_symbol_size, MAX_DELAY_COMP, NR_MAX_OFDM_SYMBOL_SIZE, fp->delay_table); // PBCH DMRS gold sequences generation @@ -698,23 +321,15 @@ int phy_init_nr_gNB(PHY_VARS_gNB *gNB) void phy_free_nr_gNB(PHY_VARS_gNB *gNB) { - NR_DL_FRAME_PARMS* const fp = &gNB->frame_parms; + NR_DL_FRAME_PARMS* const fp = &gNB->frame_parms; const int Ptx = gNB->gNB_config.carrier_config.num_tx_ant.value; const int Prx = gNB->gNB_config.carrier_config.num_rx_ant.value; const int max_ul_mimo_layers = 4; // taken from phy_init_nr_gNB() const int n_buf = Prx * max_ul_mimo_layers; - PHY_MEASUREMENTS_gNB *meas=&gNB->measurements; + + PHY_MEASUREMENTS_gNB *meas = &gNB->measurements; free_and_zero(meas->n0_subband_power); free_and_zero(meas->n0_subband_power_dB); - int max_dl_mimo_layers =(fp->nb_antennas_txnb_antennas_tx : NR_MAX_NB_LAYERS; - if (fp->nb_antennas_tx>1) { - for (int nl = 0; nl < max_dl_mimo_layers; nl++) { - for(int size = 0; size < gNB->pmiq_size[nl]; size++) - free_and_zero(gNB->nr_mimo_precoding_matrix[nl][size]); - free_and_zero(gNB->nr_mimo_precoding_matrix[nl]); - } - free_and_zero(gNB->nr_mimo_precoding_matrix); - } uint32_t ***pdcch_dmrs = gNB->nr_gold_pdcch_dmrs; for (int slot = 0; slot < fp->slots_per_frame; slot++) { diff --git a/openair1/PHY/MODULATION/nr_modulation.c b/openair1/PHY/MODULATION/nr_modulation.c index 92a1d94fd4..e5f28d1c50 100644 --- a/openair1/PHY/MODULATION/nr_modulation.c +++ b/openair1/PHY/MODULATION/nr_modulation.c @@ -703,13 +703,17 @@ c16_t nr_layer_precoder_cm(int n_layers, int n_symbols, int symSz, c16_t datatx_F_precoding[n_layers][n_symbols][symSz], - c16_t *prec_matrix, + int ap, + nfapi_nr_pm_pdu_t *pmi_pdu, int symbol, int offset) { c16_t precodatatx_F = {0}; - for (int al = 0; al < n_layers; al++) - precodatatx_F = c16maddShift(datatx_F_precoding[al][symbol][offset], prec_matrix[al], precodatatx_F, 15); + for (int al = 0; al < n_layers; al++) { + nfapi_nr_pm_weights_t *w = &pmi_pdu->weights[al][ap]; + c16_t prec_weight = {.r = w->precoder_weight_Re, .i = w->precoder_weight_Im}; + precodatatx_F = c16maddShift(datatx_F_precoding[al][symbol][offset], prec_weight, precodatatx_F, 15); + } return precodatatx_F; } @@ -717,69 +721,77 @@ void nr_layer_precoder_simd(const int n_layers, const int n_symbols, const int symSz, const c16_t txdataF_res_mapped[n_layers][n_symbols][symSz], - const c16_t prec_matrix[n_layers], + const int ant, + const nfapi_nr_pm_pdu_t *pmi_pdu, const int symbol, const int sc_offset, const int re_cnt, c16_t *txdataF_precoded) { uint32_t sc = sc_offset; - + c16_t prec_weight = {0}; // For x86, use 256 SIMD for every 8 RE and 128 SIMD for last 4 RE // For aarch64, use 128 SIMD for every 4 RE // 256 SIMD: Do 8 RE in one iteration, 3 iterations for 2 RB - #ifdef __AVX2__ - const uint32_t re_cnt_align8 = re_cnt & ~7; - for(; scweights[nl][ant].precoder_weight_Re; + prec_weight.i = pmi_pdu->weights[nl][ant].precoder_weight_Im; - // Rearrange precoding matrix weight to match complex multiplication and broadcast it to match SIMD size - const simde__m256i w_c = simde_mm256_set1_epi32(c16toI32(c16conj(prec_matrix[nl]))); // broadcast conjugate of w - const simde__m256i w_s = simde_mm256_set1_epi32(c16toI32(c16swap(prec_matrix[nl]))); // broadcast swapped real and img of w + const simde__m256i x = simde_mm256_loadu_epi32(&txdataF_res_mapped[nl][symbol][sc]); - // Multiplication and shift - const simde__m256i reals = simde_mm256_srai_epi32(simde_mm256_madd_epi16(x, w_c), 15); // (int32_t) .r = (x.r * w.r - x.i * w.i) >> 15 - const simde__m256i imags = simde_mm256_slli_epi32(simde_mm256_madd_epi16(x, w_s), 1); // (int32_t) .i = (x.r * w.i + x.i * w.r) << 1, since higher 16 bit of each 32 bit is taken by blend_epi16 + // Rearrange precoding matrix weight to match complex multiplication and broadcast it to match SIMD size + const simde__m256i w_c = simde_mm256_set1_epi32(c16toI32(c16conj(prec_weight))); // broadcast conjugate of w + const simde__m256i w_s = simde_mm256_set1_epi32(c16toI32(c16swap(prec_weight))); // broadcast swapped real and img of w - // Re-arrange to match c16_t format - const simde__m256i produ = simde_mm256_blend_epi16(reals, imags, 0xAA); + // Multiplication and shift + const simde__m256i reals = simde_mm256_srai_epi32(simde_mm256_madd_epi16(x, w_c), 15); // (int32_t) .r = (x.r * w.r - x.i * w.i) >> 15 + const simde__m256i imags = simde_mm256_slli_epi32(simde_mm256_madd_epi16(x, w_s), 1); // (int32_t) .i = (x.r * w.i + x.i * w.r) << 1, since higher 16 bit of each 32 bit is taken by blend_epi16 - // Accumulate the product - y = simde_mm256_adds_epi16(y, produ); - } - // Store the result to txdataF - simde_mm256_storeu_si256(&txdataF_precoded[sc], y); + // Re-arrange to match c16_t format + const simde__m256i produ = simde_mm256_blend_epi16(reals, imags, 0xAA); + + // Accumulate the product + y = simde_mm256_adds_epi16(y, produ); } - #endif + // Store the result to txdataF + simde_mm256_storeu_si256(&txdataF_precoded[sc], y); + } +#endif // 128 SIMD: Do 4 RE in one iteration, 3 iterations for 1 RB const uint32_t re_cnt_align4 = re_cnt & ~3; - for(; scweights[nl][ant].precoder_weight_Re; + prec_weight.i = pmi_pdu->weights[nl][ant].precoder_weight_Im; + const simde__m128i x = simde_mm_loadu_epi32(&txdataF_res_mapped[nl][symbol][sc]); // Rearrange precoding matrix weight to match complex multiplication and broadcast it to match SIMD size - const simde__m128i w_c = simde_mm_set1_epi32(c16toI32(c16conj(prec_matrix[nl]))); // broadcast conjugate of w - const simde__m128i w_s = simde_mm_set1_epi32(c16toI32(c16swap(prec_matrix[nl]))); // broadcast swapped real and img of w + const simde__m128i w_c = simde_mm_set1_epi32(c16toI32(c16conj(prec_weight))); // broadcast conjugate of w + const simde__m128i w_s = simde_mm_set1_epi32(c16toI32(c16swap(prec_weight))); // broadcast swapped real and img of w // Multiplication and shift const simde__m128i reals = simde_mm_srai_epi32(simde_mm_madd_epi16(x, w_c), 15); // (int32_t) .r = (x.r * w.r - x.i * w.i) >> 15 diff --git a/openair1/PHY/MODULATION/nr_modulation.h b/openair1/PHY/MODULATION/nr_modulation.h index c129369221..7196994726 100644 --- a/openair1/PHY/MODULATION/nr_modulation.h +++ b/openair1/PHY/MODULATION/nr_modulation.h @@ -138,11 +138,13 @@ void apply_nr_rotation_RX(NR_DL_FRAME_PARMS *frame_parms, @param[in] n_layers, number of DLSCH layers */ int nr_layer_precoder(int16_t **datatx_F_precoding, const char *prec_matrix, uint8_t n_layers, int32_t re_offset); + c16_t nr_layer_precoder_cm(int n_layers, int n_symbols, int symSz, c16_t datatx_F_precoding[n_layers][n_symbols][symSz], - c16_t *prec_matrix, + int ap, + nfapi_nr_pm_pdu_t *pmi_pdu, int symbol, int offset); @@ -156,7 +158,8 @@ void nr_layer_precoder_simd(const int n_layers, const int n_symbols, const int symSz, const c16_t txdataF_res_mapped[n_layers][n_symbols][symSz], - const c16_t prec_matrix[n_layers], + const int ant, + const nfapi_nr_pm_pdu_t *pmi_pdu, const int symbol, const int sc_offset, const int re_cnt, diff --git a/openair1/PHY/NR_TRANSPORT/nr_dlsch.c b/openair1/PHY/NR_TRANSPORT/nr_dlsch.c index 51a2059586..514f284e4c 100644 --- a/openair1/PHY/NR_TRANSPORT/nr_dlsch.c +++ b/openair1/PHY/NR_TRANSPORT/nr_dlsch.c @@ -535,58 +535,52 @@ void nr_generate_pdsch(processingData_L1tx_t *msgTx, int frame, int slot) } } else { // non-unitary Precoding - if(frame_parms->nb_antennas_tx == 1){ // no precoding matrix defined - memcpy(&txdataF[ant][txdataF_offset_per_symbol + subCarrier], - &txdataF_precoding[ant][l_symbol][subCarrier], - re_cnt * sizeof(**txdataF)); + AssertFatal(frame_parms->nb_antennas_tx > 1, "No precoding can be done with a single antenna port\n"); + //get the precoding matrix weights: + nfapi_nr_pm_pdu_t *pmi_pdu = &gNB->gNB_config.pmi_list.pmi_pdu[pmi - 1]; // pmi 0 is identity matrix + AssertFatal(pmi == pmi_pdu->pm_idx, "PMI %d doesn't match to the one in precoding matrix %d\n", + pmi, pmi_pdu->pm_idx); + AssertFatal(ant < pmi_pdu->num_ant_ports, "Antenna port index %d exceeds precoding matrix AP size %d\n", + ant, pmi_pdu->num_ant_ports); + AssertFatal(rel15->nrOfLayers == pmi_pdu->numLayers, "Number of layers %d doesn't match to the one in precoding matrix %d\n", + rel15->nrOfLayers, pmi_pdu->numLayers); + if((subCarrier + re_cnt) < frame_parms->ofdm_symbol_size){ // within ofdm_symbol_size, use SIMDe + nr_layer_precoder_simd(rel15->nrOfLayers, + NR_SYMBOLS_PER_SLOT, + frame_parms->ofdm_symbol_size, + txdataF_precoding, + ant, + pmi_pdu, + l_symbol, + subCarrier, + re_cnt, + &txdataF[ant][txdataF_offset_per_symbol]); subCarrier += re_cnt; - if (subCarrier >= frame_parms->ofdm_symbol_size) { - subCarrier -= frame_parms->ofdm_symbol_size; - } } - else { // precoding with more than 1 tx - //get the precoding matrix weights: - c16_t **mat = (c16_t**)gNB->nr_mimo_precoding_matrix[rel15->nrOfLayers - 1]; - //i_row =0,...,dl_antenna_port - //j_col =0,...,nrOfLayers - //mat[pmi][i_rows*2+j_col] - c16_t *W_prec = &mat[pmi][ant * rel15->nrOfLayers]; - if((subCarrier + re_cnt) < frame_parms->ofdm_symbol_size){ // within ofdm_symbol_size, use SIMDe - nr_layer_precoder_simd(rel15->nrOfLayers, - NR_SYMBOLS_PER_SLOT, - frame_parms->ofdm_symbol_size, - txdataF_precoding, - W_prec, - l_symbol, - subCarrier, - re_cnt, - &txdataF[ant][txdataF_offset_per_symbol]); - subCarrier += re_cnt; - } - else{ // crossing ofdm_symbol_size, use simple arithmetic operations - for (int i = 0; i < re_cnt; i++) { - txdataF[ant][txdataF_offset_per_symbol + subCarrier] = - nr_layer_precoder_cm(rel15->nrOfLayers, - NR_SYMBOLS_PER_SLOT, - frame_parms->ofdm_symbol_size, - txdataF_precoding, - W_prec, - l_symbol, - subCarrier); + else{ // crossing ofdm_symbol_size, use simple arithmetic operations + for (int i = 0; i < re_cnt; i++) { + txdataF[ant][txdataF_offset_per_symbol + subCarrier] = + nr_layer_precoder_cm(rel15->nrOfLayers, + NR_SYMBOLS_PER_SLOT, + frame_parms->ofdm_symbol_size, + txdataF_precoding, + ant, + pmi_pdu, + l_symbol, + subCarrier); #ifdef DEBUG_DLSCH_MAPPING - printf("antenna %d\t l %d \t subCarrier %d \t txdataF: %d %d\n", - ant, - symbol, - subCarrier, - txdataF[ant][l_symbol * frame_parms->ofdm_symbol_size + subCarrier + txdataF_offset].r, - txdataF[ant][l_symbol * frame_parms->ofdm_symbol_size + subCarrier + txdataF_offset].i); + printf("antenna %d\t l %d \t subCarrier %d \t txdataF: %d %d\n", + ant, + symbol, + subCarrier, + txdataF[ant][l_symbol * frame_parms->ofdm_symbol_size + subCarrier + txdataF_offset].r, + txdataF[ant][l_symbol * frame_parms->ofdm_symbol_size + subCarrier + txdataF_offset].i); #endif - if (++subCarrier >= frame_parms->ofdm_symbol_size) { - subCarrier -= frame_parms->ofdm_symbol_size; - } + if (++subCarrier >= frame_parms->ofdm_symbol_size) { + subCarrier -= frame_parms->ofdm_symbol_size; } - } // else{ // crossing ofdm_symbol_size, use simple arithmetic operations - } // else { // precoding with more than 1 tx + } + } // else{ // crossing ofdm_symbol_size, use simple arithmetic operations } // else { // non-unitary Precoding rb += rb_step; diff --git a/openair1/PHY/defs_gNB.h b/openair1/PHY/defs_gNB.h index 20985cb08a..d66a1e4520 100644 --- a/openair1/PHY/defs_gNB.h +++ b/openair1/PHY/defs_gNB.h @@ -619,13 +619,6 @@ typedef struct PHY_VARS_gNB_s { /// PDSCH DMRS sequence uint32_t ****nr_gold_pdsch_dmrs; - /// PDSCH codebook I precoding LUTs - /// first dimension: Rank number [0,...,noOfLayers-1[ - /// second dimension: PMI [0,...,CodeSize-1[ - /// third dimension: [i_rows*noOfLayers+j_col], i_rows=0,...pdsch_AntennaPorts-1 and j_col=0,...,noOfLayers-1 - int32_t ***nr_mimo_precoding_matrix; - int pmiq_size[NR_MAX_NB_LAYERS]; - /// PUSCH DMRS uint32_t ****nr_gold_pusch_dmrs; diff --git a/openair1/PHY/defs_nr_common.h b/openair1/PHY/defs_nr_common.h index c5af8b8415..c4d6e2ff91 100644 --- a/openair1/PHY/defs_nr_common.h +++ b/openair1/PHY/defs_nr_common.h @@ -79,7 +79,6 @@ #define NR_MAX_PDCCH_AGG_LEVEL 16 // 3GPP TS 38.211 V15.8 Section 7.3.2 Table 7.3.2.1-1: Supported PDCCH aggregation levels -#define NR_MAX_NB_LAYERS 4 // 8 #define NR_MAX_NB_PORTS 32 #define NR_MAX_PDSCH_TBS 3824 diff --git a/openair1/SIMULATION/NR_PHY/dlsim.c b/openair1/SIMULATION/NR_PHY/dlsim.c index 30e84a8837..f60c27ded8 100644 --- a/openair1/SIMULATION/NR_PHY/dlsim.c +++ b/openair1/SIMULATION/NR_PHY/dlsim.c @@ -223,35 +223,21 @@ nrUE_params_t *get_nrUE_params(void) { } -void validate_input_pmi(nr_pdsch_AntennaPorts_t pdsch_AntennaPorts, int nrOfLayers, int pmi) +void validate_input_pmi(nfapi_nr_config_request_scf_t *gNB_config, + nr_pdsch_AntennaPorts_t pdsch_AntennaPorts, + int nrOfLayers, + int pmi) { if (pmi == 0) return; + nfapi_nr_pm_pdu_t *pmi_pdu = &gNB_config->pmi_list.pmi_pdu[pmi - 1]; // pmi 0 is identity matrix + AssertFatal(pmi == pmi_pdu->pm_idx, "PMI %d doesn't match to the one in precoding matrix %d\n", pmi, pmi_pdu->pm_idx); + AssertFatal(nrOfLayers == pmi_pdu->numLayers, "Number of layers %d doesn't match to the one in precoding matrix %d for PMI %d\n", + nrOfLayers, pmi_pdu->numLayers, pmi); int num_antenna_ports = pdsch_AntennaPorts.N1 * pdsch_AntennaPorts.N2 * pdsch_AntennaPorts.XP; - int N1 = pdsch_AntennaPorts.N1; - int N2 = pdsch_AntennaPorts.N2; - int O1 = N1 > 1 ? 4 : 1; - int O2 = N2 > 1 ? 4 : 1; - int K1, K2; - if (num_antenna_ports > 2) - get_K1_K2(N1, N2, &K1, &K2); - else { - K1 = 1; K2 = 1; - } - int num_pmi = 1; // pmi = 0 is the identity matrix - switch (nrOfLayers) { - case 1 : - num_pmi += N1 * O1 * N2 * O2 * 4; - AssertFatal(pmi < num_pmi, "Input PMI index %d exceeds the limit of configured matrices %d for %d layers\n", pmi, num_pmi, nrOfLayers); - return; - case 2 : - num_pmi += N1 * O1 * N2 * O2 * K1 * K2 * 2; - AssertFatal(pmi < num_pmi, "Input PMI index %d exceeds the limit of conigured matrices %d for %d layers\n", pmi, num_pmi, nrOfLayers); - break; - default : - AssertFatal(false, "Precoding with more than 2 nrOfLayers not yet supported\n"); - } + AssertFatal(num_antenna_ports == pmi_pdu->num_ant_ports, "Configured antenna ports %d does not match precoding matrix AP size %d for PMI %d\n", + num_antenna_ports, pmi_pdu->num_ant_ports, pmi); } @@ -709,7 +695,7 @@ int main(int argc, char **argv) gNB->ap_N2 = pdsch_AntennaPorts.N2; gNB->ap_XP = pdsch_AntennaPorts.XP; - validate_input_pmi(pdsch_AntennaPorts, g_nrOfLayers, g_pmi); + validate_input_pmi(&gNB_mac->config[0], pdsch_AntennaPorts, g_nrOfLayers, g_pmi); NR_UE_NR_Capability_t* UE_Capability_nr = CALLOC(1,sizeof(NR_UE_NR_Capability_t)); prepare_sim_uecap(UE_Capability_nr,scc,mu, diff --git a/openair2/LAYER2/NR_MAC_gNB/config.c b/openair2/LAYER2/NR_MAC_gNB/config.c index 3b738eed28..b989a5c1c6 100644 --- a/openair2/LAYER2/NR_MAC_gNB/config.c +++ b/openair2/LAYER2/NR_MAC_gNB/config.c @@ -50,11 +50,319 @@ #include "../../../../nfapi/oai_integration/vendor_ext.h" /* Softmodem params */ #include "executables/softmodem-common.h" +#include extern RAN_CONTEXT_t RC; //extern int l2_init_gNB(void); extern uint8_t nfapi_mode; +c16_t convert_precoder_weight(double complex c_in) +{ + double cr = creal(c_in) * 32768 + 0.5; + if (cr < 0) + cr -= 1; + double ci = cimag(c_in) * 32768 + 0.5; + if (ci < 0) + ci -= 1; + return (c16_t) {.r = (short)cr, .i = (short)ci}; +} + +nfapi_nr_pm_list_t init_DL_MIMO_codebook(gNB_MAC_INST *gNB, nr_pdsch_AntennaPorts_t antenna_ports) +{ + int num_antenna_ports = antenna_ports.N1 * antenna_ports.N2 * antenna_ports.XP; + if (num_antenna_ports < 2) + return (nfapi_nr_pm_list_t) {0}; + + //NR Codebook Generation for codebook type1 SinglePanel + int N1 = antenna_ports.N1; + int N2 = antenna_ports.N2; + //Uniform Planner Array: UPA + // X X X X ... X + // X X X X ... X + // N2 . . . . ... . + // X X X X ... X + // |<-----N1---->| + + //Get the uniform planar array parameters + // To be confirmed + int O2 = N2 > 1 ? 4 : 1; //Vertical beam oversampling (1 or 4) + int O1 = num_antenna_ports > 2 ? 4 : 1; //Horizontal beam oversampling (1 or 4) + + int K1, K2; + get_K1_K2(N1, N2, &K1, &K2); + + int max_mimo_layers = (num_antenna_ports < NR_MAX_NB_LAYERS) ? num_antenna_ports : NR_MAX_NB_LAYERS; + AssertFatal(max_mimo_layers <= 4, "Max number of layers supported is 4\n"); + + gNB->precoding_matrix_size[0] = N1 * O1 * N2 * O2 * 4; + nfapi_nr_pm_list_t mat = {.num_pm_idx = gNB->precoding_matrix_size[0]}; + for (int i = 1; i < max_mimo_layers; i++) { + gNB->precoding_matrix_size[i] = 2 * N1 * O1 * N2 * O2 * K1 * K2; + mat.num_pm_idx += gNB->precoding_matrix_size[i]; + } + + nfapi_nr_pm_pdu_t *pmi_pdu = malloc16(mat.num_pm_idx * sizeof(*pmi_pdu)); + AssertFatal(pmi_pdu != NULL, "out of memory\n"); + mat.pmi_pdu = pmi_pdu; + + // Generation of codebook Type1 with codebookMode 1 (num_antenna_ports < 16) + if (num_antenna_ports < 16) { + //Generate DFT vertical beams + //ll: index of a vertical beams vector (represented by i1_1 in TS 38.214) + const int max_l = N1 * O1 + (K1 - 1) * O1; + double complex v[max_l][N1]; + for (int ll = 0; ll < max_l; ll++) { //i1_1 + for (int nn = 0; nn < N1; nn++) { + v[ll][nn] = cexp(I * (2 * M_PI * nn * ll) / (N1 * O1)); + LOG_D(PHY,"v[%d][%d] = %f +j %f\n", ll, nn, creal(v[ll][nn]), cimag(v[ll][nn])); + } + } + //Generate DFT Horizontal beams + //mm: index of a Horizontal beams vector (represented by i1_2 in TS 38.214) + const int max_m = N2 * O2 + (K2 - 1) * O2; + double complex u[max_m][N2]; + for (int mm = 0; mm < max_m; mm++) { //i1_2 + for (int nn = 0; nn < N2; nn++) { + u[mm][nn] = cexp(I * (2 * M_PI * nn * mm) / (N2 * O2)); + LOG_D(PHY,"u[%d][%d] = %f +j %f\n", mm, nn, creal(u[mm][nn]), cimag(u[mm][nn])); + } + } + //Generate co-phasing angles + //i_2: index of a co-phasing vector + //i1_1, i1_2, and i_2 are reported from UEs + double complex theta_n[4]; + for (int nn = 0; nn < 4; nn++) { + theta_n[nn] = cexp(I * M_PI * nn / 2); + LOG_D(PHY,"theta_n[%d] = %f +j %f\n", nn, creal(theta_n[nn]), cimag(theta_n[nn])); + } + //Kronecker product v_lm + double complex v_lm[max_l][max_m][N2 * N1]; + //v_ll_mm_codebook denotes the elements of a precoding matrix W_i1,1_i_1,2 + for(int ll = 0; ll < max_l; ll++) { //i_1_1 + for (int mm = 0; mm < max_m; mm++) { //i_1_2 + for (int nn1 = 0; nn1 < N1; nn1++) { + for (int nn2 = 0; nn2 < N2; nn2++) { + v_lm[ll][mm][nn1 * N2 + nn2] = v[ll][nn1] * u[mm][nn2]; + LOG_D(PHY,"v_lm[%d][%d][%d] = %f +j %f\n",ll, mm, nn1 * N2 + nn2, creal(v_lm[ll][mm][nn1*N2+nn2]), cimag(v_lm[ll][mm][nn1*N2+nn2])); + } + } + } + } + + double complex res_code; + + //Table 5.2.2.2.1-5: + int pmiq = 0; + //Codebook for 1-layer CSI reporting using antenna ports 3000 to 2999+PCSI-RS + for(int ll = 0; ll < N1 * O1; ll++) { //i_1_1 + for (int mm = 0; mm < N2 * O2; mm++) { //i_1_2 + for (int nn = 0; nn < 4; nn++) { + pmiq = ll * N2 * O2 * 4 + mm * 4 + nn; + pmi_pdu[pmiq].pm_idx = pmiq + 1; // index 0 is the identity matrix + pmi_pdu[pmiq].numLayers = 1; + pmi_pdu[pmiq].num_ant_ports = num_antenna_ports; + LOG_D(PHY, "layer 1 Codebook pmiq = %d\n", pmiq); + for (int len = 0; len < N1 * N2; len++) { + nfapi_nr_pm_weights_t *weights = &pmi_pdu[pmiq].weights[0][len]; + res_code = sqrt( 1 /(double)num_antenna_ports) * v_lm[ll][mm][len]; + c16_t precoder_weight = convert_precoder_weight(res_code); + weights->precoder_weight_Re = precoder_weight.r; + weights->precoder_weight_Im = precoder_weight.i; + LOG_D(PHY, "1 Layer Precoding Matrix[0][pmi %d][antPort %d]= %f+j %f -> Fixed Point %d+j %d \n", + pmiq, len, creal(res_code), cimag(res_code), weights->precoder_weight_Re, weights->precoder_weight_Im); + } + + for(int len = N1 * N2; len < 2 * N1 * N2; len++) { + nfapi_nr_pm_weights_t *weights = &pmi_pdu[pmiq].weights[0][len]; + res_code = sqrt(1 / (double)num_antenna_ports) * theta_n[nn] * v_lm[ll][mm][len-N1*N2]; + c16_t precoder_weight = convert_precoder_weight(res_code); + weights->precoder_weight_Re = precoder_weight.r; + weights->precoder_weight_Im = precoder_weight.i; + LOG_D(PHY, "1 Layer Precoding Matrix[0][pmi %d][antPort %d]= %f+j %f -> Fixed Point %d+j %d \n", + pmiq, len, creal(res_code), cimag(res_code), weights->precoder_weight_Re, weights->precoder_weight_Im); + } + } + } + } + int llc = 0; + int mmc = 0; + double complex phase_sign = 0; + //Table 5.2.2.2.1-6: + //Codebook for 2-layer CSI reporting using antenna ports 3000 to 2999+PCSI-RS + //Compute the code book size for generating 2 layers out of Tx antenna ports + + //pmi=1,...,pmi_size, we construct + for(int ll = 0; ll < N1 * O1; ll++) { //i_1_1 + for (int mm = 0; mm < N2 * O2; mm++) { // i_1_2 + for(int k1 = 0; k1 < K1; k1++) { + for (int k2 = 0; k2 < K2; k2++) { + for (int nn = 0; nn < 2; nn++) { // i_2 + pmiq ++; + pmi_pdu[pmiq].pm_idx = pmiq + 1; // index 0 is the identity matrix + pmi_pdu[pmiq].numLayers = 2; + pmi_pdu[pmiq].num_ant_ports = num_antenna_ports; + LOG_D(PHY, "layer 2 Codebook pmiq = %d\n", pmiq); + for(int j_col = 0; j_col < 2; j_col++) { + if (j_col == 0) { + llc = ll; + mmc = mm; + phase_sign = 1; + } + if (j_col == 1) { + llc = ll + k1 * O1; + mmc = mm + k2 * O2; + phase_sign = -1; + } + for (int i_rows = 0; i_rows < N1 * N2; i_rows++) { + nfapi_nr_pm_weights_t *weights = &pmi_pdu[pmiq].weights[j_col][i_rows]; + res_code = sqrt(1 / (double)(2 * num_antenna_ports)) * v_lm[llc][mmc][i_rows]; + c16_t precoder_weight = convert_precoder_weight(res_code); + weights->precoder_weight_Re = precoder_weight.r; + weights->precoder_weight_Im = precoder_weight.i; + LOG_D(PHY, "2 Layer Precoding Matrix[1][pmi %d][antPort %d][layerIdx %d]= %f+j %f -> Fixed Point %d+j %d \n", + pmiq, i_rows, j_col, creal(res_code), cimag(res_code), weights->precoder_weight_Re, weights->precoder_weight_Im); + } + for (int i_rows = N1 * N2; i_rows < 2 * N1 * N2; i_rows++) { + nfapi_nr_pm_weights_t *weights = &pmi_pdu[pmiq].weights[j_col][i_rows]; + res_code = sqrt(1 / (double)(2 * num_antenna_ports)) * (phase_sign) * theta_n[nn] * v_lm[llc][mmc][i_rows - N1 * N2]; + c16_t precoder_weight = convert_precoder_weight(res_code); + weights->precoder_weight_Re = precoder_weight.r; + weights->precoder_weight_Im = precoder_weight.i; + LOG_D(PHY, "2 Layer Precoding Matrix[1][pmi %d][antPort %d][layerIdx %d]= %f+j %f -> Fixed Point %d+j %d \n", + pmiq, i_rows, j_col, creal(res_code), cimag(res_code), weights->precoder_weight_Re, weights->precoder_weight_Im); + } + } + } + } + } + } + } + + if(max_mimo_layers < 3) + return mat; + + //Table 5.2.2.2.1-7: + //Codebook for 3-layer CSI reporting using antenna ports 3000 to 2999+PCSI-RS + + //pmi=1,...,pmi_size are computed as follows + for(int ll = 0; ll < N1 * O1; ll++) { //i_1_1 + for (int mm = 0; mm < N2 * O2; mm++) { // i_1_2 + for(int k1 = 0; k1 < K1; k1++) { + for (int k2 = 0; k2 < K2; k2++) { + for (int nn = 0; nn < 2; nn++) { // i_2 + pmiq ++; + pmi_pdu[pmiq].pm_idx = pmiq + 1; // index 0 is the identity matrix + pmi_pdu[pmiq].numLayers = 3; + pmi_pdu[pmiq].num_ant_ports = num_antenna_ports; + LOG_D(PHY, "layer 3 Codebook pmiq = %d\n",pmiq); + for(int j_col = 0; j_col < 3; j_col++) { + if (j_col == 0) { + llc = ll; + mmc = mm; + phase_sign = 1; + } + if (j_col==1) { + llc = ll + k1 * O1; + mmc = mm + k2 * O2; + phase_sign = 1; + } + if (j_col==2) { + llc = ll; + mmc = mm; + phase_sign = -1; + } + for (int i_rows = 0; i_rows < N1 * N2; i_rows++) { + nfapi_nr_pm_weights_t *weights = &pmi_pdu[pmiq].weights[j_col][i_rows]; + res_code = sqrt(1 / (double)(3 * num_antenna_ports)) * v_lm[llc][mmc][i_rows]; + c16_t precoder_weight = convert_precoder_weight(res_code); + weights->precoder_weight_Re = precoder_weight.r; + weights->precoder_weight_Im = precoder_weight.i; + LOG_D(PHY, "3 Layer Precoding Matrix[1][pmi %d][antPort %d][layerIdx %d]= %f+j %f -> Fixed Point %d+j %d \n", + pmiq, i_rows, j_col, creal(res_code), cimag(res_code), weights->precoder_weight_Re, weights->precoder_weight_Im); + } + for (int i_rows = N1 * N2; i_rows < 2 * N1 * N2; i_rows++) { + nfapi_nr_pm_weights_t *weights = &pmi_pdu[pmiq].weights[j_col][i_rows]; + res_code=sqrt(1 / (double)(3 * num_antenna_ports)) * (phase_sign) * theta_n[nn] * v_lm[llc][mmc][i_rows - N1 * N2]; + c16_t precoder_weight = convert_precoder_weight(res_code); + weights->precoder_weight_Re = precoder_weight.r; + weights->precoder_weight_Im = precoder_weight.i; + LOG_D(PHY, "3 Layer Precoding Matrix[1][pmi %d][antPort %d][layerIdx %d]= %f+j %f -> Fixed Point %d+j %d \n", + pmiq, i_rows, j_col, creal(res_code), cimag(res_code), weights->precoder_weight_Re, weights->precoder_weight_Im); + } + } + } + } + } + } + } + + if(max_mimo_layers < 4) + return mat; + + //Table 5.2.2.2.1-8: + //Codebook for 4-layer CSI reporting using antenna ports 3000 to 2999+PCSI-RS + + for(int ll = 0; ll < N1 * O1; ll++) { //i_1_1 + for (int mm = 0; mm < N2 * O2; mm++) { // i_1_2 + for(int k1 = 0; k1 < K1; k1++) { + for (int k2 = 0; k2 < K2; k2++) { + for (int nn = 0; nn < 2; nn++) { // i_2 + pmiq ++; + pmi_pdu[pmiq].pm_idx = pmiq + 1; // index 0 is the identity matrix + pmi_pdu[pmiq].numLayers = 4; + pmi_pdu[pmiq].num_ant_ports = num_antenna_ports; + LOG_D(PHY, "layer 4 pmiq = %d\n", pmiq); + for(int j_col = 0; j_col < 4; j_col++) { + if (j_col == 0) { + llc = ll; + mmc = mm; + phase_sign = 1; + } + if (j_col == 1) { + llc = ll + k1 * O1; + mmc = mm + k2 * O2; + phase_sign = 1; + } + if (j_col == 2) { + llc = ll; + mmc = mm; + phase_sign = -1; + } + if (j_col == 3) { + llc = ll + k1 * O1; + mmc = mm + k2 * O2; + phase_sign = -1; + } + for (int i_rows = 0; i_rows < N1 * N2; i_rows++) { + nfapi_nr_pm_weights_t *weights = &pmi_pdu[pmiq].weights[j_col][i_rows]; + res_code=sqrt(1 / (double)(4 * num_antenna_ports)) * v_lm[llc][mmc][i_rows]; + c16_t precoder_weight = convert_precoder_weight(res_code); + weights->precoder_weight_Re = precoder_weight.r; + weights->precoder_weight_Im = precoder_weight.i; + LOG_D(PHY, "4 Layer Precoding Matrix[1][pmi %d][antPort %d][layerIdx %d]= %f+j %f -> Fixed Point %d+j %d \n", + pmiq, i_rows, j_col, creal(res_code), cimag(res_code), weights->precoder_weight_Re, weights->precoder_weight_Im); + } + for (int i_rows = N1 * N2; i_rows < 2 * N1 * N2; i_rows++) { + nfapi_nr_pm_weights_t *weights = &pmi_pdu[pmiq].weights[j_col][i_rows]; + res_code=sqrt(1 / (double)(4 * num_antenna_ports)) * (phase_sign) * theta_n[nn] * v_lm[llc][mmc][i_rows - N1 * N2]; + c16_t precoder_weight = convert_precoder_weight(res_code); + weights->precoder_weight_Re = precoder_weight.r; + weights->precoder_weight_Im = precoder_weight.i; + LOG_D(PHY, "4 Layer Precoding Matrix[1][pmi %d][antPort %d][layerIdx %d]= %f+j %f -> Fixed Point %d+j %d \n", + pmiq, i_rows, j_col, creal(res_code), cimag(res_code), weights->precoder_weight_Re, weights->precoder_weight_Im); + } + } + } + } + } + } + } + return mat; + } + else + AssertFatal(false, "Max number of antenna ports supported is currently 16\n"); +} + static void process_rlcBearerConfig(struct NR_CellGroupConfig__rlc_BearerToAddModList *rlc_bearer2add_list, struct NR_CellGroupConfig__rlc_BearerToReleaseList *rlc_bearer2release_list, NR_UE_sched_ctrl_t *sched_ctrl) @@ -122,30 +430,30 @@ void process_CellGroup(NR_CellGroupConfig_t *CellGroup, NR_UE_info_t *UE) process_rlcBearerConfig(CellGroup->rlc_BearerToAddModList, CellGroup->rlc_BearerToReleaseList, &UE->UE_sched_ctrl); } -static void config_common(gNB_MAC_INST *nrmac, int pdsch_AntennaPorts, int pusch_AntennaPorts, NR_ServingCellConfigCommon_t *scc) +static void config_common(gNB_MAC_INST *nrmac, nr_pdsch_AntennaPorts_t pdsch_AntennaPorts, int pusch_AntennaPorts, NR_ServingCellConfigCommon_t *scc) { - nfapi_nr_config_request_scf_t *cfg = &nrmac->config[0]; - nrmac->common_channels[0].ServingCellConfigCommon = scc; + nfapi_nr_config_request_scf_t *cfg = &nrmac->config[0]; + nrmac->common_channels[0].ServingCellConfigCommon = scc; - // Carrier configuration - struct NR_FrequencyInfoDL *frequencyInfoDL = scc->downlinkConfigCommon->frequencyInfoDL; - int bw_index = get_supported_band_index(frequencyInfoDL->scs_SpecificCarrierList.list.array[0]->subcarrierSpacing, - *frequencyInfoDL->frequencyBandList.list.array[0], - frequencyInfoDL->scs_SpecificCarrierList.list.array[0]->carrierBandwidth); - cfg->carrier_config.dl_bandwidth.value = + // Carrier configuration + struct NR_FrequencyInfoDL *frequencyInfoDL = scc->downlinkConfigCommon->frequencyInfoDL; + int bw_index = get_supported_band_index(frequencyInfoDL->scs_SpecificCarrierList.list.array[0]->subcarrierSpacing, + *frequencyInfoDL->frequencyBandList.list.array[0], + frequencyInfoDL->scs_SpecificCarrierList.list.array[0]->carrierBandwidth); + cfg->carrier_config.dl_bandwidth.value = get_supported_bw_mhz(*frequencyInfoDL->frequencyBandList.list.array[0] > 256 ? FR2 : FR1, bw_index); - cfg->carrier_config.dl_bandwidth.tl.tag = NFAPI_NR_CONFIG_DL_BANDWIDTH_TAG; // temporary - cfg->num_tlv++; - LOG_I(NR_MAC, "%s() dl_BandwidthP:%d\n", __FUNCTION__, cfg->carrier_config.dl_bandwidth.value); + cfg->carrier_config.dl_bandwidth.tl.tag = NFAPI_NR_CONFIG_DL_BANDWIDTH_TAG; // temporary + cfg->num_tlv++; + LOG_I(NR_MAC, "DL_Bandwidth:%d\n", cfg->carrier_config.dl_bandwidth.value); - cfg->carrier_config.dl_frequency.value = from_nrarfcn(*frequencyInfoDL->frequencyBandList.list.array[0], - *scc->ssbSubcarrierSpacing, - frequencyInfoDL->absoluteFrequencyPointA) + cfg->carrier_config.dl_frequency.value = from_nrarfcn(*frequencyInfoDL->frequencyBandList.list.array[0], + *scc->ssbSubcarrierSpacing, + frequencyInfoDL->absoluteFrequencyPointA) / 1000; // freq in kHz - cfg->carrier_config.dl_frequency.tl.tag = NFAPI_NR_CONFIG_DL_FREQUENCY_TAG; - cfg->num_tlv++; + cfg->carrier_config.dl_frequency.tl.tag = NFAPI_NR_CONFIG_DL_FREQUENCY_TAG; + cfg->num_tlv++; - for (int i = 0; i < 5; i++) { + for (int i = 0; i < 5; i++) { if (i == frequencyInfoDL->scs_SpecificCarrierList.list.array[0]->subcarrierSpacing) { cfg->carrier_config.dl_grid_size[i].value = frequencyInfoDL->scs_SpecificCarrierList.list.array[0]->carrierBandwidth; cfg->carrier_config.dl_k0[i].value = frequencyInfoDL->scs_SpecificCarrierList.list.array[0]->offsetToCarrier; @@ -157,31 +465,31 @@ static void config_common(gNB_MAC_INST *nrmac, int pdsch_AntennaPorts, int pusch cfg->carrier_config.dl_grid_size[i].value = 0; cfg->carrier_config.dl_k0[i].value = 0; } - } - struct NR_FrequencyInfoUL *frequencyInfoUL = scc->uplinkConfigCommon->frequencyInfoUL; - bw_index = get_supported_band_index(frequencyInfoUL->scs_SpecificCarrierList.list.array[0]->subcarrierSpacing, - *frequencyInfoUL->frequencyBandList->list.array[0], - frequencyInfoUL->scs_SpecificCarrierList.list.array[0]->carrierBandwidth); - cfg->carrier_config.uplink_bandwidth.value = + } + struct NR_FrequencyInfoUL *frequencyInfoUL = scc->uplinkConfigCommon->frequencyInfoUL; + bw_index = get_supported_band_index(frequencyInfoUL->scs_SpecificCarrierList.list.array[0]->subcarrierSpacing, + *frequencyInfoUL->frequencyBandList->list.array[0], + frequencyInfoUL->scs_SpecificCarrierList.list.array[0]->carrierBandwidth); + cfg->carrier_config.uplink_bandwidth.value = get_supported_bw_mhz(*frequencyInfoUL->frequencyBandList->list.array[0] > 256 ? FR2 : FR1, bw_index); - cfg->carrier_config.uplink_bandwidth.tl.tag = NFAPI_NR_CONFIG_UPLINK_BANDWIDTH_TAG; // temporary - cfg->num_tlv++; - LOG_I(NR_MAC, "%s() dl_BandwidthP:%d\n", __FUNCTION__, cfg->carrier_config.uplink_bandwidth.value); + cfg->carrier_config.uplink_bandwidth.tl.tag = NFAPI_NR_CONFIG_UPLINK_BANDWIDTH_TAG; // temporary + cfg->num_tlv++; + LOG_I(NR_MAC, "DL_Bandwidth:%d\n", cfg->carrier_config.uplink_bandwidth.value); - int UL_pointA; - if (frequencyInfoUL->absoluteFrequencyPointA == NULL) + int UL_pointA; + if (frequencyInfoUL->absoluteFrequencyPointA == NULL) UL_pointA = frequencyInfoDL->absoluteFrequencyPointA; - else + else UL_pointA = *frequencyInfoUL->absoluteFrequencyPointA; - cfg->carrier_config.uplink_frequency.value = from_nrarfcn(*frequencyInfoUL->frequencyBandList->list.array[0], - *scc->ssbSubcarrierSpacing, - UL_pointA) - / 1000; // freq in kHz - cfg->carrier_config.uplink_frequency.tl.tag = NFAPI_NR_CONFIG_UPLINK_FREQUENCY_TAG; - cfg->num_tlv++; + cfg->carrier_config.uplink_frequency.value = from_nrarfcn(*frequencyInfoUL->frequencyBandList->list.array[0], + *scc->ssbSubcarrierSpacing, + UL_pointA) + / 1000; // freq in kHz + cfg->carrier_config.uplink_frequency.tl.tag = NFAPI_NR_CONFIG_UPLINK_FREQUENCY_TAG; + cfg->num_tlv++; - for (int i = 0; i < 5; i++) { + for (int i = 0; i < 5; i++) { if (i == frequencyInfoUL->scs_SpecificCarrierList.list.array[0]->subcarrierSpacing) { cfg->carrier_config.ul_grid_size[i].value = frequencyInfoUL->scs_SpecificCarrierList.list.array[0]->carrierBandwidth; cfg->carrier_config.ul_k0[i].value = frequencyInfoUL->scs_SpecificCarrierList.list.array[0]->offsetToCarrier; @@ -193,61 +501,61 @@ static void config_common(gNB_MAC_INST *nrmac, int pdsch_AntennaPorts, int pusch cfg->carrier_config.ul_grid_size[i].value = 0; cfg->carrier_config.ul_k0[i].value = 0; } - } + } - uint32_t band = *frequencyInfoDL->frequencyBandList.list.array[0]; - frequency_range_t frequency_range = band < 100 ? FR1 : FR2; + uint32_t band = *frequencyInfoDL->frequencyBandList.list.array[0]; + frequency_range_t frequency_range = band < 100 ? FR1 : FR2; - frame_type_t frame_type = get_frame_type(*frequencyInfoDL->frequencyBandList.list.array[0], *scc->ssbSubcarrierSpacing); - nrmac->common_channels[0].frame_type = frame_type; + frame_type_t frame_type = get_frame_type(*frequencyInfoDL->frequencyBandList.list.array[0], *scc->ssbSubcarrierSpacing); + nrmac->common_channels[0].frame_type = frame_type; - // Cell configuration - cfg->cell_config.phy_cell_id.value = *scc->physCellId; - cfg->cell_config.phy_cell_id.tl.tag = NFAPI_NR_CONFIG_PHY_CELL_ID_TAG; - cfg->num_tlv++; + // Cell configuration + cfg->cell_config.phy_cell_id.value = *scc->physCellId; + cfg->cell_config.phy_cell_id.tl.tag = NFAPI_NR_CONFIG_PHY_CELL_ID_TAG; + cfg->num_tlv++; - cfg->cell_config.frame_duplex_type.value = frame_type; - cfg->cell_config.frame_duplex_type.tl.tag = NFAPI_NR_CONFIG_FRAME_DUPLEX_TYPE_TAG; - cfg->num_tlv++; + cfg->cell_config.frame_duplex_type.value = frame_type; + cfg->cell_config.frame_duplex_type.tl.tag = NFAPI_NR_CONFIG_FRAME_DUPLEX_TYPE_TAG; + cfg->num_tlv++; - // SSB configuration - cfg->ssb_config.ss_pbch_power.value = scc->ss_PBCH_BlockPower; - cfg->ssb_config.ss_pbch_power.tl.tag = NFAPI_NR_CONFIG_SS_PBCH_POWER_TAG; - cfg->num_tlv++; + // SSB configuration + cfg->ssb_config.ss_pbch_power.value = scc->ss_PBCH_BlockPower; + cfg->ssb_config.ss_pbch_power.tl.tag = NFAPI_NR_CONFIG_SS_PBCH_POWER_TAG; + cfg->num_tlv++; - cfg->ssb_config.bch_payload.value = 1; - cfg->ssb_config.bch_payload.tl.tag = NFAPI_NR_CONFIG_BCH_PAYLOAD_TAG; - cfg->num_tlv++; + cfg->ssb_config.bch_payload.value = 1; + cfg->ssb_config.bch_payload.tl.tag = NFAPI_NR_CONFIG_BCH_PAYLOAD_TAG; + cfg->num_tlv++; - cfg->ssb_config.scs_common.value = *scc->ssbSubcarrierSpacing; - cfg->ssb_config.scs_common.tl.tag = NFAPI_NR_CONFIG_SCS_COMMON_TAG; - cfg->num_tlv++; + cfg->ssb_config.scs_common.value = *scc->ssbSubcarrierSpacing; + cfg->ssb_config.scs_common.tl.tag = NFAPI_NR_CONFIG_SCS_COMMON_TAG; + cfg->num_tlv++; - // PRACH configuration + // PRACH configuration - uint8_t nb_preambles = 64; - NR_RACH_ConfigCommon_t *rach_ConfigCommon = scc->uplinkConfigCommon->initialUplinkBWP->rach_ConfigCommon->choice.setup; - if (rach_ConfigCommon->totalNumberOfRA_Preambles != NULL) + uint8_t nb_preambles = 64; + NR_RACH_ConfigCommon_t *rach_ConfigCommon = scc->uplinkConfigCommon->initialUplinkBWP->rach_ConfigCommon->choice.setup; + if (rach_ConfigCommon->totalNumberOfRA_Preambles != NULL) nb_preambles = *rach_ConfigCommon->totalNumberOfRA_Preambles; - cfg->prach_config.prach_sequence_length.value = rach_ConfigCommon->prach_RootSequenceIndex.present - 1; - cfg->prach_config.prach_sequence_length.tl.tag = NFAPI_NR_CONFIG_PRACH_SEQUENCE_LENGTH_TAG; - cfg->num_tlv++; + cfg->prach_config.prach_sequence_length.value = rach_ConfigCommon->prach_RootSequenceIndex.present - 1; + cfg->prach_config.prach_sequence_length.tl.tag = NFAPI_NR_CONFIG_PRACH_SEQUENCE_LENGTH_TAG; + cfg->num_tlv++; - if (rach_ConfigCommon->msg1_SubcarrierSpacing) + if (rach_ConfigCommon->msg1_SubcarrierSpacing) cfg->prach_config.prach_sub_c_spacing.value = *rach_ConfigCommon->msg1_SubcarrierSpacing; - else + else cfg->prach_config.prach_sub_c_spacing.value = frequencyInfoDL->scs_SpecificCarrierList.list.array[0]->subcarrierSpacing; - cfg->prach_config.prach_sub_c_spacing.tl.tag = NFAPI_NR_CONFIG_PRACH_SUB_C_SPACING_TAG; - cfg->num_tlv++; - cfg->prach_config.restricted_set_config.value = rach_ConfigCommon->restrictedSetConfig; - cfg->prach_config.restricted_set_config.tl.tag = NFAPI_NR_CONFIG_RESTRICTED_SET_CONFIG_TAG; - cfg->num_tlv++; - cfg->prach_config.prach_ConfigurationIndex.value = rach_ConfigCommon->rach_ConfigGeneric.prach_ConfigurationIndex; - cfg->prach_config.prach_ConfigurationIndex.tl.tag = NFAPI_NR_CONFIG_PRACH_CONFIG_INDEX_TAG; - cfg->num_tlv++; + cfg->prach_config.prach_sub_c_spacing.tl.tag = NFAPI_NR_CONFIG_PRACH_SUB_C_SPACING_TAG; + cfg->num_tlv++; + cfg->prach_config.restricted_set_config.value = rach_ConfigCommon->restrictedSetConfig; + cfg->prach_config.restricted_set_config.tl.tag = NFAPI_NR_CONFIG_RESTRICTED_SET_CONFIG_TAG; + cfg->num_tlv++; + cfg->prach_config.prach_ConfigurationIndex.value = rach_ConfigCommon->rach_ConfigGeneric.prach_ConfigurationIndex; + cfg->prach_config.prach_ConfigurationIndex.tl.tag = NFAPI_NR_CONFIG_PRACH_CONFIG_INDEX_TAG; + cfg->num_tlv++; - switch (rach_ConfigCommon->rach_ConfigGeneric.msg1_FDM) { + switch (rach_ConfigCommon->rach_ConfigGeneric.msg1_FDM) { case 0: cfg->prach_config.num_prach_fd_occasions.value = 1; break; @@ -262,17 +570,17 @@ static void config_common(gNB_MAC_INST *nrmac, int pdsch_AntennaPorts, int pusch break; default: AssertFatal(1 == 0, "msg1 FDM identifier %ld undefined (0,1,2,3) \n", rach_ConfigCommon->rach_ConfigGeneric.msg1_FDM); - } - cfg->prach_config.num_prach_fd_occasions.tl.tag = NFAPI_NR_CONFIG_NUM_PRACH_FD_OCCASIONS_TAG; - cfg->num_tlv++; + } + cfg->prach_config.num_prach_fd_occasions.tl.tag = NFAPI_NR_CONFIG_NUM_PRACH_FD_OCCASIONS_TAG; + cfg->num_tlv++; - cfg->prach_config.prach_ConfigurationIndex.value = rach_ConfigCommon->rach_ConfigGeneric.prach_ConfigurationIndex; - cfg->prach_config.prach_ConfigurationIndex.tl.tag = NFAPI_NR_CONFIG_PRACH_CONFIG_INDEX_TAG; - cfg->num_tlv++; + cfg->prach_config.prach_ConfigurationIndex.value = rach_ConfigCommon->rach_ConfigGeneric.prach_ConfigurationIndex; + cfg->prach_config.prach_ConfigurationIndex.tl.tag = NFAPI_NR_CONFIG_PRACH_CONFIG_INDEX_TAG; + cfg->num_tlv++; - cfg->prach_config.num_prach_fd_occasions_list = (nfapi_nr_num_prach_fd_occasions_t *)malloc( + cfg->prach_config.num_prach_fd_occasions_list = (nfapi_nr_num_prach_fd_occasions_t *)malloc( cfg->prach_config.num_prach_fd_occasions.value * sizeof(nfapi_nr_num_prach_fd_occasions_t)); - for (int i = 0; i < cfg->prach_config.num_prach_fd_occasions.value; i++) { + for (int i = 0; i < cfg->prach_config.num_prach_fd_occasions.value; i++) { nfapi_nr_num_prach_fd_occasions_t *prach_fd_occasion = &cfg->prach_config.num_prach_fd_occasions_list[i]; // prach_fd_occasion->num_prach_fd_occasions = i; if (cfg->prach_config.prach_sequence_length.value) @@ -311,44 +619,45 @@ static void config_common(gNB_MAC_INST *nrmac, int pdsch_AntennaPorts, int pusch prach_fd_occasion->num_unused_root_sequences.tl.tag = NFAPI_NR_CONFIG_NUM_UNUSED_ROOT_SEQUENCES_TAG; prach_fd_occasion->num_unused_root_sequences.value = 0; cfg->num_tlv++; - } + } - cfg->prach_config.ssb_per_rach.value = rach_ConfigCommon->ssb_perRACH_OccasionAndCB_PreamblesPerSSB->present - 1; - cfg->prach_config.ssb_per_rach.tl.tag = NFAPI_NR_CONFIG_SSB_PER_RACH_TAG; - cfg->num_tlv++; + cfg->prach_config.ssb_per_rach.value = rach_ConfigCommon->ssb_perRACH_OccasionAndCB_PreamblesPerSSB->present - 1; + cfg->prach_config.ssb_per_rach.tl.tag = NFAPI_NR_CONFIG_SSB_PER_RACH_TAG; + cfg->num_tlv++; - // SSB Table Configuration + // SSB Table Configuration - cfg->ssb_table.ssb_offset_point_a.value = + cfg->ssb_table.ssb_offset_point_a.value = get_ssb_offset_to_pointA(*scc->downlinkConfigCommon->frequencyInfoDL->absoluteFrequencySSB, scc->downlinkConfigCommon->frequencyInfoDL->absoluteFrequencyPointA, *scc->ssbSubcarrierSpacing, frequency_range); - cfg->ssb_table.ssb_offset_point_a.tl.tag = NFAPI_NR_CONFIG_SSB_OFFSET_POINT_A_TAG; - cfg->num_tlv++; - cfg->ssb_table.ssb_period.value = *scc->ssb_periodicityServingCell; - cfg->ssb_table.ssb_period.tl.tag = NFAPI_NR_CONFIG_SSB_PERIOD_TAG; - cfg->num_tlv++; - cfg->ssb_table.ssb_subcarrier_offset.value = + cfg->ssb_table.ssb_offset_point_a.tl.tag = NFAPI_NR_CONFIG_SSB_OFFSET_POINT_A_TAG; + cfg->num_tlv++; + cfg->ssb_table.ssb_period.value = *scc->ssb_periodicityServingCell; + cfg->ssb_table.ssb_period.tl.tag = NFAPI_NR_CONFIG_SSB_PERIOD_TAG; + cfg->num_tlv++; + cfg->ssb_table.ssb_subcarrier_offset.value = get_ssb_subcarrier_offset(*scc->downlinkConfigCommon->frequencyInfoDL->absoluteFrequencySSB, scc->downlinkConfigCommon->frequencyInfoDL->absoluteFrequencyPointA); - AssertFatal(cfg->ssb_table.ssb_subcarrier_offset.value < 16, - "cannot handle ssb_subcarrier_offset %d resulting from Point A %ld SSB %ld: please increase dl_absoluteFrequencyPointA " - "in the config by 16\n", - cfg->ssb_table.ssb_subcarrier_offset.value, - scc->downlinkConfigCommon->frequencyInfoDL->absoluteFrequencyPointA, - *scc->downlinkConfigCommon->frequencyInfoDL->absoluteFrequencySSB); - cfg->ssb_table.ssb_subcarrier_offset.tl.tag = NFAPI_NR_CONFIG_SSB_SUBCARRIER_OFFSET_TAG; - cfg->num_tlv++; - nrmac->ssb_SubcarrierOffset = cfg->ssb_table.ssb_subcarrier_offset.value; - nrmac->ssb_OffsetPointA = cfg->ssb_table.ssb_offset_point_a.value; - LOG_I(NR_MAC, - "ssb_OffsetPointA %d, ssb_SubcarrierOffset %d\n", - cfg->ssb_table.ssb_offset_point_a.value, - cfg->ssb_table.ssb_subcarrier_offset.value); + AssertFatal(cfg->ssb_table.ssb_subcarrier_offset.value < 16, + "cannot handle ssb_subcarrier_offset %d resulting from Point A %ld SSB %ld: please increase dl_absoluteFrequencyPointA " + "in the config by 16\n", + cfg->ssb_table.ssb_subcarrier_offset.value, + scc->downlinkConfigCommon->frequencyInfoDL->absoluteFrequencyPointA, + *scc->downlinkConfigCommon->frequencyInfoDL->absoluteFrequencySSB); + cfg->ssb_table.ssb_subcarrier_offset.tl.tag = NFAPI_NR_CONFIG_SSB_SUBCARRIER_OFFSET_TAG; + cfg->num_tlv++; - switch (scc->ssb_PositionsInBurst->present) { + nrmac->ssb_SubcarrierOffset = cfg->ssb_table.ssb_subcarrier_offset.value; + nrmac->ssb_OffsetPointA = cfg->ssb_table.ssb_offset_point_a.value; + LOG_I(NR_MAC, + "ssb_OffsetPointA %d, ssb_SubcarrierOffset %d\n", + cfg->ssb_table.ssb_offset_point_a.value, + cfg->ssb_table.ssb_subcarrier_offset.value); + + switch (scc->ssb_PositionsInBurst->present) { case 1: cfg->ssb_table.ssb_mask_list[0].ssb_mask.value = scc->ssb_PositionsInBurst->choice.shortBitmap.buf[0] << 24; cfg->ssb_table.ssb_mask_list[1].ssb_mask.value = 0; @@ -369,19 +678,20 @@ static void config_common(gNB_MAC_INST *nrmac, int pdsch_AntennaPorts, int pusch break; default: AssertFatal(1 == 0, "SSB bitmap size value %d undefined (allowed values 1,2,3) \n", scc->ssb_PositionsInBurst->present); - } + } - cfg->ssb_table.ssb_mask_list[0].ssb_mask.tl.tag = NFAPI_NR_CONFIG_SSB_MASK_TAG; - cfg->ssb_table.ssb_mask_list[1].ssb_mask.tl.tag = NFAPI_NR_CONFIG_SSB_MASK_TAG; - cfg->num_tlv += 2; + cfg->ssb_table.ssb_mask_list[0].ssb_mask.tl.tag = NFAPI_NR_CONFIG_SSB_MASK_TAG; + cfg->ssb_table.ssb_mask_list[1].ssb_mask.tl.tag = NFAPI_NR_CONFIG_SSB_MASK_TAG; + cfg->num_tlv += 2; - // logical antenna ports - cfg->carrier_config.num_tx_ant.value = pdsch_AntennaPorts; - AssertFatal(pdsch_AntennaPorts > 0 && pdsch_AntennaPorts < 33, "pdsch_AntennaPorts in 1...32\n"); - cfg->carrier_config.num_tx_ant.tl.tag = NFAPI_NR_CONFIG_NUM_TX_ANT_TAG; + // logical antenna ports + int num_pdsch_antenna_ports = pdsch_AntennaPorts.N1 * pdsch_AntennaPorts.N2 * pdsch_AntennaPorts.XP; + cfg->carrier_config.num_tx_ant.value = num_pdsch_antenna_ports; + AssertFatal(num_pdsch_antenna_ports > 0 && num_pdsch_antenna_ports < 33, "pdsch_AntennaPorts in 1...32\n"); + cfg->carrier_config.num_tx_ant.tl.tag = NFAPI_NR_CONFIG_NUM_TX_ANT_TAG; - int num_ssb = 0; - for (int i = 0; i < 32; i++) { + int num_ssb = 0; + for (int i = 0; i < 32; i++) { cfg->ssb_table.ssb_beam_id_list[i].beam_id.tl.tag = NFAPI_NR_CONFIG_BEAM_ID_TAG; if ((cfg->ssb_table.ssb_mask_list[0].ssb_mask.value >> (31 - i)) & 1) { cfg->ssb_table.ssb_beam_id_list[i].beam_id.value = num_ssb; @@ -396,26 +706,26 @@ static void config_common(gNB_MAC_INST *nrmac, int pdsch_AntennaPorts, int pusch num_ssb++; } cfg->num_tlv++; - } + } - cfg->carrier_config.num_rx_ant.value = pusch_AntennaPorts; - AssertFatal(pusch_AntennaPorts > 0 && pusch_AntennaPorts < 13, "pusch_AntennaPorts in 1...12\n"); - cfg->carrier_config.num_rx_ant.tl.tag = NFAPI_NR_CONFIG_NUM_RX_ANT_TAG; - LOG_I(NR_MAC, - "Set RX antenna number to %d, Set TX antenna number to %d (num ssb %d: %x,%x)\n", - cfg->carrier_config.num_tx_ant.value, - cfg->carrier_config.num_rx_ant.value, - num_ssb, - cfg->ssb_table.ssb_mask_list[0].ssb_mask.value, - cfg->ssb_table.ssb_mask_list[1].ssb_mask.value); - AssertFatal(cfg->carrier_config.num_tx_ant.value > 0, - "carrier_config.num_tx_ant.value %d !\n", - cfg->carrier_config.num_tx_ant.value); - cfg->num_tlv++; - cfg->num_tlv++; + cfg->carrier_config.num_rx_ant.value = pusch_AntennaPorts; + AssertFatal(pusch_AntennaPorts > 0 && pusch_AntennaPorts < 13, "pusch_AntennaPorts in 1...12\n"); + cfg->carrier_config.num_rx_ant.tl.tag = NFAPI_NR_CONFIG_NUM_RX_ANT_TAG; + LOG_I(NR_MAC, + "Set RX antenna number to %d, Set TX antenna number to %d (num ssb %d: %x,%x)\n", + cfg->carrier_config.num_tx_ant.value, + cfg->carrier_config.num_rx_ant.value, + num_ssb, + cfg->ssb_table.ssb_mask_list[0].ssb_mask.value, + cfg->ssb_table.ssb_mask_list[1].ssb_mask.value); + AssertFatal(cfg->carrier_config.num_tx_ant.value > 0, + "carrier_config.num_tx_ant.value %d !\n", + cfg->carrier_config.num_tx_ant.value); + cfg->num_tlv++; + cfg->num_tlv++; - // TDD Table Configuration - if (cfg->cell_config.frame_duplex_type.value == TDD) { + // TDD Table Configuration + if (cfg->cell_config.frame_duplex_type.value == TDD) { cfg->tdd_table.tdd_period.tl.tag = NFAPI_NR_CONFIG_TDD_PERIOD_TAG; cfg->num_tlv++; if (scc->tdd_UL_DL_ConfigurationCommon->pattern1.ext1 == NULL) { @@ -440,7 +750,10 @@ static void config_common(gNB_MAC_INST *nrmac, int pdsch_AntennaPorts, int pusch LOG_I(NR_MAC, "TDD has been properly configurated\n"); nrmac->tdd_beam_association = (int16_t *)malloc16(periods_per_frame * sizeof(int16_t)); } - } + } + + // precoding matrix configuration (to be improved) + cfg->pmi_list = init_DL_MIMO_codebook(nrmac, pdsch_AntennaPorts); } void nr_mac_config_scc(gNB_MAC_INST *nrmac, NR_ServingCellConfigCommon_t *scc, const nr_mac_config_t *config) @@ -464,8 +777,7 @@ void nr_mac_config_scc(gNB_MAC_INST *nrmac, NR_ServingCellConfigCommon_t *scc, c LOG_I(NR_MAC, "Configuring common parameters from NR ServingCellConfig\n"); - int num_pdsch_antenna_ports = config->pdsch_AntennaPorts.N1 * config->pdsch_AntennaPorts.N2 * config->pdsch_AntennaPorts.XP; - config_common(nrmac, num_pdsch_antenna_ports, config->pusch_AntennaPorts, scc); + config_common(nrmac, config->pdsch_AntennaPorts, config->pusch_AntennaPorts, scc); if (NFAPI_MODE == NFAPI_MODE_PNF || NFAPI_MODE == NFAPI_MODE_VNF) { // fake that the gNB is configured in nFAPI mode, which would normally be diff --git a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_dlsch.c b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_dlsch.c index b3a4396410..66fda58122 100644 --- a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_dlsch.c +++ b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_dlsch.c @@ -668,8 +668,7 @@ static void pf_dl(module_id_t module_id, else sched_pdsch->mcs = get_mcs_from_bler(bo, stats, &sched_ctrl->dl_bler_stats, max_mcs, frame); sched_pdsch->nrOfLayers = get_dl_nrOfLayers(sched_ctrl, current_BWP->dci_format); - sched_pdsch->pm_index = - mac->identity_pm ? 0 : get_pm_index(UE, sched_pdsch->nrOfLayers, mac->radio_config.pdsch_AntennaPorts.XP); + sched_pdsch->pm_index = mac->identity_pm ? 0 : get_pm_index(mac, UE, sched_pdsch->nrOfLayers, mac->radio_config.pdsch_AntennaPorts.XP); const uint8_t Qm = nr_get_Qm_dl(sched_pdsch->mcs, current_BWP->mcsTableIdx); const uint16_t R = nr_get_code_rate_dl(sched_pdsch->mcs, current_BWP->mcsTableIdx); uint32_t tbs = nr_compute_tbs(Qm, diff --git a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_primitives.c b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_primitives.c index 89ac444e63..73cd0de6d2 100644 --- a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_primitives.c +++ b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_primitives.c @@ -129,29 +129,36 @@ uint8_t get_dl_nrOfLayers(const NR_UE_sched_ctrl_t *sched_ctrl, } -uint16_t get_pm_index(const NR_UE_info_t *UE, +uint16_t get_pm_index(const gNB_MAC_INST *nrmac, + const NR_UE_info_t *UE, int layers, - int xp_pdsch_antenna_ports) { - - if (layers == 1) return 0; - + int xp_pdsch_antenna_ports) +{ const NR_UE_sched_ctrl_t *sched_ctrl = &UE->UE_sched_ctrl; const int report_id = sched_ctrl->CSI_report.cri_ri_li_pmi_cqi_report.csi_report_id; const nr_csi_report_t *csi_report = &UE->csi_report_template[report_id]; const int N1 = csi_report->N1; const int N2 = csi_report->N2; - const int antenna_ports = (N1*N2)<<1; + const int antenna_ports = (N1 * N2) << 1; - if (xp_pdsch_antenna_ports == 1 && - antenna_ports>1) + if (xp_pdsch_antenna_ports == 1) return 0; //identity matrix (basic 5G configuration handled by PMI report is with XP antennas) const int x1 = sched_ctrl->CSI_report.cri_ri_li_pmi_cqi_report.pmi_x1; const int x2 = sched_ctrl->CSI_report.cri_ri_li_pmi_cqi_report.pmi_x2; - LOG_D(NR_MAC,"PMI report: x1 %d x2 %d\n",x1,x2); + LOG_D(NR_MAC,"PMI report: x1 %d x2 %d layers: %d\n", x1, x2, layers); + int prev_layers_size = 0; + for (int i = 1; i < layers; i++) + prev_layers_size += nrmac->precoding_matrix_size[i - 1]; + + // need to return PM index to matrix initialized in init_DL_MIMO_codebook + // index 0 is for identity matrix + // order of matrices depends on layers to be transmitted + // elements from 1 to n for 1 layer + // elements from n+1 to m for 2 layers etc. if (antenna_ports == 2) - return x2; + return 1 + prev_layers_size + x2; // 0 for identity matrix else AssertFatal(1==0,"More than 2 antenna ports not yet supported\n"); } diff --git a/openair2/LAYER2/NR_MAC_gNB/mac_proto.h b/openair2/LAYER2/NR_MAC_gNB/mac_proto.h index f5f4d0beb1..1bdb08bb60 100644 --- a/openair2/LAYER2/NR_MAC_gNB/mac_proto.h +++ b/openair2/LAYER2/NR_MAC_gNB/mac_proto.h @@ -377,7 +377,8 @@ NR_pdsch_dmrs_t get_dl_dmrs_params(const NR_ServingCellConfigCommon_t *scc, const NR_tda_info_t *tda_info, const int Layers); -uint16_t get_pm_index(const NR_UE_info_t *UE, +uint16_t get_pm_index(const gNB_MAC_INST *nrmac, + const NR_UE_info_t *UE, int layers, int xp_pdsch_antenna_ports); diff --git a/openair2/LAYER2/NR_MAC_gNB/nr_mac_gNB.h b/openair2/LAYER2/NR_MAC_gNB/nr_mac_gNB.h index 2f550e642a..f2c66bd99f 100644 --- a/openair2/LAYER2/NR_MAC_gNB/nr_mac_gNB.h +++ b/openair2/LAYER2/NR_MAC_gNB/nr_mac_gNB.h @@ -852,6 +852,7 @@ typedef struct gNB_MAC_INST_s { uint8_t min_grant_prb; uint8_t min_grant_mcs; bool identity_pm; + int precoding_matrix_size[NR_MAX_NB_LAYERS]; nr_mac_rrc_ul_if_t mac_rrc; f1_config_t f1_config; From 1b9f674572d596ed167d72653fe5e57196bc6c40 Mon Sep 17 00:00:00 2001 From: francescomani Date: Fri, 5 Jan 2024 10:45:14 +0100 Subject: [PATCH 20/29] clean asn1_msg from mod_id --- openair2/RRC/NR/MESSAGES/asn1_msg.c | 20 +++++++------------- openair2/RRC/NR/MESSAGES/asn1_msg.h | 11 ++++------- openair2/RRC/NR/rrc_gNB.c | 2 +- openair2/RRC/NR/rrc_gNB_NGAP.c | 3 +-- openair2/RRC/NR_UE/rrc_UE.c | 2 +- 5 files changed, 14 insertions(+), 24 deletions(-) diff --git a/openair2/RRC/NR/MESSAGES/asn1_msg.c b/openair2/RRC/NR/MESSAGES/asn1_msg.c index 4a1295af9e..5b50ecb44e 100644 --- a/openair2/RRC/NR/MESSAGES/asn1_msg.c +++ b/openair2/RRC/NR/MESSAGES/asn1_msg.c @@ -242,10 +242,7 @@ uint8_t do_SIB23_NR(rrc_gNB_carrier_data_t *carrier) return((enc_rval.encoded+7)/8); } -//------------------------------------------------------------------------------ -int do_RRCReject(uint8_t Mod_id, - uint8_t *const buffer) -//------------------------------------------------------------------------------ +int do_RRCReject(uint8_t *const buffer) { asn_enc_rval_t enc_rval; NR_DL_CCCH_Message_t dl_ccch_msg; @@ -877,8 +874,7 @@ uint8_t do_NR_RRCReconfigurationComplete(uint8_t *buffer, size_t buffer_size, co return((enc_rval.encoded+7)/8); } -uint8_t do_RRCSetupComplete(uint8_t Mod_id, - uint8_t *buffer, +uint8_t do_RRCSetupComplete(uint8_t *buffer, size_t buffer_size, const uint8_t Transaction_id, uint8_t sel_plmn_id, @@ -886,7 +882,6 @@ uint8_t do_RRCSetupComplete(uint8_t Mod_id, const char *dedicatedInfoNAS) { NR_UL_DCCH_Message_t ul_dcch_msg = {0}; - ul_dcch_msg.message.present = NR_UL_DCCH_MessageType_PR_c1; ul_dcch_msg.message.choice.c1 = CALLOC(1,sizeof(struct NR_UL_DCCH_MessageType__c1)); ul_dcch_msg.message.choice.c1->present = NR_UL_DCCH_MessageType__c1_PR_rrcSetupComplete; @@ -931,14 +926,11 @@ uint8_t do_RRCSetupComplete(uint8_t Mod_id, return((enc_rval.encoded+7)/8); } -//------------------------------------------------------------------------------ -uint8_t do_NR_DLInformationTransfer(uint8_t Mod_id, - uint8_t *buffer, +uint8_t do_NR_DLInformationTransfer(uint8_t *buffer, size_t buffer_len, uint8_t transaction_id, uint32_t pdu_length, uint8_t *pdu_buffer) -//------------------------------------------------------------------------------ { NR_DL_DCCH_Message_t dl_dcch_msg = {0}; dl_dcch_msg.message.present = NR_DL_DCCH_MessageType_PR_c1; @@ -987,7 +979,8 @@ uint8_t do_NR_ULInformationTransfer(uint8_t **buffer, uint32_t pdu_length, uint8 return encoded; } -uint8_t do_RRCReestablishmentRequest(uint8_t Mod_id, uint8_t *buffer, uint16_t c_rnti) { +uint8_t do_RRCReestablishmentRequest(uint8_t *buffer, uint16_t c_rnti) +{ asn_enc_rval_t enc_rval; NR_UL_CCCH_Message_t ul_ccch_msg; NR_RRCReestablishmentRequest_t *rrcReestablishmentRequest; @@ -1195,7 +1188,8 @@ void free_defaultMeasConfig(NR_MeasConfig_t *mc) ASN_STRUCT_FREE(asn_DEF_NR_MeasConfig, mc); } -uint8_t do_NR_Paging(uint8_t Mod_id, uint8_t *buffer, uint32_t tmsi) { +uint8_t do_NR_Paging(uint8_t Mod_id, uint8_t *buffer, uint32_t tmsi) +{ LOG_D(NR_RRC, "[gNB %d] do_NR_Paging start\n", Mod_id); NR_PCCH_Message_t pcch_msg; pcch_msg.message.present = NR_PCCH_MessageType_PR_c1; diff --git a/openair2/RRC/NR/MESSAGES/asn1_msg.h b/openair2/RRC/NR/MESSAGES/asn1_msg.h index a0ffb8971f..143717390c 100644 --- a/openair2/RRC/NR/MESSAGES/asn1_msg.h +++ b/openair2/RRC/NR/MESSAGES/asn1_msg.h @@ -57,8 +57,7 @@ int xer_sprint_NR(char *string, size_t string_size, struct asn_TYPE_descriptor_s uint8_t do_SIB23_NR(rrc_gNB_carrier_data_t *carrier); -int do_RRCReject(uint8_t Mod_id, - uint8_t *const buffer); +int do_RRCReject(uint8_t *const buffer); NR_RLC_BearerConfig_t *get_SRB_RLC_BearerConfig( long channelId, @@ -109,8 +108,7 @@ int16_t do_RRCReconfiguration(const gNB_RRC_UE_t *UE, struct NR_RRCReconfiguration_v1530_IEs__dedicatedNAS_MessageList *dedicatedNAS_MessageList, NR_CellGroupConfig_t *cellGroupConfig); -uint8_t do_RRCSetupComplete(uint8_t Mod_id, - uint8_t *buffer, +uint8_t do_RRCSetupComplete(uint8_t *buffer, size_t buffer_size, const uint8_t Transaction_id, uint8_t sel_plmn_id, @@ -123,8 +121,7 @@ uint8_t do_NR_RRCReconfigurationComplete_for_nsa(uint8_t *buffer, size_t buffer_ uint8_t do_NR_RRCReconfigurationComplete(uint8_t *buffer, size_t buffer_size, const uint8_t Transaction_id); -uint8_t do_NR_DLInformationTransfer(uint8_t Mod_id, - uint8_t *buffer, +uint8_t do_NR_DLInformationTransfer(uint8_t *buffer, size_t buffer_len, uint8_t transaction_id, uint32_t pdu_length, @@ -134,7 +131,7 @@ uint8_t do_NR_ULInformationTransfer(uint8_t **buffer, uint32_t pdu_length, uint8_t *pdu_buffer); -uint8_t do_RRCReestablishmentRequest(uint8_t Mod_id, uint8_t *buffer, uint16_t c_rnti); +uint8_t do_RRCReestablishmentRequest(uint8_t *buffer, uint16_t c_rnti); int do_RRCReestablishment(rrc_gNB_ue_context_t *const ue_context_pP, uint8_t *const buffer, diff --git a/openair2/RRC/NR/rrc_gNB.c b/openair2/RRC/NR/rrc_gNB.c index fe51b6c54e..b78799a108 100644 --- a/openair2/RRC/NR/rrc_gNB.c +++ b/openair2/RRC/NR/rrc_gNB.c @@ -492,7 +492,7 @@ static void rrc_gNB_generate_RRCReject(module_id_t module_id, rrc_gNB_ue_context gNB_RRC_UE_t *ue_p = &ue_context_pP->ue_context; unsigned char buf[1024]; - int size = do_RRCReject(module_id, buf); + int size = do_RRCReject(buf); AssertFatal(size > 0, "do_RRCReject failed\n"); AssertFatal(size <= 1024, "memory corruption\n"); diff --git a/openair2/RRC/NR/rrc_gNB_NGAP.c b/openair2/RRC/NR/rrc_gNB_NGAP.c index 00497d6d1b..05067fe12f 100644 --- a/openair2/RRC/NR/rrc_gNB_NGAP.c +++ b/openair2/RRC/NR/rrc_gNB_NGAP.c @@ -623,8 +623,7 @@ int rrc_gNB_process_NGAP_DOWNLINK_NAS(MessageDef *msg_p, instance_t instance, mu PROTOCOL_CTXT_SET_BY_INSTANCE(&ctxt, instance, GNB_FLAG_YES, UE->rrc_ue_id, 0, 0); /* Create message for PDCP (DLInformationTransfer_t) */ - length = do_NR_DLInformationTransfer(instance, - buffer, + length = do_NR_DLInformationTransfer(buffer, sizeof(buffer), rrc_gNB_get_next_transaction_identifier(instance), req->nas_pdu.length, diff --git a/openair2/RRC/NR_UE/rrc_UE.c b/openair2/RRC/NR_UE/rrc_UE.c index 5ff35d4dc6..4b2d91ff61 100644 --- a/openair2/RRC/NR_UE/rrc_UE.c +++ b/openair2/RRC/NR_UE/rrc_UE.c @@ -865,7 +865,7 @@ static void rrc_ue_generate_RRCSetupComplete(instance_t instance, rnti_t rnti, c nas_msg_length = sizeof(nr_nas_attach_req_imsi_dummy_NSA_case); } - size = do_RRCSetupComplete(instance, buffer, sizeof(buffer), Transaction_id, sel_plmn_id, nas_msg_length, nas_msg); + size = do_RRCSetupComplete(buffer, sizeof(buffer), Transaction_id, sel_plmn_id, nas_msg_length, nas_msg); LOG_I(NR_RRC, "[UE %ld][RAPROC] Logical Channel UL-DCCH (SRB1), Generating RRCSetupComplete (bytes%d)\n", instance, size); int srb_id = 1; // RRC setup complete on SRB1 LOG_D(NR_RRC, "[RRC_UE %ld] PDCP_DATA_REQ/%d Bytes RRCSetupComplete ---> %d\n", instance, size, srb_id); From 82e323eed4061dab53f281c4cd9591eb7ca13507 Mon Sep 17 00:00:00 2001 From: francescomani Date: Fri, 5 Jan 2024 14:37:33 +0100 Subject: [PATCH 21/29] using instance to identify PDCP at UE --- executables/nr-ue.c | 2 +- openair2/LAYER2/nr_pdcp/nr_pdcp_oai_api.c | 18 +++---- openair2/RRC/NR_UE/rrc_UE.c | 60 ++++++++++------------- openair2/RRC/NR_UE/rrc_defs.h | 2 + openair2/SDAP/nr_sdap/nr_sdap_entity.c | 10 +++- 5 files changed, 46 insertions(+), 46 deletions(-) diff --git a/executables/nr-ue.c b/executables/nr-ue.c index a9f8364a66..36a798cfff 100644 --- a/executables/nr-ue.c +++ b/executables/nr-ue.c @@ -1001,7 +1001,7 @@ void init_NR_UE(int nb_inst, char *uecap_file, char *reconfig_file, char *rbconf // set up PDCP, RLC, MAC nr_pdcp_layer_init(false); - nr_pdcp_add_drbs(ENB_FLAG_NO, mac_inst->crnti, rbconfig->drb_ToAddModList, 0, NULL, NULL); + nr_pdcp_add_drbs(ENB_FLAG_NO, inst, rbconfig->drb_ToAddModList, 0, NULL, NULL); nr_rlc_add_drb(mac_inst->crnti, rbconfig->drb_ToAddModList->list.array[0]->drb_Identity, rlc_rbconfig); struct NR_CellGroupConfig__rlc_BearerToAddModList rlc_toadd_list; rlc_toadd_list.list.count = 1; diff --git a/openair2/LAYER2/nr_pdcp/nr_pdcp_oai_api.c b/openair2/LAYER2/nr_pdcp/nr_pdcp_oai_api.c index 46383c7b11..e36dbb255e 100644 --- a/openair2/LAYER2/nr_pdcp/nr_pdcp_oai_api.c +++ b/openair2/LAYER2/nr_pdcp/nr_pdcp_oai_api.c @@ -765,7 +765,7 @@ void deliver_pdu_srb_rlc(void *deliver_pdu_data, ue_id_t ue_id, int srb_id, } void add_srb(int is_gnb, - ue_id_t rntiMaybeUEid, + ue_id_t UEid, struct NR_SRB_ToAddMod *s, int ciphering_algorithm, int integrity_algorithm, @@ -781,9 +781,9 @@ void add_srb(int is_gnb, t_Reordering = decode_t_reordering(*s->pdcp_Config->t_Reordering); nr_pdcp_manager_lock(nr_pdcp_ue_manager); - ue = nr_pdcp_manager_get_ue(nr_pdcp_ue_manager, rntiMaybeUEid); + ue = nr_pdcp_manager_get_ue(nr_pdcp_ue_manager, UEid); if (nr_pdcp_get_rb(ue, srb_id, true) != NULL) { - LOG_E(PDCP, "warning SRB %d already exist for UE ID/RNTI %ld, do nothing\n", srb_id, rntiMaybeUEid); + LOG_E(PDCP, "warning SRB %d already exist for UE ID %ld, do nothing\n", srb_id, UEid); } else { pdcp_srb = new_nr_pdcp_entity(NR_PDCP_SRB, is_gnb, srb_id, 0, false, false, // sdap parameters @@ -795,13 +795,13 @@ void add_srb(int is_gnb, integrity_key); nr_pdcp_ue_add_srb_pdcp_entity(ue, srb_id, pdcp_srb); - LOG_D(PDCP, "%s:%d:%s: added srb %d to UE ID/RNTI %ld\n", __FILE__, __LINE__, __FUNCTION__, srb_id, rntiMaybeUEid); + LOG_D(PDCP, "added srb %d to UE ID %ld\n", srb_id, UEid); } nr_pdcp_manager_unlock(nr_pdcp_ue_manager); } void add_drb(int is_gnb, - ue_id_t rntiMaybeUEid, + ue_id_t UEid, struct NR_DRB_ToAddMod *s, int ciphering_algorithm, int integrity_algorithm, @@ -877,9 +877,9 @@ void add_drb(int is_gnb, nr_pdcp_manager_lock(nr_pdcp_ue_manager); - ue = nr_pdcp_manager_get_ue(nr_pdcp_ue_manager, rntiMaybeUEid); + ue = nr_pdcp_manager_get_ue(nr_pdcp_ue_manager, UEid); if (nr_pdcp_get_rb(ue, drb_id, false) != NULL) { - LOG_W(PDCP, "warning DRB %d already exist for UE ID/RNTI %ld, do nothing\n", drb_id, rntiMaybeUEid); + LOG_W(PDCP, "warning DRB %d already exist for UE ID %ld, do nothing\n", drb_id, UEid); } else { pdcp_drb = new_nr_pdcp_entity(NR_PDCP_DRB_AM, is_gnb, drb_id, pdusession_id, has_sdap_rx, has_sdap_tx, deliver_sdu_drb, ue, @@ -893,9 +893,9 @@ void add_drb(int is_gnb, has_integrity ? integrity_key : NULL); nr_pdcp_ue_add_drb_pdcp_entity(ue, drb_id, pdcp_drb); - LOG_D(PDCP, "%s:%d:%s: added drb %d to UE ID/RNTI %ld\n", __FILE__, __LINE__, __FUNCTION__, drb_id, rntiMaybeUEid); + LOG_D(PDCP, "added drb %d to UE ID %ld\n", drb_id, UEid); - new_nr_sdap_entity(is_gnb, has_sdap_rx, has_sdap_tx, rntiMaybeUEid, pdusession_id, is_sdap_DefaultDRB, drb_id, mappedQFIs2Add, mappedQFIs2AddCount); + new_nr_sdap_entity(is_gnb, has_sdap_rx, has_sdap_tx, UEid, pdusession_id, is_sdap_DefaultDRB, drb_id, mappedQFIs2Add, mappedQFIs2AddCount); } nr_pdcp_manager_unlock(nr_pdcp_ue_manager); } diff --git a/openair2/RRC/NR_UE/rrc_UE.c b/openair2/RRC/NR_UE/rrc_UE.c index 4b2d91ff61..1b33e60fdf 100644 --- a/openair2/RRC/NR_UE/rrc_UE.c +++ b/openair2/RRC/NR_UE/rrc_UE.c @@ -140,7 +140,6 @@ static void nr_rrc_manage_rlc_bearers(const instance_t instance, const rnti_t rnti); static void nr_rrc_ue_process_RadioBearerConfig(NR_UE_RRC_INST_t *ue_rrc, - rnti_t rnti, rrcPerNB_t *rrcNB, NR_RadioBearerConfig_t *const radioBearerConfig); static void nr_rrc_ue_generate_RRCSetupRequest(NR_UE_RRC_INST_t *rrc, rnti_t rnti); @@ -148,12 +147,10 @@ static void nr_rrc_ue_generate_rrcReestablishmentComplete(NR_RRCReestablishment_ static void process_lte_nsa_msg(NR_UE_RRC_INST_t *rrc, nsa_msg_t *msg, int msg_len); static void nr_rrc_ue_process_rrcReconfiguration(const instance_t instance, int gNB_index, - rnti_t rnti, NR_RRCReconfiguration_t *rrcReconfiguration); static void nr_rrc_ue_process_ueCapabilityEnquiry(NR_UE_RRC_INST_t *rrc, NR_UECapabilityEnquiry_t *UECapabilityEnquiry); static void nr_rrc_ue_process_masterCellGroup(instance_t instance, - rnti_t rnti, rrcPerNB_t *rrcNB, OCTET_STRING_t *masterCellGroup, long *fullConfig); @@ -162,7 +159,6 @@ void nr_rrc_ue_process_measConfig(rrcPerNB_t *rrc, NR_MeasConfig_t *const measCo static void nr_rrc_ue_process_rrcReconfiguration(const instance_t instance, int gNB_index, - rnti_t rnti, NR_RRCReconfiguration_t *rrcReconfiguration) { NR_UE_RRC_INST_t *rrc = &NR_UE_rrc_inst[instance]; @@ -174,7 +170,7 @@ static void nr_rrc_ue_process_rrcReconfiguration(const instance_t instance, if (ie->radioBearerConfig != NULL) { LOG_I(NR_RRC, "radio Bearer Configuration is present\n"); - nr_rrc_ue_process_RadioBearerConfig(rrc, rnti, rrcNB, ie->radioBearerConfig); + nr_rrc_ue_process_RadioBearerConfig(rrc, rrcNB, ie->radioBearerConfig); if (LOG_DEBUGFLAG(DEBUG_ASN1)) xer_fprint(stdout, &asn_DEF_NR_RadioBearerConfig, (const void *)ie->radioBearerConfig); } @@ -182,7 +178,7 @@ static void nr_rrc_ue_process_rrcReconfiguration(const instance_t instance, if (ie->nonCriticalExtension) { NR_RRCReconfiguration_v1530_IEs_t *ext = ie->nonCriticalExtension; if (ext->masterCellGroup) - nr_rrc_ue_process_masterCellGroup(instance, rnti, rrcNB, ext->masterCellGroup, ext->fullConfig); + nr_rrc_ue_process_masterCellGroup(instance, rrcNB, ext->masterCellGroup, ext->fullConfig); /* Check if there is dedicated NAS information to forward to NAS */ if (ie->nonCriticalExtension->dedicatedNAS_MessageList) { struct NR_RRCReconfiguration_v1530_IEs__dedicatedNAS_MessageList *tmp = ext->dedicatedNAS_MessageList; @@ -263,7 +259,7 @@ void process_nsa_message(NR_UE_RRC_INST_t *rrc, nsa_message_t nsa_message_type, SEQUENCE_free( &asn_DEF_NR_RRCReconfiguration, RRCReconfiguration, 1 ); return; } - nr_rrc_ue_process_rrcReconfiguration(0, 0, rrc->rnti, RRCReconfiguration); + nr_rrc_ue_process_rrcReconfiguration(0, 0, RRCReconfiguration); ASN_STRUCT_FREE(asn_DEF_NR_RRCReconfiguration, RRCReconfiguration); } break; @@ -289,7 +285,7 @@ void process_nsa_message(NR_UE_RRC_INST_t *rrc, nsa_message_t nsa_message_type, RadioBearerConfig->drb_ToAddModList->list.array[0]->drb_Identity, RadioBearerConfig->securityConfig->securityAlgorithmConfig->cipheringAlgorithm, *RadioBearerConfig->securityConfig->keyToUse); - nr_rrc_ue_process_RadioBearerConfig(rrc, rrc->rnti, rrc->perNB + 0, RadioBearerConfig); + nr_rrc_ue_process_RadioBearerConfig(rrc, rrc->perNB + 0, RadioBearerConfig); } if (LOG_DEBUGFLAG(DEBUG_ASN1)) xer_fprint(stdout, &asn_DEF_NR_RadioBearerConfig, (const void *)RadioBearerConfig); @@ -309,6 +305,7 @@ NR_UE_RRC_INST_t* openair_rrc_top_init_ue_nr(char* uecap_file) NR_UE_rrc_inst = (NR_UE_RRC_INST_t *)calloc(NB_NR_UE_INST , sizeof(NR_UE_RRC_INST_t)); for(int nr_ue = 0; nr_ue < NB_NR_UE_INST; nr_ue++) { NR_UE_RRC_INST_t *rrc = &NR_UE_rrc_inst[nr_ue]; + rrc->ue_id = nr_ue; // fill UE-NR-Capability @ UE-CapabilityRAT-Container here. rrc->selected_plmn_identity = 1; @@ -824,7 +821,6 @@ void nr_rrc_cellgroup_configuration(rrcPerNB_t *rrcNB, static void nr_rrc_ue_process_masterCellGroup(instance_t instance, - rnti_t rnti, rrcPerNB_t *rrcNB, OCTET_STRING_t *masterCellGroup, long *fullConfig) @@ -847,7 +843,7 @@ static void nr_rrc_ue_process_masterCellGroup(instance_t instance, nr_rrc_mac_config_req_cg(instance, 0, cellGroupConfig); } -static void rrc_ue_generate_RRCSetupComplete(instance_t instance, rnti_t rnti, const uint8_t Transaction_id, uint8_t sel_plmn_id) +static void rrc_ue_generate_RRCSetupComplete(instance_t instance, const uint8_t Transaction_id, uint8_t sel_plmn_id) { uint8_t buffer[100]; uint8_t size; @@ -870,7 +866,7 @@ static void rrc_ue_generate_RRCSetupComplete(instance_t instance, rnti_t rnti, c int srb_id = 1; // RRC setup complete on SRB1 LOG_D(NR_RRC, "[RRC_UE %ld] PDCP_DATA_REQ/%d Bytes RRCSetupComplete ---> %d\n", instance, size, srb_id); - nr_pdcp_data_req_srb(rnti, srb_id, 0, size, buffer, deliver_pdu_srb_rlc, NULL); + nr_pdcp_data_req_srb(instance, srb_id, 0, size, buffer, deliver_pdu_srb_rlc, NULL); } static void nr_rrc_process_rrcsetup(const instance_t instance, @@ -887,13 +883,11 @@ static void nr_rrc_process_rrcsetup(const instance_t instance, // perform the cell group configuration procedure in accordance with the received masterCellGroup rrc->rnti = rnti; nr_rrc_ue_process_masterCellGroup(instance, - rnti, rrc->perNB + gNB_index, &rrcSetup->criticalExtensions.choice.rrcSetup->masterCellGroup, NULL); // perform the radio bearer configuration procedure in accordance with the received radioBearerConfig nr_rrc_ue_process_RadioBearerConfig(rrc, - rnti, rrc->perNB + gNB_index, &rrcSetup->criticalExtensions.choice.rrcSetup->radioBearerConfig); @@ -920,7 +914,6 @@ static void nr_rrc_process_rrcsetup(const instance_t instance, // set the content of RRCSetupComplete message // TODO procedues described in 5.3.3.4 seems more complex than what we actualy do rrc_ue_generate_RRCSetupComplete(instance, - rnti, rrcSetup->rrc_TransactionIdentifier, rrc->selected_plmn_identity); } @@ -981,7 +974,6 @@ static int8_t nr_rrc_ue_decode_ccch(const instance_t instance, static void nr_rrc_ue_process_securityModeCommand(NR_UE_RRC_INST_t *ue_rrc, NR_SecurityModeCommand_t *const securityModeCommand, - rnti_t rnti, const uint8_t gNB_index) { int securityMode = 0; @@ -1055,7 +1047,7 @@ static void nr_rrc_ue_process_securityModeCommand(NR_UE_RRC_INST_t *ue_rrc, // configure lower layers to apply SRB integrity protection and ciphering for (int i = 1; i < NR_NUM_SRB; i++) { if (ue_rrc->perNB[gNB_index].Srb[i] == RB_ESTABLISHED) - nr_pdcp_config_set_security(rnti, i, security_mode, kRRCenc, kRRCint, kUPenc); + nr_pdcp_config_set_security(ue_rrc->ue_id, i, security_mode, kRRCenc, kRRCint, kUPenc); } } else { LOG_I(NR_RRC, "skipped pdcp_config_set_security() as securityMode == 0x%02x", securityMode); @@ -1092,7 +1084,7 @@ static void nr_rrc_ue_process_securityModeCommand(NR_UE_RRC_INST_t *ue_rrc, // for the UE to declare AS security to be activated ue_rrc->as_security_activated = true; int srb_id = 1; // SecurityModeComplete in SRB1 - nr_pdcp_data_req_srb(rnti, srb_id, 0, (enc_rval.encoded + 7) / 8, buffer, deliver_pdu_srb_rlc, NULL); + nr_pdcp_data_req_srb(ue_rrc->ue_id, srb_id, 0, (enc_rval.encoded + 7) / 8, buffer, deliver_pdu_srb_rlc, NULL); } else LOG_W(NR_RRC, "securityModeCommand->criticalExtensions.present (%d) != " @@ -1214,15 +1206,15 @@ void nr_rrc_ue_process_measConfig(rrcPerNB_t *rrc, NR_MeasConfig_t *const measCo } static void nr_rrc_ue_process_RadioBearerConfig(NR_UE_RRC_INST_t *ue_rrc, - rnti_t rnti, rrcPerNB_t *rrcNB, NR_RadioBearerConfig_t *const radioBearerConfig) { if (LOG_DEBUGFLAG(DEBUG_ASN1)) xer_fprint(stdout, &asn_DEF_NR_RadioBearerConfig, (const void *)radioBearerConfig); + instance_t instance = ue_rrc->ue_id; if (radioBearerConfig->srb3_ToRelease) - nr_pdcp_release_srb(rnti, 3); + nr_pdcp_release_srb(instance, 3); uint8_t kRRCenc[16] = {0}; uint8_t kRRCint[16] = {0}; @@ -1249,7 +1241,7 @@ static void nr_rrc_ue_process_RadioBearerConfig(NR_UE_RRC_INST_t *ue_rrc, struct NR_SRB_ToAddMod *srb = radioBearerConfig->srb_ToAddModList->list.array[cnt]; if (rrcNB->Srb[srb->srb_Identity] == RB_NOT_PRESENT) add_srb(false, - rnti, + instance, radioBearerConfig->srb_ToAddModList->list.array[cnt], ue_rrc->cipheringAlgorithm, ue_rrc->integrityProtAlgorithm, @@ -1259,7 +1251,7 @@ static void nr_rrc_ue_process_RadioBearerConfig(NR_UE_RRC_INST_t *ue_rrc, AssertFatal(srb->discardOnPDCP == NULL, "discardOnPDCP not yet implemented\n"); AssertFatal(srb->reestablishPDCP == NULL, "reestablishPDCP not yet implemented\n"); if (srb->pdcp_Config && srb->pdcp_Config->t_Reordering) - nr_pdcp_reconfigure_srb(rnti, srb->srb_Identity, *srb->pdcp_Config->t_Reordering); + nr_pdcp_reconfigure_srb(instance, srb->srb_Identity, *srb->pdcp_Config->t_Reordering); } rrcNB->Srb[srb->srb_Identity] = RB_ESTABLISHED; } @@ -1269,7 +1261,7 @@ static void nr_rrc_ue_process_RadioBearerConfig(NR_UE_RRC_INST_t *ue_rrc, for (int cnt = 0; cnt < radioBearerConfig->drb_ToReleaseList->list.count; cnt++) { NR_DRB_Identity_t *DRB_id = radioBearerConfig->drb_ToReleaseList->list.array[cnt]; if (DRB_id) - nr_pdcp_release_drb(rnti, *DRB_id); + nr_pdcp_release_drb(instance, *DRB_id); } } @@ -1283,13 +1275,13 @@ static void nr_rrc_ue_process_RadioBearerConfig(NR_UE_RRC_INST_t *ue_rrc, AssertFatal(drb->recoverPDCP == NULL, "recoverPDCP not yet implemented\n"); NR_SDAP_Config_t *sdap_Config = drb->cnAssociation ? drb->cnAssociation->choice.sdap_Config : NULL; if (drb->pdcp_Config || sdap_Config) - nr_pdcp_reconfigure_drb(rnti, DRB_id, drb->pdcp_Config, sdap_Config); + nr_pdcp_reconfigure_drb(instance, DRB_id, drb->pdcp_Config, sdap_Config); if (drb->cnAssociation) AssertFatal(drb->cnAssociation->choice.sdap_Config == NULL, "SDAP reconfiguration not yet implemented\n"); } else { rrcNB->status_DRBs[DRB_id] = RB_ESTABLISHED; add_drb(false, - rnti, + instance, radioBearerConfig->drb_ToAddModList->list.array[cnt], ue_rrc->cipheringAlgorithm, ue_rrc->integrityProtAlgorithm, @@ -1303,7 +1295,7 @@ static void nr_rrc_ue_process_RadioBearerConfig(NR_UE_RRC_INST_t *ue_rrc, LOG_I(NR_RRC, "State = NR_RRC_CONNECTED\n"); } -static void nr_rrc_ue_generate_RRCReconfigurationComplete(rnti_t rnti, const int srb_id, const uint8_t Transaction_id) +static void nr_rrc_ue_generate_RRCReconfigurationComplete(instance_t instance, const int srb_id, const uint8_t Transaction_id) { uint8_t buffer[32], size; size = do_NR_RRCReconfigurationComplete(buffer, sizeof(buffer), Transaction_id); @@ -1314,11 +1306,10 @@ static void nr_rrc_ue_generate_RRCReconfigurationComplete(rnti_t rnti, const int "--->][PDCP][RB %02d]\n", size, srb_id); - nr_pdcp_data_req_srb(rnti, srb_id, 0, size, buffer, deliver_pdu_srb_rlc, NULL); + nr_pdcp_data_req_srb(instance, srb_id, 0, size, buffer, deliver_pdu_srb_rlc, NULL); } static int nr_rrc_ue_decode_dcch(instance_t instance, - rnti_t rnti, const srb_id_t Srb_id, const uint8_t *const Buffer, size_t Buffer_size, @@ -1353,8 +1344,8 @@ static int nr_rrc_ue_decode_dcch(instance_t instance, break; case NR_DL_DCCH_MessageType__c1_PR_rrcReconfiguration: { - nr_rrc_ue_process_rrcReconfiguration(instance, gNB_indexP, rnti, c1->choice.rrcReconfiguration); - nr_rrc_ue_generate_RRCReconfigurationComplete(rnti, Srb_id, c1->choice.rrcReconfiguration->rrc_TransactionIdentifier); + nr_rrc_ue_process_rrcReconfiguration(instance, gNB_indexP, c1->choice.rrcReconfiguration); + nr_rrc_ue_generate_RRCReconfigurationComplete(instance, Srb_id, c1->choice.rrcReconfiguration->rrc_TransactionIdentifier); } break; case NR_DL_DCCH_MessageType__c1_PR_rrcResume: @@ -1408,7 +1399,7 @@ static int nr_rrc_ue_decode_dcch(instance_t instance, break; case NR_DL_DCCH_MessageType__c1_PR_securityModeCommand: LOG_I(NR_RRC, "Received securityModeCommand (gNB %d)\n", gNB_indexP); - nr_rrc_ue_process_securityModeCommand(rrc, c1->choice.securityModeCommand, rnti, gNB_indexP); + nr_rrc_ue_process_securityModeCommand(rrc, c1->choice.securityModeCommand, gNB_indexP); break; } } break; @@ -1502,7 +1493,6 @@ void *rrc_nrue(void *notUsed) case NR_RRC_DCCH_DATA_IND: nr_rrc_ue_decode_dcch(instance, - NR_RRC_DCCH_DATA_IND(msg_p).rnti, NR_RRC_DCCH_DATA_IND(msg_p).dcch_index, NR_RRC_DCCH_DATA_IND(msg_p).sdu_p, NR_RRC_DCCH_DATA_IND(msg_p).sdu_size, @@ -1531,7 +1521,7 @@ void *rrc_nrue(void *notUsed) // check if SRB2 is created, if yes request data_req on SRB2 // error: the remote gNB is hardcoded here rb_id_t srb_id = rrc->perNB[0].Srb[2] == RB_ESTABLISHED ? 2 : 1; - nr_pdcp_data_req_srb(rrc->rnti, srb_id, 0, length, buffer, deliver_pdu_srb_rlc, NULL); + nr_pdcp_data_req_srb(instance, srb_id, 0, length, buffer, deliver_pdu_srb_rlc, NULL); break; } @@ -1643,7 +1633,7 @@ static void nr_rrc_ue_process_ueCapabilityEnquiry(NR_UE_RRC_INST_t *rrc, NR_UECa } LOG_I(NR_RRC, "UECapabilityInformation Encoded %zd bits (%zd bytes)\n",enc_rval.encoded,(enc_rval.encoded+7)/8); int srb_id = 1; // UECapabilityInformation on SRB1 - nr_pdcp_data_req_srb(rrc->rnti, srb_id, 0, (enc_rval.encoded + 7) / 8, buffer, deliver_pdu_srb_rlc, NULL); + nr_pdcp_data_req_srb(rrc->ue_id, srb_id, 0, (enc_rval.encoded + 7) / 8, buffer, deliver_pdu_srb_rlc, NULL); } } } @@ -1932,13 +1922,13 @@ void nr_rrc_going_to_IDLE(instance_t instance, for (int i = 0; i < MAX_DRBS_PER_UE; i++) { if (nb->status_DRBs[i] != RB_NOT_PRESENT) { nb->status_DRBs[i] = RB_NOT_PRESENT; - nr_pdcp_release_drb(rrc->rnti, i); + nr_pdcp_release_drb(instance, i); } } for (int i = 1; i < NR_NUM_SRB; i++) { if (nb->Srb[i] != RB_NOT_PRESENT) { nb->Srb[i] = RB_NOT_PRESENT; - nr_pdcp_release_srb(rrc->rnti, i); + nr_pdcp_release_srb(instance, i); } } for (int i = 0; i < NR_MAX_NUM_LCID; i++) { diff --git a/openair2/RRC/NR_UE/rrc_defs.h b/openair2/RRC/NR_UE/rrc_defs.h index 768d4caf1a..dacf5dd70d 100644 --- a/openair2/RRC/NR_UE/rrc_defs.h +++ b/openair2/RRC/NR_UE/rrc_defs.h @@ -206,6 +206,8 @@ typedef struct rrcPerNB { } rrcPerNB_t; typedef struct NR_UE_RRC_INST_s { + + instance_t ue_id; rrcPerNB_t perNB[NB_CNX_UE]; char *uecap_file; diff --git a/openair2/SDAP/nr_sdap/nr_sdap_entity.c b/openair2/SDAP/nr_sdap/nr_sdap_entity.c index d030eca60e..d7a4e74fc1 100644 --- a/openair2/SDAP/nr_sdap/nr_sdap_entity.c +++ b/openair2/SDAP/nr_sdap/nr_sdap_entity.c @@ -404,7 +404,15 @@ void nr_sdap_ue_qfi2drb_config(nr_sdap_entity_t *existing_sdap_entity, rb_id_t p } } -nr_sdap_entity_t *new_nr_sdap_entity(int is_gnb, bool has_sdap_rx, bool has_sdap_tx, ue_id_t ue_id, int pdusession_id, bool is_defaultDRB, uint8_t drb_identity, NR_QFI_t *mapped_qfi_2_add, uint8_t mappedQFIs2AddCount) +nr_sdap_entity_t *new_nr_sdap_entity(int is_gnb, + bool has_sdap_rx, + bool has_sdap_tx, + ue_id_t ue_id, + int pdusession_id, + bool is_defaultDRB, + uint8_t drb_identity, + NR_QFI_t *mapped_qfi_2_add, + uint8_t mappedQFIs2AddCount) { if (nr_sdap_get_entity(ue_id, pdusession_id)) { LOG_E(SDAP, "SDAP Entity for UE already exists with RNTI/UE ID: %lu and PDU SESSION ID: %d\n", ue_id, pdusession_id); From 08f0283c43e65e10da9ede98bb8903d9f9712988 Mon Sep 17 00:00:00 2001 From: francescomani Date: Fri, 5 Jan 2024 17:30:51 +0100 Subject: [PATCH 22/29] improvements in initializing multiple instances of MAC and RRC --- executables/nr-ue.c | 22 ++++----- executables/nr-uesoftmodem.c | 5 +- openair1/SIMULATION/NR_PHY/dlsim.c | 2 +- openair1/SIMULATION/NR_PHY/ulsim.c | 3 +- openair2/LAYER2/NR_MAC_UE/mac_defs.h | 2 +- openair2/LAYER2/NR_MAC_UE/mac_proto.h | 6 +-- openair2/LAYER2/NR_MAC_UE/main_ue_nr.c | 18 ++++--- openair2/LAYER2/NR_MAC_UE/nr_ue_procedures.c | 1 - openair2/LAYER2/nr_rlc/nr_rlc_oai_api.c | 5 +- openair2/RRC/NR_UE/main_ue.c | 5 -- openair2/RRC/NR_UE/rrc_UE.c | 51 +++++++++----------- openair2/RRC/NR_UE/rrc_defs.h | 1 - openair2/RRC/NR_UE/rrc_proto.h | 12 +---- 13 files changed, 59 insertions(+), 74 deletions(-) diff --git a/executables/nr-ue.c b/executables/nr-ue.c index 36a798cfff..e889bd27ab 100644 --- a/executables/nr-ue.c +++ b/executables/nr-ue.c @@ -981,18 +981,18 @@ void *UE_thread(void *arg) void init_NR_UE(int nb_inst, char *uecap_file, char *reconfig_file, char *rbconfig_file) { - NR_UE_MAC_INST_t *mac_inst; - NR_UE_RRC_INST_t* rrc_inst; - - for (int inst = 0; inst < nb_inst; inst++) { - AssertFatal((rrc_inst = nr_l3_init_ue(uecap_file)) != NULL, "can not initialize RRC module\n"); - AssertFatal((mac_inst = nr_l2_init_ue()) != NULL, "can not initialize L2 module\n"); - AssertFatal((mac_inst->if_module = nr_ue_if_module_init(inst)) != NULL, "can not initialize IF module\n"); + NR_UE_RRC_INST_t *rrc_inst = nr_rrc_init_ue(uecap_file, nb_inst); + NR_UE_MAC_INST_t *mac_inst = nr_l2_init_ue(nb_inst); + AssertFatal(mac_inst, "Couldn't allocate MAC module\n"); + + for (int i = 0; i < nb_inst; i++) { + NR_UE_MAC_INST_t *mac = get_mac_inst(i); + AssertFatal((mac->if_module = nr_ue_if_module_init(i)) != NULL, "can not initialize IF module\n"); if (!get_softmodem_params()->sa) { - init_nsa_message(rrc_inst, reconfig_file, rbconfig_file); + init_nsa_message(&rrc_inst[i], reconfig_file, rbconfig_file); // TODO why do we need noS1 configuration? // temporarily moved here to understand why not using the one provided by gNB - nr_rlc_activate_srb0(mac_inst->crnti, NULL, send_srb0_rrc); + nr_rlc_activate_srb0(mac->crnti, NULL, send_srb0_rrc); if (IS_SOFTMODEM_NOS1) { // get default noS1 configuration NR_RadioBearerConfig_t *rbconfig = NULL; @@ -1001,8 +1001,8 @@ void init_NR_UE(int nb_inst, char *uecap_file, char *reconfig_file, char *rbconf // set up PDCP, RLC, MAC nr_pdcp_layer_init(false); - nr_pdcp_add_drbs(ENB_FLAG_NO, inst, rbconfig->drb_ToAddModList, 0, NULL, NULL); - nr_rlc_add_drb(mac_inst->crnti, rbconfig->drb_ToAddModList->list.array[0]->drb_Identity, rlc_rbconfig); + nr_pdcp_add_drbs(ENB_FLAG_NO, i, rbconfig->drb_ToAddModList, 0, NULL, NULL); + nr_rlc_add_drb(mac->crnti, rbconfig->drb_ToAddModList->list.array[0]->drb_Identity, rlc_rbconfig); struct NR_CellGroupConfig__rlc_BearerToAddModList rlc_toadd_list; rlc_toadd_list.list.count = 1; rlc_toadd_list.list.array = calloc(1, sizeof(NR_RLC_BearerConfig_t)); diff --git a/executables/nr-uesoftmodem.c b/executables/nr-uesoftmodem.c index 62f5e4b772..6fe411c253 100644 --- a/executables/nr-uesoftmodem.c +++ b/executables/nr-uesoftmodem.c @@ -454,7 +454,8 @@ configmodule_interface_t *uniqCfg = NULL; // A global var to reduce the changes size ldpc_interface_t ldpc_interface = {0}, ldpc_interface_offload = {0}; -int main( int argc, char **argv ) { +int main(int argc, char **argv) +{ int set_exe_prio = 1; if (checkIfFedoraDistribution()) if (checkIfGenericKernelOnFedora()) @@ -509,7 +510,7 @@ int main( int argc, char **argv ) { memset(PHY_vars_UE_g[0][CC_id], 0, sizeof(*PHY_vars_UE_g[0][CC_id])); } - init_NR_UE(1, uecap_file, reconfig_file, rbconfig_file); + init_NR_UE(NB_UE_INST, uecap_file, reconfig_file, rbconfig_file); int mode_offset = get_softmodem_params()->nsa ? NUMBER_OF_UE_MAX : 1; uint16_t node_number = get_softmodem_params()->node_number; diff --git a/openair1/SIMULATION/NR_PHY/dlsim.c b/openair1/SIMULATION/NR_PHY/dlsim.c index 30e84a8837..4572b5f75c 100644 --- a/openair1/SIMULATION/NR_PHY/dlsim.c +++ b/openair1/SIMULATION/NR_PHY/dlsim.c @@ -849,7 +849,7 @@ int main(int argc, char **argv) nr_gold_pdsch(UE, i, UE->scramblingID_dlsch[i]); } - nr_l2_init_ue(); + nr_l2_init_ue(1); UE_mac = get_mac_inst(0); ue_init_config_request(UE_mac, mu); diff --git a/openair1/SIMULATION/NR_PHY/ulsim.c b/openair1/SIMULATION/NR_PHY/ulsim.c index 684a8385d1..9b227f3b7a 100644 --- a/openair1/SIMULATION/NR_PHY/ulsim.c +++ b/openair1/SIMULATION/NR_PHY/ulsim.c @@ -690,8 +690,7 @@ int main(int argc, char *argv[]) } //Configure UE - nr_l2_init_ue(); - + nr_l2_init_ue(1); NR_UE_MAC_INST_t* UE_mac = get_mac_inst(0); ue_init_config_request(UE_mac, mu); diff --git a/openair2/LAYER2/NR_MAC_UE/mac_defs.h b/openair2/LAYER2/NR_MAC_UE/mac_defs.h index 43125659a9..378411abca 100644 --- a/openair2/LAYER2/NR_MAC_UE/mac_defs.h +++ b/openair2/LAYER2/NR_MAC_UE/mac_defs.h @@ -68,7 +68,6 @@ // NR UE defs // ========== -#define NB_NR_UE_MAC_INST 1 #define MAX_NUM_BWP_UE 5 #define NUM_SLOT_FRAME 10 @@ -452,6 +451,7 @@ typedef struct { /*!\brief Top level UE MAC structure */ typedef struct { + module_id_t ue_id; NR_UE_L2_STATE_t state; int servCellIndex; long physCellId; diff --git a/openair2/LAYER2/NR_MAC_UE/mac_proto.h b/openair2/LAYER2/NR_MAC_UE/mac_proto.h index 9d955580b2..4145b49f49 100644 --- a/openair2/LAYER2/NR_MAC_UE/mac_proto.h +++ b/openair2/LAYER2/NR_MAC_UE/mac_proto.h @@ -197,10 +197,10 @@ void nr_rrc_mac_config_req_sib1(module_id_t module_id, void nr_rrc_mac_config_req_reset(module_id_t module_id, NR_UE_MAC_reset_cause_t cause); -/**\brief initialization NR UE MAC instance(s), total number of MAC instance based on NB_NR_UE_MAC_INST*/ -NR_UE_MAC_INST_t * nr_l2_init_ue(); +/**\brief initialization NR UE MAC instance(s)*/ +NR_UE_MAC_INST_t * nr_l2_init_ue(int nb_inst); -/**\brief fetch MAC instance by module_id, within 0 - (NB_NR_UE_MAC_INST-1) +/**\brief fetch MAC instance by module_id \param module_id index of MAC instance(s)*/ NR_UE_MAC_INST_t *get_mac_inst(module_id_t module_id); diff --git a/openair2/LAYER2/NR_MAC_UE/main_ue_nr.c b/openair2/LAYER2/NR_MAC_UE/main_ue_nr.c index 83b5d7867b..31b395a439 100644 --- a/openair2/LAYER2/NR_MAC_UE/main_ue_nr.c +++ b/openair2/LAYER2/NR_MAC_UE/main_ue_nr.c @@ -112,26 +112,32 @@ void nr_ue_mac_default_configs(NR_UE_MAC_INST_t *mac) } } -NR_UE_MAC_INST_t *nr_l2_init_ue() +NR_UE_MAC_INST_t *nr_l2_init_ue(int nb_inst) { //init mac here - nr_ue_mac_inst = (NR_UE_MAC_INST_t *)calloc(NB_NR_UE_MAC_INST, sizeof(NR_UE_MAC_INST_t)); + nr_ue_mac_inst = (NR_UE_MAC_INST_t *)calloc(nb_inst, sizeof(NR_UE_MAC_INST_t)); + AssertFatal(nr_ue_mac_inst, "Couldn't allocate %d instances of MAC module\n", nb_inst); - for (int j = 0; j < NB_NR_UE_MAC_INST; j++) { + for (int j = 0; j < nb_inst; j++) { nr_ue_init_mac(j); NR_UE_MAC_INST_t *mac = get_mac_inst(j); + mac->ue_id = j; nr_ue_mac_default_configs(mac); if (get_softmodem_params()->sa) ue_init_config_request(mac, get_softmodem_params()->numerology); } + int rc = rlc_module_init(0); - AssertFatal(rc == 0, "%s: Could not initialize RLC layer\n", __FUNCTION__); + AssertFatal(rc == 0, "Could not initialize RLC layer\n"); return (nr_ue_mac_inst); } -NR_UE_MAC_INST_t *get_mac_inst(module_id_t module_id) { - return &nr_ue_mac_inst[(int)module_id]; +NR_UE_MAC_INST_t *get_mac_inst(module_id_t module_id) +{ + NR_UE_MAC_INST_t *mac = &nr_ue_mac_inst[(int)module_id]; + AssertFatal(mac, "Couldn't get MAC inst %d\n", module_id); + return mac; } void reset_mac_inst(NR_UE_MAC_INST_t *nr_mac) diff --git a/openair2/LAYER2/NR_MAC_UE/nr_ue_procedures.c b/openair2/LAYER2/NR_MAC_UE/nr_ue_procedures.c index be2c785b7b..640caf5dad 100644 --- a/openair2/LAYER2/NR_MAC_UE/nr_ue_procedures.c +++ b/openair2/LAYER2/NR_MAC_UE/nr_ue_procedures.c @@ -2409,7 +2409,6 @@ bool trigger_periodic_scheduling_request(NR_UE_MAC_INST_t *mac, PUCCH_sched_t *p int8_t nr_ue_get_SR(module_id_t module_idP, frame_t frameP, slot_t slot) { // no UL-SCH resources available for this tti && UE has a valid PUCCH resources for SR configuration for this tti - DevCheck(module_idP < NB_NR_UE_MAC_INST, module_idP, NB_NR_UE_MAC_INST, 0); NR_UE_MAC_INST_t *mac = get_mac_inst(module_idP); NR_UE_SCHEDULING_INFO *si = &mac->scheduling_info; int max_sr_transmissions = (1 << (2 + si->sr_TransMax)); diff --git a/openair2/LAYER2/nr_rlc/nr_rlc_oai_api.c b/openair2/LAYER2/nr_rlc/nr_rlc_oai_api.c index 7c7ee584a2..f678b2a0ca 100644 --- a/openair2/LAYER2/nr_rlc/nr_rlc_oai_api.c +++ b/openair2/LAYER2/nr_rlc/nr_rlc_oai_api.c @@ -308,9 +308,8 @@ rlc_op_status_t rlc_data_req(const protocol_ctxt_t *const ctxt_pP, nr_rlc_ue_t *ue; nr_rlc_entity_t *rb; - LOG_D(RLC, "%s rnti %d srb_flag %d rb_id %ld mui %d confirm %d sdu_size %d MBMS_flag %d\n", - __FUNCTION__, rnti, srb_flagP, rb_idP, muiP, confirmP, sdu_sizeP, - MBMS_flagP); + LOG_D(RLC, "rnti %d srb_flag %d rb_id %ld mui %d confirm %d sdu_size %d MBMS_flag %d\n", + rnti, srb_flagP, rb_idP, muiP, confirmP, sdu_sizeP, MBMS_flagP); if (ctxt_pP->enb_flag) T(T_ENB_RLC_DL, T_INT(ctxt_pP->module_id), T_INT(ctxt_pP->rntiMaybeUEid), T_INT(rb_idP), T_INT(sdu_sizeP)); diff --git a/openair2/RRC/NR_UE/main_ue.c b/openair2/RRC/NR_UE/main_ue.c index b558744e9e..0e51fe2779 100644 --- a/openair2/RRC/NR_UE/main_ue.c +++ b/openair2/RRC/NR_UE/main_ue.c @@ -35,11 +35,6 @@ #include "common/utils/LOG/log.h" #include "executables/softmodem-common.h" -NR_UE_RRC_INST_t* nr_l3_init_ue(char* uecap) -{ - return openair_rrc_top_init_ue_nr(uecap); -} - void init_nsa_message(NR_UE_RRC_INST_t *rrc, char* reconfig_file, char* rbconfig_file) { if (get_softmodem_params()->phy_test == 1 || get_softmodem_params()->do_ra == 1) { diff --git a/openair2/RRC/NR_UE/rrc_UE.c b/openair2/RRC/NR_UE/rrc_UE.c index 1b33e60fdf..da338ebd4c 100644 --- a/openair2/RRC/NR_UE/rrc_UE.c +++ b/openair2/RRC/NR_UE/rrc_UE.c @@ -299,40 +299,37 @@ void process_nsa_message(NR_UE_RRC_INST_t *rrc, nsa_message_t nsa_message_type, } } -NR_UE_RRC_INST_t* openair_rrc_top_init_ue_nr(char* uecap_file) +NR_UE_RRC_INST_t* nr_rrc_init_ue(char* uecap_file, int nb_inst) { - if(NB_NR_UE_INST > 0) { - NR_UE_rrc_inst = (NR_UE_RRC_INST_t *)calloc(NB_NR_UE_INST , sizeof(NR_UE_RRC_INST_t)); - for(int nr_ue = 0; nr_ue < NB_NR_UE_INST; nr_ue++) { - NR_UE_RRC_INST_t *rrc = &NR_UE_rrc_inst[nr_ue]; - rrc->ue_id = nr_ue; - // fill UE-NR-Capability @ UE-CapabilityRAT-Container here. - rrc->selected_plmn_identity = 1; + NR_UE_rrc_inst = (NR_UE_RRC_INST_t *)calloc(nb_inst, sizeof(NR_UE_RRC_INST_t)); + AssertFatal(NR_UE_rrc_inst, "Couldn't allocate %d instances of RRC module\n", nb_inst); - rrc->dl_bwp_id = 0; - rrc->ul_bwp_id = 0; - rrc->as_security_activated = false; + for(int nr_ue = 0; nr_ue < nb_inst; nr_ue++) { + NR_UE_RRC_INST_t *rrc = &NR_UE_rrc_inst[nr_ue]; + rrc->ue_id = nr_ue; + // fill UE-NR-Capability @ UE-CapabilityRAT-Container here. + rrc->selected_plmn_identity = 1; - for (int i = 0; i < NB_CNX_UE; i++) { - rrcPerNB_t *ptr = &rrc->perNB[i]; - ptr->SInfo = (NR_UE_RRC_SI_INFO){0}; - for (int j = 0; j < NR_NUM_SRB; j++) - ptr->Srb[j] = RB_NOT_PRESENT; - for (int j = 0; j < MAX_DRBS_PER_UE; j++) - ptr->status_DRBs[j] = RB_NOT_PRESENT; - // SRB0 activated by default - ptr->Srb[0] = RB_ESTABLISHED; - } - } + rrc->dl_bwp_id = 0; + rrc->ul_bwp_id = 0; + rrc->as_security_activated = false; - NR_UE_rrc_inst->uecap_file = uecap_file; + rrc->uecap_file = uecap_file; - if (get_softmodem_params()->sl_mode) { - configure_NR_SL_Preconfig(get_softmodem_params()->sync_ref); + for (int i = 0; i < NB_CNX_UE; i++) { + rrcPerNB_t *ptr = &rrc->perNB[i]; + ptr->SInfo = (NR_UE_RRC_SI_INFO){0}; + for (int j = 0; j < NR_NUM_SRB; j++) + ptr->Srb[j] = RB_NOT_PRESENT; + for (int j = 0; j < MAX_DRBS_PER_UE; j++) + ptr->status_DRBs[j] = RB_NOT_PRESENT; + // SRB0 activated by default + ptr->Srb[0] = RB_ESTABLISHED; } } - else{ - NR_UE_rrc_inst = NULL; + + if (get_softmodem_params()->sl_mode) { + configure_NR_SL_Preconfig(get_softmodem_params()->sync_ref); } return NR_UE_rrc_inst; diff --git a/openair2/RRC/NR_UE/rrc_defs.h b/openair2/RRC/NR_UE/rrc_defs.h index dacf5dd70d..9f9cb9a289 100644 --- a/openair2/RRC/NR_UE/rrc_defs.h +++ b/openair2/RRC/NR_UE/rrc_defs.h @@ -59,7 +59,6 @@ #include "as_message.h" #include "common/utils/nr/nr_common.h" -#define NB_NR_UE_INST 1 #define NB_CNX_UE 2//MAX_MANAGED_RG_PER_MOBILE #define MAX_MEAS_OBJ 7 #define MAX_MEAS_CONFIG 7 diff --git a/openair2/RRC/NR_UE/rrc_proto.h b/openair2/RRC/NR_UE/rrc_proto.h index 08db8f6506..ba7c23cdb7 100644 --- a/openair2/RRC/NR_UE/rrc_proto.h +++ b/openair2/RRC/NR_UE/rrc_proto.h @@ -52,18 +52,8 @@ extern queue_t nr_dl_tti_req_queue; extern queue_t nr_tx_req_queue; extern queue_t nr_ul_dci_req_queue; extern queue_t nr_ul_tti_req_queue; -// -// main_rrc.c -// -/**\brief Layer 3 initialization*/ -NR_UE_RRC_INST_t *nr_l3_init_ue(char *); -// -// UE_rrc.c -// - -/**\brief Initial the top level RRC structure instance*/ -NR_UE_RRC_INST_t *openair_rrc_top_init_ue_nr(char *); +NR_UE_RRC_INST_t *nr_rrc_init_ue(char* uecap_file, int nb_inst); void init_nsa_message (NR_UE_RRC_INST_t *rrc, char* reconfig_file, char* rbconfig_file); void process_nsa_message(NR_UE_RRC_INST_t *rrc, nsa_message_t nsa_message_type, void *message, int msg_len); From 8cd2d446984e8c4d2263b5b018085400480882e2 Mon Sep 17 00:00:00 2001 From: francescomani Date: Fri, 5 Jan 2024 18:00:37 +0100 Subject: [PATCH 23/29] using ue-id instead of rnti to address RLC at UE --- executables/nr-ue.c | 4 +-- openair2/LAYER2/NR_MAC_UE/main_ue_nr.c | 2 +- openair2/LAYER2/NR_MAC_UE/nr_ra_procedures.c | 2 +- openair2/LAYER2/NR_MAC_UE/nr_ue_procedures.c | 4 +-- openair2/LAYER2/NR_MAC_UE/nr_ue_scheduler.c | 13 ++++++-- openair2/RRC/NR_UE/rrc_UE.c | 32 +++++++++----------- 6 files changed, 32 insertions(+), 25 deletions(-) diff --git a/executables/nr-ue.c b/executables/nr-ue.c index e889bd27ab..6e668c8901 100644 --- a/executables/nr-ue.c +++ b/executables/nr-ue.c @@ -992,7 +992,7 @@ void init_NR_UE(int nb_inst, char *uecap_file, char *reconfig_file, char *rbconf init_nsa_message(&rrc_inst[i], reconfig_file, rbconfig_file); // TODO why do we need noS1 configuration? // temporarily moved here to understand why not using the one provided by gNB - nr_rlc_activate_srb0(mac->crnti, NULL, send_srb0_rrc); + nr_rlc_activate_srb0(i, NULL, send_srb0_rrc); if (IS_SOFTMODEM_NOS1) { // get default noS1 configuration NR_RadioBearerConfig_t *rbconfig = NULL; @@ -1002,7 +1002,7 @@ void init_NR_UE(int nb_inst, char *uecap_file, char *reconfig_file, char *rbconf // set up PDCP, RLC, MAC nr_pdcp_layer_init(false); nr_pdcp_add_drbs(ENB_FLAG_NO, i, rbconfig->drb_ToAddModList, 0, NULL, NULL); - nr_rlc_add_drb(mac->crnti, rbconfig->drb_ToAddModList->list.array[0]->drb_Identity, rlc_rbconfig); + nr_rlc_add_drb(i, rbconfig->drb_ToAddModList->list.array[0]->drb_Identity, rlc_rbconfig); struct NR_CellGroupConfig__rlc_BearerToAddModList rlc_toadd_list; rlc_toadd_list.list.count = 1; rlc_toadd_list.list.array = calloc(1, sizeof(NR_RLC_BearerConfig_t)); diff --git a/openair2/LAYER2/NR_MAC_UE/main_ue_nr.c b/openair2/LAYER2/NR_MAC_UE/main_ue_nr.c index 31b395a439..d542e09d88 100644 --- a/openair2/LAYER2/NR_MAC_UE/main_ue_nr.c +++ b/openair2/LAYER2/NR_MAC_UE/main_ue_nr.c @@ -56,7 +56,7 @@ void send_srb0_rrc(int rnti, const uint8_t *sdu, sdu_size_t sdu_len, void *data) void send_msg3_rrc_request(module_id_t mod_id, int rnti) { - nr_rlc_activate_srb0(rnti, NULL, send_srb0_rrc); + nr_rlc_activate_srb0(mod_id, NULL, send_srb0_rrc); nr_mac_rrc_msg3_ind(mod_id, rnti); } diff --git a/openair2/LAYER2/NR_MAC_UE/nr_ra_procedures.c b/openair2/LAYER2/NR_MAC_UE/nr_ra_procedures.c index 5a80122d67..7105d2f661 100644 --- a/openair2/LAYER2/NR_MAC_UE/nr_ra_procedures.c +++ b/openair2/LAYER2/NR_MAC_UE/nr_ra_procedures.c @@ -620,7 +620,7 @@ void nr_get_msg3_payload(module_id_t mod_id, uint8_t *buf, int TBS_max) // if RRC has called nr_rlc_srb_recv_sdu(), // we are good even if the name is misleading (we send a ssrb msg, not receive if) tbs_size_t len = mac_rlc_data_req(mod_id, - ra->t_crnti, + mac->ue_id, 0, 0, ENB_FLAG_NO, diff --git a/openair2/LAYER2/NR_MAC_UE/nr_ue_procedures.c b/openair2/LAYER2/NR_MAC_UE/nr_ue_procedures.c index 640caf5dad..1f76ef2825 100644 --- a/openair2/LAYER2/NR_MAC_UE/nr_ue_procedures.c +++ b/openair2/LAYER2/NR_MAC_UE/nr_ue_procedures.c @@ -3606,7 +3606,7 @@ void nr_ue_process_mac_pdu(nr_downlink_indication_t *dl_info, } mac_rlc_data_ind(module_idP, - mac->crnti, + mac->ue_id, module_idP, frameP, ENB_FLAG_NO, @@ -3744,7 +3744,7 @@ void nr_ue_process_mac_pdu(nr_downlink_indication_t *dl_info, LOG_D(NR_MAC, "%4d.%2d : DLSCH -> LCID %d %d bytes\n", frameP, slot, rx_lcid, mac_len); mac_rlc_data_ind(module_idP, - mac->crnti, + mac->ue_id, gNB_index, frameP, ENB_FLAG_NO, diff --git a/openair2/LAYER2/NR_MAC_UE/nr_ue_scheduler.c b/openair2/LAYER2/NR_MAC_UE/nr_ue_scheduler.c index e1b6b25c91..354d6f0b88 100644 --- a/openair2/LAYER2/NR_MAC_UE/nr_ue_scheduler.c +++ b/openair2/LAYER2/NR_MAC_UE/nr_ue_scheduler.c @@ -1177,7 +1177,16 @@ bool nr_update_bsr(module_id_t module_idP, frame_t frameP, slot_t slotP, uint8_t lcgid_buffer_remain[lcgid] += mac->scheduling_info.lc_sched_info[lcid - 1].LCID_buffer_remain; } - mac_rlc_status_resp_t rlc_status = mac_rlc_status_ind(module_idP, mac->crnti,gNB_index,frameP,slotP,ENB_FLAG_NO,MBMS_FLAG_NO, lcid, 0, 0); + mac_rlc_status_resp_t rlc_status = mac_rlc_status_ind(module_idP, + mac->ue_id, + gNB_index, + frameP, + slotP, + ENB_FLAG_NO, + MBMS_FLAG_NO, + lcid, + 0, + 0); lcid_bytes_in_buffer[lcid - 1] = rlc_status.bytes_in_buffer; @@ -2997,7 +3006,7 @@ static bool fill_mac_sdu(module_id_t module_idP, get_num_bytes_to_reqlc(mac, count_same_priority_lcids, lcid, buflen_ep, *buflen_remain, *counter, lcids_bytes_tot, &target); uint16_t sdu_length = mac_rlc_data_req(module_idP, - mac->crnti, + mac->ue_id, gNB_index, frameP, ENB_FLAG_NO, diff --git a/openair2/RRC/NR_UE/rrc_UE.c b/openair2/RRC/NR_UE/rrc_UE.c index da338ebd4c..2a0025697b 100644 --- a/openair2/RRC/NR_UE/rrc_UE.c +++ b/openair2/RRC/NR_UE/rrc_UE.c @@ -136,13 +136,12 @@ static const char nr_nas_attach_req_imsi_dummy_NSA_case[] = { static void nr_rrc_manage_rlc_bearers(const instance_t instance, const NR_CellGroupConfig_t *cellGroupConfig, - rrcPerNB_t *rrc, - const rnti_t rnti); + rrcPerNB_t *rrc); static void nr_rrc_ue_process_RadioBearerConfig(NR_UE_RRC_INST_t *ue_rrc, rrcPerNB_t *rrcNB, NR_RadioBearerConfig_t *const radioBearerConfig); -static void nr_rrc_ue_generate_RRCSetupRequest(NR_UE_RRC_INST_t *rrc, rnti_t rnti); +static void nr_rrc_ue_generate_RRCSetupRequest(NR_UE_RRC_INST_t *rrc); static void nr_rrc_ue_generate_rrcReestablishmentComplete(NR_RRCReestablishment_t *rrcReestablishment); static void process_lte_nsa_msg(NR_UE_RRC_INST_t *rrc, nsa_msg_t *msg, int msg_len); static void nr_rrc_ue_process_rrcReconfiguration(const instance_t instance, @@ -566,12 +565,12 @@ static int nr_decode_SI(NR_UE_RRC_SI_INFO *SI_info, NR_SystemInformation_t *si) return 0; } -void nr_rrc_ue_generate_ra_msg(NR_UE_RRC_INST_t *rrc, RA_trigger_t trigger, rnti_t rnti) +void nr_rrc_ue_generate_ra_msg(NR_UE_RRC_INST_t *rrc, RA_trigger_t trigger) { switch (trigger) { case INITIAL_ACCESS_FROM_RRC_IDLE: // After SIB1 is received, prepare RRCConnectionRequest - nr_rrc_ue_generate_RRCSetupRequest(rrc, rnti); + nr_rrc_ue_generate_RRCSetupRequest(rrc); break; case RRC_CONNECTION_REESTABLISHMENT: AssertFatal(1==0, "ra_trigger not implemented yet!\n"); @@ -600,7 +599,7 @@ void nr_rrc_ue_generate_ra_msg(NR_UE_RRC_INST_t *rrc, RA_trigger_t trigger, rnti } } -static void nr_rrc_ue_generate_RRCSetupRequest(NR_UE_RRC_INST_t *rrc, rnti_t rnti) +static void nr_rrc_ue_generate_RRCSetupRequest(NR_UE_RRC_INST_t *rrc) { LOG_D(NR_RRC, "Generation of RRCSetupRequest\n"); uint8_t rv[6]; @@ -623,7 +622,7 @@ static void nr_rrc_ue_generate_RRCSetupRequest(NR_UE_RRC_INST_t *rrc, rnti_t rnt tac->T300_active = true; /* convention: RNTI for SRB0 is zero, as it changes all the time */ - nr_rlc_srb_recv_sdu(rnti, 0, buf, len); + nr_rlc_srb_recv_sdu(rrc->ue_id, 0, buf, len); } void nr_rrc_configure_default_SI(NR_UE_RRC_SI_INFO *SI_info, @@ -720,14 +719,13 @@ static int8_t nr_rrc_ue_decode_NR_BCCH_DL_SCH_Message(instance_t instance, static void nr_rrc_manage_rlc_bearers(const instance_t instance, const NR_CellGroupConfig_t *cellGroupConfig, - rrcPerNB_t *rrc, - const rnti_t rnti) + rrcPerNB_t *rrc) { if (cellGroupConfig->rlc_BearerToReleaseList != NULL) { for (int i = 0; i < cellGroupConfig->rlc_BearerToReleaseList->list.count; i++) { NR_LogicalChannelIdentity_t *lcid = cellGroupConfig->rlc_BearerToReleaseList->list.array[i]; AssertFatal(lcid, "LogicalChannelIdentity shouldn't be null here\n"); - nr_rlc_release_entity(rnti, *lcid); + nr_rlc_release_entity(instance, *lcid); } } @@ -737,8 +735,8 @@ static void nr_rrc_manage_rlc_bearers(const instance_t instance, NR_LogicalChannelIdentity_t lcid = rlc_bearer->logicalChannelIdentity; if (rrc->active_RLC_entity[lcid]) { if (rlc_bearer->reestablishRLC) - nr_rlc_reestablish_entity(rnti, lcid); - nr_rlc_reconfigure_entity(rnti, lcid, rlc_bearer->rlc_Config); + nr_rlc_reestablish_entity(instance, lcid); + nr_rlc_reconfigure_entity(instance, lcid, rlc_bearer->rlc_Config); } else { rrc->active_RLC_entity[lcid] = true; AssertFatal(rlc_bearer->servedRadioBearer, "servedRadioBearer mandatory in case of setup\n"); @@ -746,10 +744,10 @@ static void nr_rrc_manage_rlc_bearers(const instance_t instance, "Invalid RB for RLC configuration\n"); if (rlc_bearer->servedRadioBearer->present == NR_RLC_BearerConfig__servedRadioBearer_PR_srb_Identity) { NR_SRB_Identity_t srb_id = rlc_bearer->servedRadioBearer->choice.srb_Identity; - nr_rlc_add_srb(rnti, srb_id, rlc_bearer); + nr_rlc_add_srb(instance, srb_id, rlc_bearer); } else { // DRB NR_DRB_Identity_t drb_id = rlc_bearer->servedRadioBearer->choice.drb_Identity; - nr_rlc_add_drb(rnti, drb_id, rlc_bearer); + nr_rlc_add_drb(instance, drb_id, rlc_bearer); } } } @@ -807,7 +805,7 @@ void nr_rrc_cellgroup_configuration(rrcPerNB_t *rrcNB, // TODO verify why we need this limitation if (get_softmodem_params()->sa || get_softmodem_params()->nsa) - nr_rrc_manage_rlc_bearers(instance, cellGroupConfig, rrcNB, rrc->rnti); + nr_rrc_manage_rlc_bearers(instance, cellGroupConfig, rrcNB); AssertFatal(cellGroupConfig->sCellToReleaseList == NULL, "Secondary serving cell release not implemented\n"); @@ -1461,7 +1459,7 @@ void *rrc_nrue(void *notUsed) break; case NR_RRC_MAC_MSG3_IND: - nr_rrc_ue_generate_ra_msg(rrc, INITIAL_ACCESS_FROM_RRC_IDLE, NR_RRC_MAC_MSG3_IND(msg_p).rnti); + nr_rrc_ue_generate_ra_msg(rrc, INITIAL_ACCESS_FROM_RRC_IDLE); break; case NR_RRC_MAC_RA_IND: @@ -1931,7 +1929,7 @@ void nr_rrc_going_to_IDLE(instance_t instance, for (int i = 0; i < NR_MAX_NUM_LCID; i++) { if (nb->active_RLC_entity[i]) { nb->active_RLC_entity[i] = false; - nr_rlc_release_entity(rrc->rnti, i); + nr_rlc_release_entity(instance, i); } } } From ceef53c56a9b47d6fd73d09a948018392edeb749 Mon Sep 17 00:00:00 2001 From: francescomani Date: Tue, 9 Jan 2024 09:31:16 +0100 Subject: [PATCH 24/29] improvements in ITTI for multi-ue instances --- openair2/COMMON/mac_messages_types.h | 1 - openair2/LAYER2/NR_MAC_UE/mac_proto.h | 2 +- openair2/LAYER2/NR_MAC_UE/main_ue_nr.c | 5 ++--- openair2/LAYER2/nr_pdcp/nr_pdcp_oai_api.c | 4 ++-- openair2/RRC/NR_UE/L2_interface_ue.c | 2 +- openair2/RRC/NR_UE/rrc_UE.c | 14 ++++++-------- openair2/RRC/NR_UE/rrc_proto.h | 2 +- openair3/NAS/NR_UE/nr_nas_msg_sim.c | 6 +++--- 8 files changed, 16 insertions(+), 20 deletions(-) diff --git a/openair2/COMMON/mac_messages_types.h b/openair2/COMMON/mac_messages_types.h index 668daad813..ea2e5feed3 100644 --- a/openair2/COMMON/mac_messages_types.h +++ b/openair2/COMMON/mac_messages_types.h @@ -159,7 +159,6 @@ typedef struct RrcMacCcchDataInd_s { } RrcMacCcchDataInd; typedef struct NRRrcMacCcchDataInd_s { - uint16_t rnti; uint32_t sdu_size; uint8_t sdu[CCCH_SDU_SIZE]; } NRRrcMacCcchDataInd; diff --git a/openair2/LAYER2/NR_MAC_UE/mac_proto.h b/openair2/LAYER2/NR_MAC_UE/mac_proto.h index 4145b49f49..ca0fac4908 100644 --- a/openair2/LAYER2/NR_MAC_UE/mac_proto.h +++ b/openair2/LAYER2/NR_MAC_UE/mac_proto.h @@ -149,7 +149,7 @@ \param module_id module id */ void nr_ue_init_mac(module_id_t module_idP); -void send_srb0_rrc(int rnti, const uint8_t *sdu, sdu_size_t sdu_len, void *data); +void send_srb0_rrc(int ue_id, const uint8_t *sdu, sdu_size_t sdu_len, void *data); /**\brief apply default configuration values in nr_mac instance \param mac mac instance */ diff --git a/openair2/LAYER2/NR_MAC_UE/main_ue_nr.c b/openair2/LAYER2/NR_MAC_UE/main_ue_nr.c index d542e09d88..55715e4ecb 100644 --- a/openair2/LAYER2/NR_MAC_UE/main_ue_nr.c +++ b/openair2/LAYER2/NR_MAC_UE/main_ue_nr.c @@ -42,7 +42,7 @@ #include "openair2/LAYER2/RLC/rlc.h" static NR_UE_MAC_INST_t *nr_ue_mac_inst; -void send_srb0_rrc(int rnti, const uint8_t *sdu, sdu_size_t sdu_len, void *data) +void send_srb0_rrc(int ue_id, const uint8_t *sdu, sdu_size_t sdu_len, void *data) { AssertFatal(sdu_len > 0 && sdu_len < CCCH_SDU_SIZE, "invalid CCCH SDU size %d\n", sdu_len); @@ -50,8 +50,7 @@ void send_srb0_rrc(int rnti, const uint8_t *sdu, sdu_size_t sdu_len, void *data) memset(NR_RRC_MAC_CCCH_DATA_IND(message_p).sdu, 0, sdu_len); memcpy(NR_RRC_MAC_CCCH_DATA_IND(message_p).sdu, sdu, sdu_len); NR_RRC_MAC_CCCH_DATA_IND(message_p).sdu_size = sdu_len; - NR_RRC_MAC_CCCH_DATA_IND(message_p).rnti = rnti; - itti_send_msg_to_task(TASK_RRC_NRUE, 0, message_p); + itti_send_msg_to_task(TASK_RRC_NRUE, ue_id, message_p); } void send_msg3_rrc_request(module_id_t mod_id, int rnti) diff --git a/openair2/LAYER2/nr_pdcp/nr_pdcp_oai_api.c b/openair2/LAYER2/nr_pdcp/nr_pdcp_oai_api.c index e36dbb255e..7498ced518 100644 --- a/openair2/LAYER2/nr_pdcp/nr_pdcp_oai_api.c +++ b/openair2/LAYER2/nr_pdcp/nr_pdcp_oai_api.c @@ -750,8 +750,8 @@ srb_found: NR_RRC_DCCH_DATA_IND(message_p).dcch_index = srb_id; NR_RRC_DCCH_DATA_IND(message_p).sdu_p = rrc_buffer_p; NR_RRC_DCCH_DATA_IND(message_p).sdu_size = size; - NR_RRC_DCCH_DATA_IND(message_p).rnti = ue->rntiMaybeUEid; - itti_send_msg_to_task(TASK_RRC_NRUE, 0, message_p); + ue_id_t ue_id = ue->rntiMaybeUEid; + itti_send_msg_to_task(TASK_RRC_NRUE, ue_id, message_p); } } diff --git a/openair2/RRC/NR_UE/L2_interface_ue.c b/openair2/RRC/NR_UE/L2_interface_ue.c index 583210bb53..b5f917fc2d 100644 --- a/openair2/RRC/NR_UE/L2_interface_ue.c +++ b/openair2/RRC/NR_UE/L2_interface_ue.c @@ -101,7 +101,7 @@ int8_t nr_mac_rrc_data_ind_ue(const module_id_t module_id, return(0); } -void nr_mac_rrc_msg3_ind(const module_id_t mod_id, int rnti) +void nr_mac_rrc_msg3_ind(const module_id_t mod_id, const int rnti) { MessageDef *message_p = itti_alloc_new_message(TASK_MAC_UE, 0, NR_RRC_MAC_MSG3_IND); NR_RRC_MAC_MSG3_IND (message_p).rnti = rnti; diff --git a/openair2/RRC/NR_UE/rrc_UE.c b/openair2/RRC/NR_UE/rrc_UE.c index 2a0025697b..50c6f71a28 100644 --- a/openair2/RRC/NR_UE/rrc_UE.c +++ b/openair2/RRC/NR_UE/rrc_UE.c @@ -565,11 +565,12 @@ static int nr_decode_SI(NR_UE_RRC_SI_INFO *SI_info, NR_SystemInformation_t *si) return 0; } -void nr_rrc_ue_generate_ra_msg(NR_UE_RRC_INST_t *rrc, RA_trigger_t trigger) +void nr_rrc_ue_generate_ra_msg(NR_UE_RRC_INST_t *rrc, RA_trigger_t trigger, int rnti) { switch (trigger) { case INITIAL_ACCESS_FROM_RRC_IDLE: // After SIB1 is received, prepare RRCConnectionRequest + rrc->rnti = rnti; nr_rrc_ue_generate_RRCSetupRequest(rrc); break; case RRC_CONNECTION_REESTABLISHMENT: @@ -865,7 +866,6 @@ static void rrc_ue_generate_RRCSetupComplete(instance_t instance, const uint8_t } static void nr_rrc_process_rrcsetup(const instance_t instance, - const rnti_t rnti, const uint8_t gNB_index, const NR_RRCSetup_t *rrcSetup) { @@ -876,7 +876,6 @@ static void nr_rrc_process_rrcsetup(const instance_t instance, // TODO none of the procedures implemented yet // perform the cell group configuration procedure in accordance with the received masterCellGroup - rrc->rnti = rnti; nr_rrc_ue_process_masterCellGroup(instance, rrc->perNB + gNB_index, &rrcSetup->criticalExtensions.choice.rrcSetup->masterCellGroup, @@ -914,7 +913,6 @@ static void nr_rrc_process_rrcsetup(const instance_t instance, } static int8_t nr_rrc_ue_decode_ccch(const instance_t instance, - const rnti_t rnti, const NRRrcMacCcchDataInd *ind, const uint8_t gNB_index) { @@ -950,8 +948,8 @@ static int8_t nr_rrc_ue_decode_ccch(const instance_t instance, break; case NR_DL_CCCH_MessageType__c1_PR_rrcSetup: - LOG_I(NR_RRC, "[UE%ld][RAPROC] Logical Channel DL-CCCH (SRB0), Received NR_RRCSetup RNTI %x\n", instance, rnti); - nr_rrc_process_rrcsetup(instance, rnti, gNB_index, dl_ccch_msg->message.choice.c1->choice.rrcSetup); + LOG_I(NR_RRC, "[UE%ld][RAPROC] Logical Channel DL-CCCH (SRB0), Received NR_RRCSetup\n", instance); + nr_rrc_process_rrcsetup(instance, gNB_index, dl_ccch_msg->message.choice.c1->choice.rrcSetup); rval = 0; break; @@ -1459,7 +1457,7 @@ void *rrc_nrue(void *notUsed) break; case NR_RRC_MAC_MSG3_IND: - nr_rrc_ue_generate_ra_msg(rrc, INITIAL_ACCESS_FROM_RRC_IDLE); + nr_rrc_ue_generate_ra_msg(rrc, INITIAL_ACCESS_FROM_RRC_IDLE, NR_RRC_MAC_MSG3_IND(msg_p).rnti); break; case NR_RRC_MAC_RA_IND: @@ -1483,7 +1481,7 @@ void *rrc_nrue(void *notUsed) case NR_RRC_MAC_CCCH_DATA_IND: { NRRrcMacCcchDataInd *ind = &NR_RRC_MAC_CCCH_DATA_IND(msg_p); - nr_rrc_ue_decode_ccch(instance, ind->rnti, ind, 0); + nr_rrc_ue_decode_ccch(instance, ind, 0); } break; case NR_RRC_DCCH_DATA_IND: diff --git a/openair2/RRC/NR_UE/rrc_proto.h b/openair2/RRC/NR_UE/rrc_proto.h index ba7c23cdb7..c6f5706e4a 100644 --- a/openair2/RRC/NR_UE/rrc_proto.h +++ b/openair2/RRC/NR_UE/rrc_proto.h @@ -88,7 +88,7 @@ void nr_rrc_going_to_IDLE(instance_t instance, NR_RRCRelease_t *RRCRelease); void nr_mac_rrc_ra_ind(const module_id_t mod_id, int frame, bool success); -void nr_mac_rrc_msg3_ind(const module_id_t mod_id, int rnti); +void nr_mac_rrc_msg3_ind(const module_id_t mod_id, const int rnti); /**\brief RRC UE task. \param void *args_p Pointer on arguments to start the task. */ diff --git a/openair3/NAS/NR_UE/nr_nas_msg_sim.c b/openair3/NAS/NR_UE/nr_nas_msg_sim.c index c487887e7b..3ed50b49cc 100644 --- a/openair3/NAS/NR_UE/nr_nas_msg_sim.c +++ b/openair3/NAS/NR_UE/nr_nas_msg_sim.c @@ -549,12 +549,12 @@ static void generateAuthenticationResp(nr_ue_nas_t *nas, as_nas_info_t *initialN initialNasMsg->length = mm_msg_encode(mm_msg, (uint8_t*)(initialNasMsg->data), size); } -int nas_itti_kgnb_refresh_req(const uint8_t kgnb[32]) +int nas_itti_kgnb_refresh_req(instance_t instance, const uint8_t kgnb[32]) { MessageDef *message_p; message_p = itti_alloc_new_message(TASK_NAS_NRUE, 0, NAS_KENB_REFRESH_REQ); memcpy(NAS_KENB_REFRESH_REQ(message_p).kenb, kgnb, sizeof(NAS_KENB_REFRESH_REQ(message_p).kenb)); - return itti_send_msg_to_task(TASK_RRC_NRUE, 0, message_p); + return itti_send_msg_to_task(TASK_RRC_NRUE, instance, message_p); } static void generateSecurityModeComplete(nr_ue_nas_t *nas, as_nas_info_t *initialNasMsg) @@ -1219,7 +1219,7 @@ void *nas_nrue(void *args_p) generateAuthenticationResp(nas, &initialNasMsg, pdu_buffer); break; case FGS_SECURITY_MODE_COMMAND: - nas_itti_kgnb_refresh_req(nas->security.kgnb); + nas_itti_kgnb_refresh_req(instance, nas->security.kgnb); generateSecurityModeComplete(nas, &initialNasMsg); break; case FGS_DOWNLINK_NAS_TRANSPORT: From 0e5c040aa14edc6f542c820b25bc11dcb9a8f33e Mon Sep 17 00:00:00 2001 From: francescomani Date: Wed, 10 Jan 2024 09:31:43 +0100 Subject: [PATCH 25/29] purge unnecessary maybeRNTI from PDCP --- openair2/LAYER2/nr_pdcp/nr_pdcp_oai_api.c | 83 ++++++++++++++------ openair2/LAYER2/nr_pdcp/nr_pdcp_oai_api.h | 8 +- openair2/LAYER2/nr_pdcp/nr_pdcp_ue_manager.c | 16 ++-- openair2/LAYER2/nr_pdcp/nr_pdcp_ue_manager.h | 6 +- openair2/RRC/NR/nr_rrc_proto.h | 7 +- openair2/RRC/NR_UE/rrc_defs.h | 1 - 6 files changed, 80 insertions(+), 41 deletions(-) diff --git a/openair2/LAYER2/nr_pdcp/nr_pdcp_oai_api.c b/openair2/LAYER2/nr_pdcp/nr_pdcp_oai_api.c index 7498ced518..efa08e7358 100644 --- a/openair2/LAYER2/nr_pdcp/nr_pdcp_oai_api.c +++ b/openair2/LAYER2/nr_pdcp/nr_pdcp_oai_api.c @@ -266,7 +266,7 @@ static void do_pdcp_data_ind(const protocol_ctxt_t *const ctxt_pP, { nr_pdcp_ue_t *ue; nr_pdcp_entity_t *rb; - ue_id_t rntiMaybeUEid = ctxt_pP->rntiMaybeUEid; + ue_id_t UEid = ctxt_pP->rntiMaybeUEid; if (ctxt_pP->module_id != 0 || //ctxt_pP->enb_flag != 1 || @@ -278,10 +278,10 @@ static void do_pdcp_data_ind(const protocol_ctxt_t *const ctxt_pP, } if (ctxt_pP->enb_flag) - T(T_ENB_PDCP_UL, T_INT(ctxt_pP->module_id), T_INT(rntiMaybeUEid), T_INT(rb_id), T_INT(sdu_buffer_size)); + T(T_ENB_PDCP_UL, T_INT(ctxt_pP->module_id), T_INT(UEid), T_INT(rb_id), T_INT(sdu_buffer_size)); nr_pdcp_manager_lock(nr_pdcp_ue_manager); - ue = nr_pdcp_manager_get_ue(nr_pdcp_ue_manager, rntiMaybeUEid); + ue = nr_pdcp_manager_get_ue(nr_pdcp_ue_manager, UEid); rb = nr_pdcp_get_rb(ue, rb_id, srb_flagP); if (rb != NULL) { @@ -417,7 +417,7 @@ static void *enb_tun_read_thread(void *_) char rx_buf[NL_MAX_PAYLOAD]; int len; protocol_ctxt_t ctxt; - ue_id_t rntiMaybeUEid; + ue_id_t UEid; int rb_id = 1; pthread_setname_np( pthread_self(),"enb_tun_read"); @@ -432,7 +432,7 @@ static void *enb_tun_read_thread(void *_) LOG_D(PDCP, "%s(): nas_sock_fd read returns len %d\n", __func__, len); nr_pdcp_manager_lock(nr_pdcp_ue_manager); - const bool has_ue = nr_pdcp_get_first_ue_id(nr_pdcp_ue_manager, &rntiMaybeUEid); + const bool has_ue = nr_pdcp_get_first_ue_id(nr_pdcp_ue_manager, &UEid); nr_pdcp_manager_unlock(nr_pdcp_ue_manager); if (!has_ue) continue; @@ -444,13 +444,26 @@ static void *enb_tun_read_thread(void *_) ctxt.subframe = 0; ctxt.eNB_index = 0; ctxt.brOption = 0; - ctxt.rntiMaybeUEid = rntiMaybeUEid; + ctxt.rntiMaybeUEid = UEid; uint8_t qfi = 7; bool rqi = 0; int pdusession_id = 10; - sdap_data_req(&ctxt, rntiMaybeUEid, SRB_FLAG_NO, rb_id, RLC_MUI_UNDEFINED, RLC_SDU_CONFIRM_NO, len, (unsigned char *)rx_buf, PDCP_TRANSMISSION_MODE_DATA, NULL, NULL, qfi, rqi, pdusession_id); + sdap_data_req(&ctxt, + UEid, + SRB_FLAG_NO, + rb_id, + RLC_MUI_UNDEFINED, + RLC_SDU_CONFIRM_NO, + len, + (unsigned char *)rx_buf, + PDCP_TRANSMISSION_MODE_DATA, + NULL, + NULL, + qfi, + rqi, + pdusession_id); } return NULL; @@ -462,7 +475,7 @@ static void *ue_tun_read_thread(void *_) char rx_buf[NL_MAX_PAYLOAD]; int len; protocol_ctxt_t ctxt; - ue_id_t rntiMaybeUEid; + ue_id_t UEid; int has_ue; int rb_id = 1; @@ -477,7 +490,7 @@ static void *ue_tun_read_thread(void *_) LOG_D(PDCP, "%s(): nas_sock_fd read returns len %d\n", __func__, len); nr_pdcp_manager_lock(nr_pdcp_ue_manager); - has_ue = nr_pdcp_get_first_ue_id(nr_pdcp_ue_manager, &rntiMaybeUEid); + has_ue = nr_pdcp_get_first_ue_id(nr_pdcp_ue_manager, &UEid); nr_pdcp_manager_unlock(nr_pdcp_ue_manager); if (!has_ue) continue; @@ -489,13 +502,26 @@ static void *ue_tun_read_thread(void *_) ctxt.subframe = 0; ctxt.eNB_index = 0; ctxt.brOption = 0; - ctxt.rntiMaybeUEid = rntiMaybeUEid; + ctxt.rntiMaybeUEid = UEid; bool dc = SDAP_HDR_UL_DATA_PDU; extern uint8_t nas_qfi; extern uint8_t nas_pduid; - sdap_data_req(&ctxt, rntiMaybeUEid, SRB_FLAG_NO, rb_id, RLC_MUI_UNDEFINED, RLC_SDU_CONFIRM_NO, len, (unsigned char *)rx_buf, PDCP_TRANSMISSION_MODE_DATA, NULL, NULL, nas_qfi, dc, nas_pduid); + sdap_data_req(&ctxt, + UEid, + SRB_FLAG_NO, + rb_id, + RLC_MUI_UNDEFINED, + RLC_SDU_CONFIRM_NO, + len, + (unsigned char *)rx_buf, + PDCP_TRANSMISSION_MODE_DATA, + NULL, + NULL, + nas_qfi, + dc, + nas_pduid); } return NULL; @@ -639,10 +665,10 @@ static void deliver_sdu_drb(void *_ue, nr_pdcp_entity_t *entity, int i; if (IS_SOFTMODEM_NOS1 || UE_NAS_USE_TUN) { - LOG_D(PDCP, "IP packet received with size %d, to be sent to SDAP interface, UE ID/RNTI: %ld\n", size, ue->rntiMaybeUEid); + LOG_D(PDCP, "IP packet received with size %d, to be sent to SDAP interface, UE ID/RNTI: %ld\n", size, ue->ue_id); // in NoS1 mode: the SDAP should write() packets to an FD (TUN interface), // so below, set is_gnb == 0 to do that - sdap_data_ind(entity->rb_id, 0, entity->has_sdap_rx, entity->pdusession_id, ue->rntiMaybeUEid, buf, size); + sdap_data_ind(entity->rb_id, 0, entity->has_sdap_rx, entity->pdusession_id, ue->ue_id, buf, size); } else{ for (i = 0; i < MAX_DRBS_PER_UE; i++) { @@ -652,13 +678,19 @@ static void deliver_sdu_drb(void *_ue, nr_pdcp_entity_t *entity, } } - LOG_E(PDCP, "%s:%d:%s: fatal, no RB found for UE ID/RNTI %ld\n", __FILE__, __LINE__, __FUNCTION__, ue->rntiMaybeUEid); + LOG_E(PDCP, "%s:%d:%s: fatal, no RB found for UE ID/RNTI %ld\n", __FILE__, __LINE__, __FUNCTION__, ue->ue_id); exit(1); rb_found: { LOG_D(PDCP, "%s() (drb %d) sending message to SDAP size %d\n", __func__, rb_id, size); - sdap_data_ind(rb_id, ue->drb[rb_id - 1]->is_gnb, ue->drb[rb_id - 1]->has_sdap_rx, ue->drb[rb_id - 1]->pdusession_id, ue->rntiMaybeUEid, buf, size); + sdap_data_ind(rb_id, + ue->drb[rb_id - 1]->is_gnb, + ue->drb[rb_id - 1]->has_sdap_rx, + ue->drb[rb_id - 1]->pdusession_id, + ue->ue_id, + buf, + size); } } } @@ -722,7 +754,7 @@ static void deliver_sdu_srb(void *_ue, nr_pdcp_entity_t *entity, } } - LOG_E(PDCP, "%s:%d:%s: fatal, no SRB found for UE ID/RNTI %ld\n", __FILE__, __LINE__, __FUNCTION__, ue->rntiMaybeUEid); + LOG_E(PDCP, "%s:%d:%s: fatal, no SRB found for UE ID/RNTI %ld\n", __FILE__, __LINE__, __FUNCTION__, ue->ue_id); exit(1); srb_found: @@ -730,10 +762,10 @@ srb_found: MessageDef *message_p = itti_alloc_new_message(TASK_PDCP_GNB, 0, F1AP_UL_RRC_MESSAGE); AssertFatal(message_p != NULL, "OUT OF MEMORY\n"); f1ap_ul_rrc_message_t *ul_rrc = &F1AP_UL_RRC_MESSAGE(message_p); - ul_rrc->gNB_CU_ue_id = ue->rntiMaybeUEid; + ul_rrc->gNB_CU_ue_id = ue->ue_id; /* look up the correct secondary UE ID to provide complete information to * RRC, the RLC-PDCP interface does not transport this information */ - f1_ue_data_t ue_data = cu_get_f1_ue_data(ue->rntiMaybeUEid); + f1_ue_data_t ue_data = cu_get_f1_ue_data(ue->ue_id); ul_rrc->gNB_DU_ue_id = ue_data.secondary_ue; ul_rrc->srb_id = srb_id; ul_rrc->rrc_container = malloc(size); @@ -750,7 +782,7 @@ srb_found: NR_RRC_DCCH_DATA_IND(message_p).dcch_index = srb_id; NR_RRC_DCCH_DATA_IND(message_p).sdu_p = rrc_buffer_p; NR_RRC_DCCH_DATA_IND(message_p).sdu_size = size; - ue_id_t ue_id = ue->rntiMaybeUEid; + ue_id_t ue_id = ue->ue_id; itti_send_msg_to_task(TASK_RRC_NRUE, ue_id, message_p); } } @@ -900,18 +932,23 @@ void add_drb(int is_gnb, nr_pdcp_manager_unlock(nr_pdcp_ue_manager); } -void nr_pdcp_add_srbs(eNB_flag_t enb_flag, ue_id_t rntiMaybeUEid, NR_SRB_ToAddModList_t *const srb2add_list, const uint8_t security_modeP, uint8_t *const kRRCenc, uint8_t *const kRRCint) +void nr_pdcp_add_srbs(eNB_flag_t enb_flag, + ue_id_t UEid, + NR_SRB_ToAddModList_t *const srb2add_list, + const uint8_t security_modeP, + uint8_t *const kRRCenc, + uint8_t *const kRRCint) { if (srb2add_list != NULL) { for (int i = 0; i < srb2add_list->list.count; i++) { - add_srb(enb_flag, rntiMaybeUEid, srb2add_list->list.array[i], security_modeP & 0x0f, (security_modeP >> 4) & 0x0f, kRRCenc, kRRCint); + add_srb(enb_flag, UEid, srb2add_list->list.array[i], security_modeP & 0x0f, (security_modeP >> 4) & 0x0f, kRRCenc, kRRCint); } } else LOG_W(PDCP, "nr_pdcp_add_srbs() with void list\n"); } void nr_pdcp_add_drbs(eNB_flag_t enb_flag, - ue_id_t rntiMaybeUEid, + ue_id_t UEid, NR_DRB_ToAddModList_t *const drb2add_list, const uint8_t security_modeP, uint8_t *const kUPenc, @@ -920,7 +957,7 @@ void nr_pdcp_add_drbs(eNB_flag_t enb_flag, if (drb2add_list != NULL) { for (int i = 0; i < drb2add_list->list.count; i++) { add_drb(enb_flag, - rntiMaybeUEid, + UEid, drb2add_list->list.array[i], security_modeP & 0x0f, (security_modeP >> 4) & 0x0f, diff --git a/openair2/LAYER2/nr_pdcp/nr_pdcp_oai_api.h b/openair2/LAYER2/nr_pdcp/nr_pdcp_oai_api.h index f95dae6a43..b172abc1c8 100644 --- a/openair2/LAYER2/nr_pdcp/nr_pdcp_oai_api.h +++ b/openair2/LAYER2/nr_pdcp/nr_pdcp_oai_api.h @@ -47,22 +47,20 @@ bool pdcp_data_ind(const protocol_ctxt_t *const ctxt_pP, const uint32_t *const dstID); void nr_pdcp_add_drbs(eNB_flag_t enb_flag, - ue_id_t rntiMaybeUEid, + ue_id_t UEid, NR_DRB_ToAddModList_t *const drb2add_list, const uint8_t security_modeP, uint8_t *const kUPenc, uint8_t *const kUPint); void add_drb(int is_gnb, - ue_id_t rntiMaybeUEid, + ue_id_t UEid, struct NR_DRB_ToAddMod *s, int ciphering_algorithm, int integrity_algorithm, unsigned char *ciphering_key, unsigned char *integrity_key); -void nr_DRB_preconfiguration(ue_id_t crntiMaybeUEid); - void nr_pdcp_remove_UE(ue_id_t ue_id); void nr_pdcp_reestablishment(ue_id_t ue_id, int rb_id, bool srb_flag); @@ -75,7 +73,7 @@ void nr_pdcp_release_drb(ue_id_t ue_id, int drb_id); void add_srb(int is_gnb, - ue_id_t rntiMaybeUEid, + ue_id_t UEid, struct NR_SRB_ToAddMod *s, int ciphering_algorithm, int integrity_algorithm, diff --git a/openair2/LAYER2/nr_pdcp/nr_pdcp_ue_manager.c b/openair2/LAYER2/nr_pdcp/nr_pdcp_ue_manager.c index 782ba1dbf9..7a240a3379 100644 --- a/openair2/LAYER2/nr_pdcp/nr_pdcp_ue_manager.c +++ b/openair2/LAYER2/nr_pdcp/nr_pdcp_ue_manager.c @@ -82,17 +82,17 @@ void nr_pdcp_manager_unlock(nr_pdcp_ue_manager_t *_m) } /* must be called with lock acquired */ -nr_pdcp_ue_t *nr_pdcp_manager_get_ue(nr_pdcp_ue_manager_t *_m, ue_id_t rntiMaybeUEid) +nr_pdcp_ue_t *nr_pdcp_manager_get_ue(nr_pdcp_ue_manager_t *_m, ue_id_t UEid) { /* TODO: optimze */ nr_pdcp_ue_manager_internal_t *m = _m; int i; for (i = 0; i < m->ue_count; i++) - if (m->ue_list[i]->rntiMaybeUEid == rntiMaybeUEid) + if (m->ue_list[i]->ue_id == UEid) return m->ue_list[i]; - LOG_D(PDCP, "%s:%d:%s: new UE ID/RNTI 0x%" PRIx64 "\n", __FILE__, __LINE__, __FUNCTION__, rntiMaybeUEid); + LOG_D(PDCP, "%s:%d:%s: new UE ID/RNTI 0x%" PRIx64 "\n", __FILE__, __LINE__, __FUNCTION__, UEid); m->ue_count++; m->ue_list = realloc(m->ue_list, sizeof(nr_pdcp_ue_t *) * m->ue_count); @@ -106,13 +106,13 @@ nr_pdcp_ue_t *nr_pdcp_manager_get_ue(nr_pdcp_ue_manager_t *_m, ue_id_t rntiMaybe exit(1); } - m->ue_list[m->ue_count - 1]->rntiMaybeUEid = rntiMaybeUEid; + m->ue_list[m->ue_count - 1]->ue_id = UEid; return m->ue_list[m->ue_count-1]; } /* must be called with lock acquired */ -void nr_pdcp_manager_remove_ue(nr_pdcp_ue_manager_t *_m, ue_id_t rntiMaybeUEid) +void nr_pdcp_manager_remove_ue(nr_pdcp_ue_manager_t *_m, ue_id_t UEid) { nr_pdcp_ue_manager_internal_t *m = _m; nr_pdcp_ue_t *ue; @@ -120,11 +120,11 @@ void nr_pdcp_manager_remove_ue(nr_pdcp_ue_manager_t *_m, ue_id_t rntiMaybeUEid) int j; for (i = 0; i < m->ue_count; i++) - if (m->ue_list[i]->rntiMaybeUEid == rntiMaybeUEid) + if (m->ue_list[i]->ue_id == UEid) break; if (i == m->ue_count) { - LOG_D(PDCP, "%s:%d:%s: warning: UE ID/RNTI 0x%" PRIx64 " not found\n", __FILE__, __LINE__, __FUNCTION__, rntiMaybeUEid); + LOG_D(PDCP, "%s:%d:%s: warning: UE ID/RNTI 0x%" PRIx64 " not found\n", __FILE__, __LINE__, __FUNCTION__, UEid); return; } @@ -213,6 +213,6 @@ bool nr_pdcp_get_first_ue_id(nr_pdcp_ue_manager_t *_m, ue_id_t *ret) nr_pdcp_ue_manager_internal_t *m = _m; if (m->ue_count == 0) return false; - *ret = m->ue_list[0]->rntiMaybeUEid; + *ret = m->ue_list[0]->ue_id; return true; } diff --git a/openair2/LAYER2/nr_pdcp/nr_pdcp_ue_manager.h b/openair2/LAYER2/nr_pdcp/nr_pdcp_ue_manager.h index dc6adc5e9f..9899b0cf56 100644 --- a/openair2/LAYER2/nr_pdcp/nr_pdcp_ue_manager.h +++ b/openair2/LAYER2/nr_pdcp/nr_pdcp_ue_manager.h @@ -29,7 +29,7 @@ typedef void nr_pdcp_ue_manager_t; typedef struct nr_pdcp_ue_t { - ue_id_t rntiMaybeUEid; + ue_id_t ue_id; nr_pdcp_entity_t *srb[3]; nr_pdcp_entity_t *drb[MAX_DRBS_PER_UE]; } nr_pdcp_ue_t; @@ -45,8 +45,8 @@ int nr_pdcp_manager_get_enb_flag(nr_pdcp_ue_manager_t *m); void nr_pdcp_manager_lock(nr_pdcp_ue_manager_t *m); void nr_pdcp_manager_unlock(nr_pdcp_ue_manager_t *m); -nr_pdcp_ue_t *nr_pdcp_manager_get_ue(nr_pdcp_ue_manager_t *m, ue_id_t rntiMaybeUEid); -void nr_pdcp_manager_remove_ue(nr_pdcp_ue_manager_t *m, ue_id_t rntiMaybeUEid); +nr_pdcp_ue_t *nr_pdcp_manager_get_ue(nr_pdcp_ue_manager_t *m, ue_id_t UEid); +void nr_pdcp_manager_remove_ue(nr_pdcp_ue_manager_t *m, ue_id_t UEid); nr_pdcp_ue_t **nr_pdcp_manager_get_ue_list(nr_pdcp_ue_manager_t *_m); int nr_pdcp_manager_get_ue_count(nr_pdcp_ue_manager_t *_m); diff --git a/openair2/RRC/NR/nr_rrc_proto.h b/openair2/RRC/NR/nr_rrc_proto.h index 9ca0ce612f..a1342a33f9 100644 --- a/openair2/RRC/NR/nr_rrc_proto.h +++ b/openair2/RRC/NR/nr_rrc_proto.h @@ -143,7 +143,12 @@ void ue_cxt_mod_direct(MessageDef *msg, void prepare_and_send_ue_context_modification_f1(rrc_gNB_ue_context_t *ue_context_p, e1ap_bearer_setup_resp_t *e1ap_resp); -void nr_pdcp_add_srbs(eNB_flag_t enb_flag, ue_id_t rntiMaybeUEid, NR_SRB_ToAddModList_t *const srb2add_list, const uint8_t security_modeP, uint8_t *const kRRCenc, uint8_t *const kUPint); +void nr_pdcp_add_srbs(eNB_flag_t enb_flag, + ue_id_t UEid, + NR_SRB_ToAddModList_t *const srb2add_list, + const uint8_t security_modeP, + uint8_t *const kRRCenc, + uint8_t *const kUPint); void nr_pdcp_add_drbs(eNB_flag_t enb_flag, ue_id_t rntiMaybeUEid, diff --git a/openair2/RRC/NR_UE/rrc_defs.h b/openair2/RRC/NR_UE/rrc_defs.h index 9f9cb9a289..efcb9acfe5 100644 --- a/openair2/RRC/NR_UE/rrc_defs.h +++ b/openair2/RRC/NR_UE/rrc_defs.h @@ -205,7 +205,6 @@ typedef struct rrcPerNB { } rrcPerNB_t; typedef struct NR_UE_RRC_INST_s { - instance_t ue_id; rrcPerNB_t perNB[NB_CNX_UE]; From 2f10ce6dad331b311b12b2f8be756c1f0bca5974 Mon Sep 17 00:00:00 2001 From: francescomani Date: Wed, 10 Jan 2024 10:07:16 +0100 Subject: [PATCH 26/29] passing rrc pointer instead of instance inside rrc functions --- openair2/RRC/NR_UE/L2_interface_ue.c | 10 + openair2/RRC/NR_UE/rrc_UE.c | 224 ++++++++---------- openair2/RRC/NR_UE/rrc_proto.h | 10 +- openair2/RRC/NR_UE/rrc_timers_and_constants.c | 6 +- 4 files changed, 114 insertions(+), 136 deletions(-) diff --git a/openair2/RRC/NR_UE/L2_interface_ue.c b/openair2/RRC/NR_UE/L2_interface_ue.c index b5f917fc2d..8ebf6f757b 100644 --- a/openair2/RRC/NR_UE/L2_interface_ue.c +++ b/openair2/RRC/NR_UE/L2_interface_ue.c @@ -108,6 +108,16 @@ void nr_mac_rrc_msg3_ind(const module_id_t mod_id, const int rnti) itti_send_msg_to_task(TASK_RRC_NRUE, GNB_MODULE_ID_TO_INSTANCE(mod_id), message_p); } +void nr_ue_rrc_timer_trigger(int instance, int frame, int gnb_id) +{ + MessageDef *message_p; + message_p = itti_alloc_new_message(TASK_RRC_NRUE, 0, NRRRC_FRAME_PROCESS); + NRRRC_FRAME_PROCESS(message_p).frame = frame; + NRRRC_FRAME_PROCESS(message_p).gnb_id = gnb_id; + LOG_D(NR_RRC, "RRC timer trigger: frame %d\n", frame); + itti_send_msg_to_task(TASK_RRC_NRUE, instance, message_p); +} + void nr_mac_rrc_ra_ind(const module_id_t mod_id, int frame, bool success) { MessageDef *message_p = itti_alloc_new_message(TASK_MAC_UE, 0, NR_RRC_MAC_RA_IND); diff --git a/openair2/RRC/NR_UE/rrc_UE.c b/openair2/RRC/NR_UE/rrc_UE.c index 50c6f71a28..badf181f39 100644 --- a/openair2/RRC/NR_UE/rrc_UE.c +++ b/openair2/RRC/NR_UE/rrc_UE.c @@ -134,9 +134,9 @@ static const char nr_nas_attach_req_imsi_dummy_NSA_case[] = { 0x11, }; -static void nr_rrc_manage_rlc_bearers(const instance_t instance, +static void nr_rrc_manage_rlc_bearers(const NR_UE_RRC_INST_t *rrc, const NR_CellGroupConfig_t *cellGroupConfig, - rrcPerNB_t *rrc); + rrcPerNB_t *nb); static void nr_rrc_ue_process_RadioBearerConfig(NR_UE_RRC_INST_t *ue_rrc, rrcPerNB_t *rrcNB, @@ -144,24 +144,23 @@ static void nr_rrc_ue_process_RadioBearerConfig(NR_UE_RRC_INST_t *ue_rrc, static void nr_rrc_ue_generate_RRCSetupRequest(NR_UE_RRC_INST_t *rrc); static void nr_rrc_ue_generate_rrcReestablishmentComplete(NR_RRCReestablishment_t *rrcReestablishment); static void process_lte_nsa_msg(NR_UE_RRC_INST_t *rrc, nsa_msg_t *msg, int msg_len); -static void nr_rrc_ue_process_rrcReconfiguration(const instance_t instance, +static void nr_rrc_ue_process_rrcReconfiguration(NR_UE_RRC_INST_t *rrc, int gNB_index, NR_RRCReconfiguration_t *rrcReconfiguration); static void nr_rrc_ue_process_ueCapabilityEnquiry(NR_UE_RRC_INST_t *rrc, NR_UECapabilityEnquiry_t *UECapabilityEnquiry); -static void nr_rrc_ue_process_masterCellGroup(instance_t instance, +static void nr_rrc_ue_process_masterCellGroup(NR_UE_RRC_INST_t *rrc, rrcPerNB_t *rrcNB, OCTET_STRING_t *masterCellGroup, long *fullConfig); void nr_rrc_ue_process_measConfig(rrcPerNB_t *rrc, NR_MeasConfig_t *const measConfig); -static void nr_rrc_ue_process_rrcReconfiguration(const instance_t instance, +static void nr_rrc_ue_process_rrcReconfiguration(NR_UE_RRC_INST_t *rrc, int gNB_index, NR_RRCReconfiguration_t *rrcReconfiguration) { - NR_UE_RRC_INST_t *rrc = &NR_UE_rrc_inst[instance]; - rrcPerNB_t *rrcNB = NR_UE_rrc_inst[instance].perNB + gNB_index; + rrcPerNB_t *rrcNB = rrc->perNB + gNB_index; switch (rrcReconfiguration->criticalExtensions.present) { case NR_RRCReconfiguration__criticalExtensions_PR_rrcReconfiguration: { @@ -177,7 +176,7 @@ static void nr_rrc_ue_process_rrcReconfiguration(const instance_t instance, if (ie->nonCriticalExtension) { NR_RRCReconfiguration_v1530_IEs_t *ext = ie->nonCriticalExtension; if (ext->masterCellGroup) - nr_rrc_ue_process_masterCellGroup(instance, rrcNB, ext->masterCellGroup, ext->fullConfig); + nr_rrc_ue_process_masterCellGroup(rrc, rrcNB, ext->masterCellGroup, ext->fullConfig); /* Check if there is dedicated NAS information to forward to NAS */ if (ie->nonCriticalExtension->dedicatedNAS_MessageList) { struct NR_RRCReconfiguration_v1530_IEs__dedicatedNAS_MessageList *tmp = ext->dedicatedNAS_MessageList; @@ -187,7 +186,7 @@ static void nr_rrc_ue_process_rrcReconfiguration(const instance_t instance, msg->errCode = AS_SUCCESS; msg->nasMsg.length = tmp->list.array[i]->size; msg->nasMsg.data = tmp->list.array[i]->buf; - itti_send_msg_to_task(TASK_NAS_NRUE, instance, ittiMsg); + itti_send_msg_to_task(TASK_NAS_NRUE, rrc->ue_id, ittiMsg); } tmp->list.count = 0; // to prevent the automatic free by ASN1_FREE } @@ -215,9 +214,7 @@ static void nr_rrc_ue_process_rrcReconfiguration(const instance_t instance, if (LOG_DEBUGFLAG(DEBUG_ASN1)) xer_fprint(stdout, &asn_DEF_NR_CellGroupConfig, (const void *) cellGroupConfig); - nr_rrc_cellgroup_configuration(rrcNB, - instance, - cellGroupConfig); + nr_rrc_cellgroup_configuration(rrcNB, rrc, cellGroupConfig); if (!get_softmodem_params()->sa) nr_rrc_mac_config_req_cg(0, 0, cellGroupConfig); @@ -258,7 +255,7 @@ void process_nsa_message(NR_UE_RRC_INST_t *rrc, nsa_message_t nsa_message_type, SEQUENCE_free( &asn_DEF_NR_RRCReconfiguration, RRCReconfiguration, 1 ); return; } - nr_rrc_ue_process_rrcReconfiguration(0, 0, RRCReconfiguration); + nr_rrc_ue_process_rrcReconfiguration(rrc, 0, RRCReconfiguration); ASN_STRUCT_FREE(asn_DEF_NR_RRCReconfiguration, RRCReconfiguration); } break; @@ -421,14 +418,18 @@ int check_si_status(NR_UE_RRC_SI_INFO *SI_info) } /*brief decode BCCH-BCH (MIB) message*/ -static void nr_rrc_ue_decode_NR_BCCH_BCH_Message(const instance_t instance, +static void nr_rrc_ue_decode_NR_BCCH_BCH_Message(NR_UE_RRC_INST_t *rrc, const uint8_t gNB_index, uint8_t *const bufferP, const uint8_t buffer_len) { NR_BCCH_BCH_Message_t *bcch_message = NULL; - asn_dec_rval_t dec_rval = uper_decode_complete(NULL, &asn_DEF_NR_BCCH_BCH_Message, (void **)&bcch_message, (const void *)bufferP, buffer_len); + asn_dec_rval_t dec_rval = uper_decode_complete(NULL, + &asn_DEF_NR_BCCH_BCH_Message, + (void **)&bcch_message, + (const void *)bufferP, + buffer_len); if ((dec_rval.code != RC_OK) || (dec_rval.consumed == 0)) { LOG_E(NR_RRC, "NR_BCCH_BCH decode error\n"); @@ -438,12 +439,12 @@ static void nr_rrc_ue_decode_NR_BCCH_BCH_Message(const instance_t instance, int get_sib = 0; if (get_softmodem_params()->sa && bcch_message->message.choice.mib->cellBarred == NR_MIB__cellBarred_notBarred && - NR_UE_rrc_inst[instance].nrRrcState != RRC_STATE_DETACH_NR) { - NR_UE_RRC_SI_INFO *SI_info = &NR_UE_rrc_inst[instance].perNB[gNB_index].SInfo; + rrc->nrRrcState != RRC_STATE_DETACH_NR) { + NR_UE_RRC_SI_INFO *SI_info = &rrc->perNB[gNB_index].SInfo; // to schedule MAC to get SI if required get_sib = check_si_status(SI_info); } - nr_rrc_mac_config_req_mib(instance, 0, bcch_message->message.choice.mib, get_sib); + nr_rrc_mac_config_req_mib(rrc->ue_id, 0, bcch_message->message.choice.mib, get_sib); ASN_STRUCT_FREE(asn_DEF_NR_BCCH_BCH_Message, bcch_message); return; } @@ -642,14 +643,7 @@ void nr_rrc_configure_default_SI(NR_UE_RRC_SI_INFO *SI_info, } } -/**\brief decode NR BCCH-DLSCH (SI) messages - \param instanceP module id - \param gNB_index gNB index - \param sduP pointer to buffer of ASN message BCCH-DLSCH - \param sdu_len length of buffer - \param rsrq RSRQ - \param rsrp RSRP*/ -static int8_t nr_rrc_ue_decode_NR_BCCH_DL_SCH_Message(instance_t instance, +static int8_t nr_rrc_ue_decode_NR_BCCH_DL_SCH_Message(NR_UE_RRC_INST_t *rrc, const uint8_t gNB_index, uint8_t *const Sdu, const uint8_t Sdu_len, @@ -657,7 +651,7 @@ static int8_t nr_rrc_ue_decode_NR_BCCH_DL_SCH_Message(instance_t instance, const uint8_t rsrp) { NR_BCCH_DL_SCH_Message_t *bcch_message = NULL; - NR_UE_RRC_INST_t *rrc = &NR_UE_rrc_inst[instance]; + NR_UE_RRC_SI_INFO *SI_info = &rrc->perNB[gNB_index].SInfo; VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_UE_DECODE_BCCH, VCD_FUNCTION_IN); @@ -672,7 +666,7 @@ static int8_t nr_rrc_ue_decode_NR_BCCH_DL_SCH_Message(instance_t instance, } if ((dec_rval.code != RC_OK) && (dec_rval.consumed == 0)) { - LOG_E(NR_RRC, "[UE %ld] Failed to decode BCCH_DLSCH_MESSAGE (%zu bits)\n", instance, dec_rval.consumed); + LOG_E(NR_RRC, "[UE %ld] Failed to decode BCCH_DLSCH_MESSAGE (%zu bits)\n", rrc->ue_id, dec_rval.consumed); log_dump(NR_RRC, Sdu, Sdu_len, LOG_DUMP_CHAR," Received bytes:\n"); // free the memory SEQUENCE_free(&asn_DEF_NR_BCCH_DL_SCH_Message, (void *)bcch_message, 1); @@ -683,7 +677,7 @@ static int8_t nr_rrc_ue_decode_NR_BCCH_DL_SCH_Message(instance_t instance, if (bcch_message->message.present == NR_BCCH_DL_SCH_MessageType_PR_c1) { switch (bcch_message->message.choice.c1->present) { case NR_BCCH_DL_SCH_MessageType__c1_PR_systemInformationBlockType1: - LOG_D(NR_RRC, "[UE %ld] Decoding SIB1\n", instance); + LOG_D(NR_RRC, "[UE %ld] Decoding SIB1\n", rrc->ue_id); asn1cFreeStruc(asn_DEF_NR_SIB1, SI_info->sib1); NR_SIB1_t *sib1 = bcch_message->message.choice.c1->choice.systemInformationBlockType1; if(!SI_info->sib1) @@ -701,12 +695,12 @@ static int8_t nr_rrc_ue_decode_NR_BCCH_DL_SCH_Message(instance_t instance, nr_rrc_configure_default_SI(SI_info, sib1); // configure timers and constant nr_rrc_set_sib1_timers_and_constants(&rrc->timers_and_constants, sib1); - nr_rrc_mac_config_req_sib1(instance, 0, sib1->si_SchedulingInfo, sib1->servingCellConfigCommon); + nr_rrc_mac_config_req_sib1(rrc->ue_id, 0, sib1->si_SchedulingInfo, sib1->servingCellConfigCommon); break; case NR_BCCH_DL_SCH_MessageType__c1_PR_systemInformation: - LOG_I(NR_RRC, "[UE %ld] Decoding SI\n", instance); + LOG_I(NR_RRC, "[UE %ld] Decoding SI\n", rrc->ue_id); NR_SystemInformation_t *si = bcch_message->message.choice.c1->choice.systemInformation; - nr_decode_SI(&NR_UE_rrc_inst[instance].perNB[gNB_index].SInfo, si); + nr_decode_SI(SI_info, si); SEQUENCE_free(&asn_DEF_NR_BCCH_DL_SCH_Message, (void *)bcch_message, 1); break; case NR_BCCH_DL_SCH_MessageType__c1_PR_NOTHING: @@ -718,15 +712,15 @@ static int8_t nr_rrc_ue_decode_NR_BCCH_DL_SCH_Message(instance_t instance, return 0; } -static void nr_rrc_manage_rlc_bearers(const instance_t instance, +static void nr_rrc_manage_rlc_bearers(const NR_UE_RRC_INST_t *rrc, const NR_CellGroupConfig_t *cellGroupConfig, - rrcPerNB_t *rrc) + rrcPerNB_t *nb) { if (cellGroupConfig->rlc_BearerToReleaseList != NULL) { for (int i = 0; i < cellGroupConfig->rlc_BearerToReleaseList->list.count; i++) { NR_LogicalChannelIdentity_t *lcid = cellGroupConfig->rlc_BearerToReleaseList->list.array[i]; AssertFatal(lcid, "LogicalChannelIdentity shouldn't be null here\n"); - nr_rlc_release_entity(instance, *lcid); + nr_rlc_release_entity(rrc->ue_id, *lcid); } } @@ -734,35 +728,32 @@ static void nr_rrc_manage_rlc_bearers(const instance_t instance, for (int i = 0; i < cellGroupConfig->rlc_BearerToAddModList->list.count; i++) { NR_RLC_BearerConfig_t *rlc_bearer = cellGroupConfig->rlc_BearerToAddModList->list.array[i]; NR_LogicalChannelIdentity_t lcid = rlc_bearer->logicalChannelIdentity; - if (rrc->active_RLC_entity[lcid]) { + if (nb->active_RLC_entity[lcid]) { if (rlc_bearer->reestablishRLC) - nr_rlc_reestablish_entity(instance, lcid); - nr_rlc_reconfigure_entity(instance, lcid, rlc_bearer->rlc_Config); + nr_rlc_reestablish_entity(rrc->ue_id, lcid); + nr_rlc_reconfigure_entity(rrc->ue_id, lcid, rlc_bearer->rlc_Config); } else { - rrc->active_RLC_entity[lcid] = true; + nb->active_RLC_entity[lcid] = true; AssertFatal(rlc_bearer->servedRadioBearer, "servedRadioBearer mandatory in case of setup\n"); AssertFatal(rlc_bearer->servedRadioBearer->present != NR_RLC_BearerConfig__servedRadioBearer_PR_NOTHING, "Invalid RB for RLC configuration\n"); if (rlc_bearer->servedRadioBearer->present == NR_RLC_BearerConfig__servedRadioBearer_PR_srb_Identity) { NR_SRB_Identity_t srb_id = rlc_bearer->servedRadioBearer->choice.srb_Identity; - nr_rlc_add_srb(instance, srb_id, rlc_bearer); + nr_rlc_add_srb(rrc->ue_id, srb_id, rlc_bearer); } else { // DRB NR_DRB_Identity_t drb_id = rlc_bearer->servedRadioBearer->choice.drb_Identity; - nr_rlc_add_drb(instance, drb_id, rlc_bearer); + nr_rlc_add_drb(rrc->ue_id, drb_id, rlc_bearer); } } } } - nr_rrc_mac_config_req_ue_logicalChannelBearer(instance, + nr_rrc_mac_config_req_ue_logicalChannelBearer(rrc->ue_id, cellGroupConfig->rlc_BearerToAddModList, cellGroupConfig->rlc_BearerToReleaseList); } -void nr_rrc_cellgroup_configuration(rrcPerNB_t *rrcNB, - instance_t instance, - NR_CellGroupConfig_t *cellGroupConfig) +void nr_rrc_cellgroup_configuration(rrcPerNB_t *rrcNB, NR_UE_RRC_INST_t *rrc, NR_CellGroupConfig_t *cellGroupConfig) { - NR_UE_RRC_INST_t *rrc = &NR_UE_rrc_inst[instance]; NR_UE_Timers_Constants_t *tac = &rrc->timers_and_constants; NR_SpCellConfig_t *spCellConfig = cellGroupConfig->spCellConfig; @@ -806,7 +797,7 @@ void nr_rrc_cellgroup_configuration(rrcPerNB_t *rrcNB, // TODO verify why we need this limitation if (get_softmodem_params()->sa || get_softmodem_params()->nsa) - nr_rrc_manage_rlc_bearers(instance, cellGroupConfig, rrcNB); + nr_rrc_manage_rlc_bearers(rrc, cellGroupConfig, rrcNB); AssertFatal(cellGroupConfig->sCellToReleaseList == NULL, "Secondary serving cell release not implemented\n"); @@ -816,7 +807,7 @@ void nr_rrc_cellgroup_configuration(rrcPerNB_t *rrcNB, } -static void nr_rrc_ue_process_masterCellGroup(instance_t instance, +static void nr_rrc_ue_process_masterCellGroup(NR_UE_RRC_INST_t *rrc, rrcPerNB_t *rrcNB, OCTET_STRING_t *masterCellGroup, long *fullConfig) @@ -833,13 +824,13 @@ static void nr_rrc_ue_process_masterCellGroup(instance_t instance, xer_fprint(stdout, &asn_DEF_NR_CellGroupConfig, (const void *) cellGroupConfig); } - nr_rrc_cellgroup_configuration(rrcNB, instance, cellGroupConfig); + nr_rrc_cellgroup_configuration(rrcNB, rrc, cellGroupConfig); LOG_D(RRC,"Sending CellGroupConfig to MAC\n"); - nr_rrc_mac_config_req_cg(instance, 0, cellGroupConfig); + nr_rrc_mac_config_req_cg(rrc->ue_id, 0, cellGroupConfig); } -static void rrc_ue_generate_RRCSetupComplete(instance_t instance, const uint8_t Transaction_id, uint8_t sel_plmn_id) +static void rrc_ue_generate_RRCSetupComplete(const NR_UE_RRC_INST_t *rrc, const uint8_t Transaction_id) { uint8_t buffer[100]; uint8_t size; @@ -848,7 +839,7 @@ static void rrc_ue_generate_RRCSetupComplete(instance_t instance, const uint8_t if (get_softmodem_params()->sa) { as_nas_info_t initialNasMsg; - nr_ue_nas_t *nas = get_ue_nas_info(instance); + nr_ue_nas_t *nas = get_ue_nas_info(rrc->ue_id); generateRegistrationRequest(&initialNasMsg, nas); nas_msg = (char*)initialNasMsg.data; nas_msg_length = initialNasMsg.length; @@ -857,26 +848,24 @@ static void rrc_ue_generate_RRCSetupComplete(instance_t instance, const uint8_t nas_msg_length = sizeof(nr_nas_attach_req_imsi_dummy_NSA_case); } - size = do_RRCSetupComplete(buffer, sizeof(buffer), Transaction_id, sel_plmn_id, nas_msg_length, nas_msg); - LOG_I(NR_RRC, "[UE %ld][RAPROC] Logical Channel UL-DCCH (SRB1), Generating RRCSetupComplete (bytes%d)\n", instance, size); + size = do_RRCSetupComplete(buffer, sizeof(buffer), Transaction_id, rrc->selected_plmn_identity, nas_msg_length, nas_msg); + LOG_I(NR_RRC, "[UE %ld][RAPROC] Logical Channel UL-DCCH (SRB1), Generating RRCSetupComplete (bytes%d)\n", rrc->ue_id, size); int srb_id = 1; // RRC setup complete on SRB1 - LOG_D(NR_RRC, "[RRC_UE %ld] PDCP_DATA_REQ/%d Bytes RRCSetupComplete ---> %d\n", instance, size, srb_id); + LOG_D(NR_RRC, "[RRC_UE %ld] PDCP_DATA_REQ/%d Bytes RRCSetupComplete ---> %d\n", rrc->ue_id, size, srb_id); - nr_pdcp_data_req_srb(instance, srb_id, 0, size, buffer, deliver_pdu_srb_rlc, NULL); + nr_pdcp_data_req_srb(rrc->ue_id, srb_id, 0, size, buffer, deliver_pdu_srb_rlc, NULL); } -static void nr_rrc_process_rrcsetup(const instance_t instance, +static void nr_rrc_process_rrcsetup(NR_UE_RRC_INST_t *rrc, const uint8_t gNB_index, const NR_RRCSetup_t *rrcSetup) { - NR_UE_RRC_INST_t *rrc = &NR_UE_rrc_inst[instance]; - // if the RRCSetup is received in response to an RRCReestablishmentRequest // or RRCResumeRequest or RRCResumeRequest1 // TODO none of the procedures implemented yet // perform the cell group configuration procedure in accordance with the received masterCellGroup - nr_rrc_ue_process_masterCellGroup(instance, + nr_rrc_ue_process_masterCellGroup(rrc, rrc->perNB + gNB_index, &rrcSetup->criticalExtensions.choice.rrcSetup->masterCellGroup, NULL); @@ -907,22 +896,18 @@ static void nr_rrc_process_rrcsetup(const instance_t instance, // set the content of RRCSetupComplete message // TODO procedues described in 5.3.3.4 seems more complex than what we actualy do - rrc_ue_generate_RRCSetupComplete(instance, - rrcSetup->rrc_TransactionIdentifier, - rrc->selected_plmn_identity); + rrc_ue_generate_RRCSetupComplete(rrc, rrcSetup->rrc_TransactionIdentifier); } -static int8_t nr_rrc_ue_decode_ccch(const instance_t instance, +static int8_t nr_rrc_ue_decode_ccch(NR_UE_RRC_INST_t *rrc, const NRRrcMacCcchDataInd *ind, const uint8_t gNB_index) { - NR_UE_RRC_INST_t *rrc = &NR_UE_rrc_inst[instance]; - NR_DL_CCCH_Message_t *dl_ccch_msg = NULL; asn_dec_rval_t dec_rval; int rval=0; VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_UE_DECODE_CCCH, VCD_FUNCTION_IN); - LOG_D(RRC, "[NR UE%ld] Decoding DL-CCCH message (%d bytes), State %d\n", instance, ind->sdu_size, rrc->nrRrcState); + LOG_D(RRC, "[NR UE%ld] Decoding DL-CCCH message (%d bytes), State %d\n", rrc->ue_id, ind->sdu_size, rrc->nrRrcState); dec_rval = uper_decode(NULL, &asn_DEF_NR_DL_CCCH_Message, (void **)&dl_ccch_msg, ind->sdu, ind->sdu_size, 0, 0); @@ -930,7 +915,7 @@ static int8_t nr_rrc_ue_decode_ccch(const instance_t instance, xer_fprint(stdout, &asn_DEF_NR_DL_CCCH_Message, (void *)dl_ccch_msg); if ((dec_rval.code != RC_OK) && (dec_rval.consumed == 0)) { - LOG_E(RRC, "[UE %ld] Failed to decode DL-CCCH-Message (%zu bytes)\n", instance, dec_rval.consumed); + LOG_E(RRC, "[UE %ld] Failed to decode DL-CCCH-Message (%zu bytes)\n", rrc->ue_id, dec_rval.consumed); VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_UE_DECODE_CCCH, VCD_FUNCTION_OUT); return -1; } @@ -938,23 +923,23 @@ static int8_t nr_rrc_ue_decode_ccch(const instance_t instance, if (dl_ccch_msg->message.present == NR_DL_CCCH_MessageType_PR_c1) { switch (dl_ccch_msg->message.choice.c1->present) { case NR_DL_CCCH_MessageType__c1_PR_NOTHING: - LOG_I(NR_RRC, "[UE%ld] Received PR_NOTHING on DL-CCCH-Message\n", instance); + LOG_I(NR_RRC, "[UE%ld] Received PR_NOTHING on DL-CCCH-Message\n", rrc->ue_id); rval = 0; break; case NR_DL_CCCH_MessageType__c1_PR_rrcReject: - LOG_I(NR_RRC, "[UE%ld] Logical Channel DL-CCCH (SRB0), Received RRCReject \n", instance); + LOG_I(NR_RRC, "[UE%ld] Logical Channel DL-CCCH (SRB0), Received RRCReject \n", rrc->ue_id); rval = 0; break; case NR_DL_CCCH_MessageType__c1_PR_rrcSetup: - LOG_I(NR_RRC, "[UE%ld][RAPROC] Logical Channel DL-CCCH (SRB0), Received NR_RRCSetup\n", instance); - nr_rrc_process_rrcsetup(instance, gNB_index, dl_ccch_msg->message.choice.c1->choice.rrcSetup); + LOG_I(NR_RRC, "[UE%ld][RAPROC] Logical Channel DL-CCCH (SRB0), Received NR_RRCSetup\n", rrc->ue_id); + nr_rrc_process_rrcsetup(rrc, gNB_index, dl_ccch_msg->message.choice.c1->choice.rrcSetup); rval = 0; break; default: - LOG_E(NR_RRC, "[UE%ld] Unknown message\n", instance); + LOG_E(NR_RRC, "[UE%ld] Unknown message\n", rrc->ue_id); rval = -1; break; } @@ -1205,9 +1190,8 @@ static void nr_rrc_ue_process_RadioBearerConfig(NR_UE_RRC_INST_t *ue_rrc, if (LOG_DEBUGFLAG(DEBUG_ASN1)) xer_fprint(stdout, &asn_DEF_NR_RadioBearerConfig, (const void *)radioBearerConfig); - instance_t instance = ue_rrc->ue_id; if (radioBearerConfig->srb3_ToRelease) - nr_pdcp_release_srb(instance, 3); + nr_pdcp_release_srb(ue_rrc->ue_id, 3); uint8_t kRRCenc[16] = {0}; uint8_t kRRCint[16] = {0}; @@ -1234,7 +1218,7 @@ static void nr_rrc_ue_process_RadioBearerConfig(NR_UE_RRC_INST_t *ue_rrc, struct NR_SRB_ToAddMod *srb = radioBearerConfig->srb_ToAddModList->list.array[cnt]; if (rrcNB->Srb[srb->srb_Identity] == RB_NOT_PRESENT) add_srb(false, - instance, + ue_rrc->ue_id, radioBearerConfig->srb_ToAddModList->list.array[cnt], ue_rrc->cipheringAlgorithm, ue_rrc->integrityProtAlgorithm, @@ -1244,7 +1228,7 @@ static void nr_rrc_ue_process_RadioBearerConfig(NR_UE_RRC_INST_t *ue_rrc, AssertFatal(srb->discardOnPDCP == NULL, "discardOnPDCP not yet implemented\n"); AssertFatal(srb->reestablishPDCP == NULL, "reestablishPDCP not yet implemented\n"); if (srb->pdcp_Config && srb->pdcp_Config->t_Reordering) - nr_pdcp_reconfigure_srb(instance, srb->srb_Identity, *srb->pdcp_Config->t_Reordering); + nr_pdcp_reconfigure_srb(ue_rrc->ue_id, srb->srb_Identity, *srb->pdcp_Config->t_Reordering); } rrcNB->Srb[srb->srb_Identity] = RB_ESTABLISHED; } @@ -1254,7 +1238,7 @@ static void nr_rrc_ue_process_RadioBearerConfig(NR_UE_RRC_INST_t *ue_rrc, for (int cnt = 0; cnt < radioBearerConfig->drb_ToReleaseList->list.count; cnt++) { NR_DRB_Identity_t *DRB_id = radioBearerConfig->drb_ToReleaseList->list.array[cnt]; if (DRB_id) - nr_pdcp_release_drb(instance, *DRB_id); + nr_pdcp_release_drb(ue_rrc->ue_id, *DRB_id); } } @@ -1268,13 +1252,13 @@ static void nr_rrc_ue_process_RadioBearerConfig(NR_UE_RRC_INST_t *ue_rrc, AssertFatal(drb->recoverPDCP == NULL, "recoverPDCP not yet implemented\n"); NR_SDAP_Config_t *sdap_Config = drb->cnAssociation ? drb->cnAssociation->choice.sdap_Config : NULL; if (drb->pdcp_Config || sdap_Config) - nr_pdcp_reconfigure_drb(instance, DRB_id, drb->pdcp_Config, sdap_Config); + nr_pdcp_reconfigure_drb(ue_rrc->ue_id, DRB_id, drb->pdcp_Config, sdap_Config); if (drb->cnAssociation) AssertFatal(drb->cnAssociation->choice.sdap_Config == NULL, "SDAP reconfiguration not yet implemented\n"); } else { rrcNB->status_DRBs[DRB_id] = RB_ESTABLISHED; add_drb(false, - instance, + ue_rrc->ue_id, radioBearerConfig->drb_ToAddModList->list.array[cnt], ue_rrc->cipheringAlgorithm, ue_rrc->integrityProtAlgorithm, @@ -1288,7 +1272,7 @@ static void nr_rrc_ue_process_RadioBearerConfig(NR_UE_RRC_INST_t *ue_rrc, LOG_I(NR_RRC, "State = NR_RRC_CONNECTED\n"); } -static void nr_rrc_ue_generate_RRCReconfigurationComplete(instance_t instance, const int srb_id, const uint8_t Transaction_id) +static void nr_rrc_ue_generate_RRCReconfigurationComplete(NR_UE_RRC_INST_t *rrc, const int srb_id, const uint8_t Transaction_id) { uint8_t buffer[32], size; size = do_NR_RRCReconfigurationComplete(buffer, sizeof(buffer), Transaction_id); @@ -1299,10 +1283,10 @@ static void nr_rrc_ue_generate_RRCReconfigurationComplete(instance_t instance, c "--->][PDCP][RB %02d]\n", size, srb_id); - nr_pdcp_data_req_srb(instance, srb_id, 0, size, buffer, deliver_pdu_srb_rlc, NULL); + nr_pdcp_data_req_srb(rrc->ue_id, srb_id, 0, size, buffer, deliver_pdu_srb_rlc, NULL); } -static int nr_rrc_ue_decode_dcch(instance_t instance, +static int nr_rrc_ue_decode_dcch(NR_UE_RRC_INST_t *rrc, const srb_id_t Srb_id, const uint8_t *const Buffer, size_t Buffer_size, @@ -1310,7 +1294,6 @@ static int nr_rrc_ue_decode_dcch(instance_t instance, { NR_DL_DCCH_Message_t *dl_dcch_msg = NULL; - NR_UE_RRC_INST_t *rrc = &NR_UE_rrc_inst[instance]; if (Srb_id != 1 && Srb_id != 2) { LOG_E(NR_RRC, "Received message on DL-DCCH (SRB%ld), should not have ...\n", Srb_id); } @@ -1337,19 +1320,18 @@ static int nr_rrc_ue_decode_dcch(instance_t instance, break; case NR_DL_DCCH_MessageType__c1_PR_rrcReconfiguration: { - nr_rrc_ue_process_rrcReconfiguration(instance, gNB_indexP, c1->choice.rrcReconfiguration); - nr_rrc_ue_generate_RRCReconfigurationComplete(instance, Srb_id, c1->choice.rrcReconfiguration->rrc_TransactionIdentifier); + nr_rrc_ue_process_rrcReconfiguration(rrc, gNB_indexP, c1->choice.rrcReconfiguration); + nr_rrc_ue_generate_RRCReconfigurationComplete(rrc, Srb_id, c1->choice.rrcReconfiguration->rrc_TransactionIdentifier); } break; case NR_DL_DCCH_MessageType__c1_PR_rrcResume: LOG_I(NR_RRC, "Received rrcResume on DL-DCCH-Message\n"); break; case NR_DL_DCCH_MessageType__c1_PR_rrcRelease: - LOG_I(NR_RRC, "[UE %ld] Received RRC Release (gNB %d)\n", - instance, gNB_indexP); + LOG_I(NR_RRC, "[UE %ld] Received RRC Release (gNB %d)\n", rrc->ue_id, gNB_indexP); // TODO properly implement procedures in 5.3.8.3 of 38.331 NR_Release_Cause_t cause = OTHER; - nr_rrc_going_to_IDLE(instance, cause, dl_dcch_msg->message.choice.c1->choice.rrcRelease); + nr_rrc_going_to_IDLE(rrc, cause, dl_dcch_msg->message.choice.c1->choice.rrcRelease); break; case NR_DL_DCCH_MessageType__c1_PR_ueCapabilityEnquiry: @@ -1373,10 +1355,10 @@ static int nr_rrc_ue_decode_dcch(instance_t instance, MessageDef *ittiMsg = itti_alloc_new_message(TASK_RRC_NRUE, 0, NAS_DOWNLINK_DATA_IND); NasDlDataInd *msg = &NAS_DOWNLINK_DATA_IND(ittiMsg); - msg->UEid = instance; // TODO set the UEid to something else ? + msg->UEid = rrc->ue_id; msg->nasMsg.length = dedicatedNAS_Message->size; msg->nasMsg.data = dedicatedNAS_Message->buf; - itti_send_msg_to_task(TASK_NAS_NRUE, instance, ittiMsg); + itti_send_msg_to_task(TASK_NAS_NRUE, rrc->ue_id, ittiMsg); dedicatedNAS_Message->buf = NULL; // to keep the buffer, up to NAS to free it } } break; @@ -1429,10 +1411,11 @@ void *rrc_nrue(void *notUsed) MessageDef *msg_p = NULL; itti_receive_msg(TASK_RRC_NRUE, &msg_p); instance_t instance = ITTI_MSG_DESTINATION_INSTANCE(msg_p); - NR_UE_RRC_INST_t *rrc = &NR_UE_rrc_inst[instance]; - LOG_D(NR_RRC, "[UE %ld] Received %s\n", instance, ITTI_MSG_NAME(msg_p)); + NR_UE_RRC_INST_t *rrc = &NR_UE_rrc_inst[instance]; + AssertFatal(instance == rrc->ue_id, "Instance %ld received from ITTI doesn't matach with UE-ID %ld\n", instance, rrc->ue_id); + switch (ITTI_MSG_ID(msg_p)) { case TERMINATE_MESSAGE: LOG_W(NR_RRC, " *** Exiting RRC thread\n"); @@ -1451,8 +1434,8 @@ void *rrc_nrue(void *notUsed) case NRRRC_FRAME_PROCESS: LOG_D(NR_RRC, "Received %s: frame %d\n", ITTI_MSG_NAME(msg_p), NRRRC_FRAME_PROCESS(msg_p).frame); // increase the timers every 10ms (every new frame) - nr_rrc_handle_timers(rrc, instance); - NR_UE_RRC_SI_INFO *SInfo = &NR_UE_rrc_inst[instance].perNB[NRRRC_FRAME_PROCESS(msg_p).gnb_id].SInfo; + nr_rrc_handle_timers(rrc); + NR_UE_RRC_SI_INFO *SInfo = &rrc->perNB[NRRRC_FRAME_PROCESS(msg_p).gnb_id].SInfo; nr_rrc_SI_timers(SInfo); break; @@ -1463,7 +1446,7 @@ void *rrc_nrue(void *notUsed) case NR_RRC_MAC_RA_IND: LOG_D(NR_RRC, "[UE %ld] Received %s: frame %d RA %s\n", - instance, + rrc->ue_id, ITTI_MSG_NAME(msg_p), NR_RRC_MAC_RA_IND(msg_p).frame, NR_RRC_MAC_RA_IND(msg_p).RA_succeeded ? "successful" : "failed"); @@ -1471,21 +1454,21 @@ void *rrc_nrue(void *notUsed) break; case NR_RRC_MAC_BCCH_DATA_IND: - LOG_D(NR_RRC, "[UE %ld] Received %s: gNB %d\n", instance, ITTI_MSG_NAME(msg_p), NR_RRC_MAC_BCCH_DATA_IND(msg_p).gnb_index); + LOG_D(NR_RRC, "[UE %ld] Received %s: gNB %d\n", rrc->ue_id, ITTI_MSG_NAME(msg_p), NR_RRC_MAC_BCCH_DATA_IND(msg_p).gnb_index); NRRrcMacBcchDataInd *bcch = &NR_RRC_MAC_BCCH_DATA_IND(msg_p); if (bcch->is_bch) - nr_rrc_ue_decode_NR_BCCH_BCH_Message(instance, bcch->gnb_index, bcch->sdu, bcch->sdu_size); + nr_rrc_ue_decode_NR_BCCH_BCH_Message(rrc, bcch->gnb_index, bcch->sdu, bcch->sdu_size); else - nr_rrc_ue_decode_NR_BCCH_DL_SCH_Message(instance, bcch->gnb_index, bcch->sdu, bcch->sdu_size, bcch->rsrq, bcch->rsrp); + nr_rrc_ue_decode_NR_BCCH_DL_SCH_Message(rrc, bcch->gnb_index, bcch->sdu, bcch->sdu_size, bcch->rsrq, bcch->rsrp); break; case NR_RRC_MAC_CCCH_DATA_IND: { NRRrcMacCcchDataInd *ind = &NR_RRC_MAC_CCCH_DATA_IND(msg_p); - nr_rrc_ue_decode_ccch(instance, ind, 0); + nr_rrc_ue_decode_ccch(rrc, ind, 0); } break; case NR_RRC_DCCH_DATA_IND: - nr_rrc_ue_decode_dcch(instance, + nr_rrc_ue_decode_dcch(rrc, NR_RRC_DCCH_DATA_IND(msg_p).dcch_index, NR_RRC_DCCH_DATA_IND(msg_p).sdu_p, NR_RRC_DCCH_DATA_IND(msg_p).sdu_size, @@ -1500,7 +1483,7 @@ void *rrc_nrue(void *notUsed) if (!NAS_DETACH_REQ(msg_p).wait_release) { rrc->nrRrcState = RRC_STATE_DETACH_NR; NR_Release_Cause_t release_cause = OTHER; - nr_rrc_going_to_IDLE(instance, release_cause, NULL); + nr_rrc_going_to_IDLE(rrc, release_cause, NULL); } break; @@ -1514,23 +1497,21 @@ void *rrc_nrue(void *notUsed) // check if SRB2 is created, if yes request data_req on SRB2 // error: the remote gNB is hardcoded here rb_id_t srb_id = rrc->perNB[0].Srb[2] == RB_ESTABLISHED ? 2 : 1; - nr_pdcp_data_req_srb(instance, srb_id, 0, length, buffer, deliver_pdu_srb_rlc, NULL); + nr_pdcp_data_req_srb(rrc->ue_id, srb_id, 0, length, buffer, deliver_pdu_srb_rlc, NULL); break; } default: - LOG_E(NR_RRC, "[UE %ld] Received unexpected message %s\n", instance, ITTI_MSG_NAME(msg_p)); + LOG_E(NR_RRC, "[UE %ld] Received unexpected message %s\n", rrc->ue_id, ITTI_MSG_NAME(msg_p)); break; } - LOG_D(NR_RRC, "[UE %ld] RRC Status %d\n", instance, rrc->nrRrcState); + LOG_D(NR_RRC, "[UE %ld] RRC Status %d\n", rrc->ue_id, rrc->nrRrcState); int result = itti_free(ITTI_MSG_ORIGIN_ID(msg_p), msg_p); AssertFatal(result == EXIT_SUCCESS, "Failed to free memory (%d)!\n", result); return NULL; } -void nr_rrc_ue_process_sidelink_radioResourceConfig(instance_t Mod_idP, - uint8_t gNB_index, - NR_SetupRelease_SL_ConfigDedicatedNR_r16_t *sl_ConfigDedicatedNR) +void nr_rrc_ue_process_sidelink_radioResourceConfig(NR_SetupRelease_SL_ConfigDedicatedNR_r16_t *sl_ConfigDedicatedNR) { //process sl_CommConfig, configure MAC/PHY for transmitting SL communication (RRC_CONNECTED) if (sl_ConfigDedicatedNR != NULL) { @@ -1833,11 +1814,10 @@ static void process_lte_nsa_msg(NR_UE_RRC_INST_t *rrc, nsa_msg_t *msg, int msg_l } } -void nr_rrc_going_to_IDLE(instance_t instance, +void nr_rrc_going_to_IDLE(NR_UE_RRC_INST_t *rrc, NR_Release_Cause_t release_cause, NR_RRCRelease_t *RRCRelease) { - NR_UE_RRC_INST_t *rrc = &NR_UE_rrc_inst[instance]; NR_UE_Timers_Constants_t *tac = &rrc->timers_and_constants; // if going to RRC_IDLE was triggered by reception @@ -1915,19 +1895,19 @@ void nr_rrc_going_to_IDLE(instance_t instance, for (int i = 0; i < MAX_DRBS_PER_UE; i++) { if (nb->status_DRBs[i] != RB_NOT_PRESENT) { nb->status_DRBs[i] = RB_NOT_PRESENT; - nr_pdcp_release_drb(instance, i); + nr_pdcp_release_drb(rrc->ue_id, i); } } for (int i = 1; i < NR_NUM_SRB; i++) { if (nb->Srb[i] != RB_NOT_PRESENT) { nb->Srb[i] = RB_NOT_PRESENT; - nr_pdcp_release_srb(instance, i); + nr_pdcp_release_srb(rrc->ue_id, i); } } for (int i = 0; i < NR_MAX_NUM_LCID; i++) { if (nb->active_RLC_entity[i]) { nb->active_RLC_entity[i] = false; - nr_rlc_release_entity(instance, i); + nr_rlc_release_entity(rrc->ue_id, i); } } } @@ -1953,7 +1933,7 @@ void nr_rrc_going_to_IDLE(instance_t instance, // reset MAC NR_UE_MAC_reset_cause_t cause = (rrc->nrRrcState == RRC_STATE_DETACH_NR) ? DETACH : GO_TO_IDLE; - nr_rrc_mac_config_req_reset(instance, cause); + nr_rrc_mac_config_req_reset(rrc->ue_id, cause); // enter RRC_IDLE LOG_I(NR_RRC, "RRC moved into IDLE state\n"); @@ -1965,24 +1945,14 @@ void nr_rrc_going_to_IDLE(instance_t instance, // Indicate the release of the RRC connection to upper layers MessageDef *msg_p = itti_alloc_new_message(TASK_RRC_NRUE, 0, NR_NAS_CONN_RELEASE_IND); NR_NAS_CONN_RELEASE_IND(msg_p).cause = release_cause; - itti_send_msg_to_task(TASK_NAS_NRUE, instance, msg_p); + itti_send_msg_to_task(TASK_NAS_NRUE, rrc->ue_id, msg_p); } -void handle_t300_expiry(instance_t instance) +void handle_t300_expiry(NR_UE_RRC_INST_t *rrc) { // reset MAC, release the MAC configuration NR_UE_MAC_reset_cause_t cause = T300_EXPIRY; - nr_rrc_mac_config_req_reset(instance, cause); + nr_rrc_mac_config_req_reset(rrc->ue_id, cause); // TODO handle connEstFailureControl // TODO inform upper layers about the failure to establish the RRC connection } - -void nr_ue_rrc_timer_trigger(int instance, int frame, int gnb_id) -{ - MessageDef *message_p; - message_p = itti_alloc_new_message(TASK_RRC_NRUE, 0, NRRRC_FRAME_PROCESS); - NRRRC_FRAME_PROCESS(message_p).frame = frame; - NRRRC_FRAME_PROCESS(message_p).gnb_id = gnb_id; - LOG_D(NR_RRC, "RRC timer trigger: frame %d\n", frame); - itti_send_msg_to_task(TASK_RRC_NRUE, instance, message_p); -} diff --git a/openair2/RRC/NR_UE/rrc_proto.h b/openair2/RRC/NR_UE/rrc_proto.h index c6f5706e4a..1001652037 100644 --- a/openair2/RRC/NR_UE/rrc_proto.h +++ b/openair2/RRC/NR_UE/rrc_proto.h @@ -58,9 +58,7 @@ void init_nsa_message (NR_UE_RRC_INST_t *rrc, char* reconfig_file, char* rbconfi void process_nsa_message(NR_UE_RRC_INST_t *rrc, nsa_message_t nsa_message_type, void *message, int msg_len); -void nr_rrc_cellgroup_configuration(rrcPerNB_t *rrcNB, - instance_t instance, - NR_CellGroupConfig_t *cellGroupConfig); +void nr_rrc_cellgroup_configuration(rrcPerNB_t *rrcNB, NR_UE_RRC_INST_t *rrc, NR_CellGroupConfig_t *cellGroupConfig); /**\brief interface between MAC and RRC thru SRB0 (RLC TM/no PDCP) \param module_id module id @@ -83,7 +81,7 @@ void nr_mac_rrc_sync_ind(const module_id_t module_id, const frame_t frame, const bool in_sync); -void nr_rrc_going_to_IDLE(instance_t instance, +void nr_rrc_going_to_IDLE(NR_UE_RRC_INST_t *rrc, NR_Release_Cause_t release_cause, NR_RRCRelease_t *RRCRelease); @@ -95,7 +93,7 @@ void nr_mac_rrc_msg3_ind(const module_id_t mod_id, const int rnti); void *rrc_nrue_task(void *args_p); void *rrc_nrue(void *args_p); -void nr_rrc_handle_timers(NR_UE_RRC_INST_t *rrc, instance_t instance); +void nr_rrc_handle_timers(NR_UE_RRC_INST_t *rrc); /**\brief RRC NSA UE task. \param void *args_p Pointer on arguments to start the task. */ @@ -112,7 +110,7 @@ int get_from_lte_ue_fd(); void nr_rrc_SI_timers(NR_UE_RRC_SI_INFO *SInfo); void nr_ue_rrc_timer_trigger(int module_id, int frame, int gnb_id); -void handle_t300_expiry(instance_t instance); +void handle_t300_expiry(NR_UE_RRC_INST_t *rrc); void reset_rlf_timers_and_constants(NR_UE_Timers_Constants_t *tac); void set_default_timers_and_constants(NR_UE_Timers_Constants_t *tac); diff --git a/openair2/RRC/NR_UE/rrc_timers_and_constants.c b/openair2/RRC/NR_UE/rrc_timers_and_constants.c index 5b4823d03d..c01755e4de 100644 --- a/openair2/RRC/NR_UE/rrc_timers_and_constants.c +++ b/openair2/RRC/NR_UE/rrc_timers_and_constants.c @@ -98,7 +98,7 @@ void nr_rrc_SI_timers(NR_UE_RRC_SI_INFO *SInfo) } } -void nr_rrc_handle_timers(NR_UE_RRC_INST_t *rrc, instance_t instance) +void nr_rrc_handle_timers(NR_UE_RRC_INST_t *rrc) { NR_UE_Timers_Constants_t *timers = &rrc->timers_and_constants; @@ -107,7 +107,7 @@ void nr_rrc_handle_timers(NR_UE_RRC_INST_t *rrc, instance_t instance) if(timers->T300_cnt >= timers->T300_k) { timers->T300_active = false; timers->T300_cnt = 0; - handle_t300_expiry(instance); + handle_t300_expiry(rrc); } } if (timers->T304_active == true) { @@ -134,7 +134,7 @@ void nr_rrc_handle_timers(NR_UE_RRC_INST_t *rrc, instance_t instance) if(timers->T311_cnt >= timers->T311_k) { // Upon T311 expiry, the UE shall perform the actions upon going to RRC_IDLE // with release cause 'RRC connection failure' - nr_rrc_going_to_IDLE(instance, RRC_CONNECTION_FAILURE, NULL); + nr_rrc_going_to_IDLE(rrc, RRC_CONNECTION_FAILURE, NULL); } } } From f1d080d31515d3cc9a31a41fd548753ccba4f09f Mon Sep 17 00:00:00 2001 From: Raphael Defosseux Date: Wed, 10 Jan 2024 16:32:19 +0100 Subject: [PATCH 27/29] chore(ci): updating 5G rfsimulator scenarios to release v2.0 Signed-off-by: Raphael Defosseux --- .../xml_files/container_5g_e1_rfsim.xml | 8 +- .../xml_files/container_5g_f1_rfsim.xml | 6 +- .../xml_files/container_5g_fdd_rfsim.xml | 8 +- ci-scripts/xml_files/container_5g_rfsim.xml | 16 +- .../xml_files/container_5g_rfsim_24prb.xml | 8 +- .../xml_files/container_5g_rfsim_2x2.xml | 8 +- .../xml_files/container_5g_rfsim_u0_25prb.xml | 8 +- .../5g_f1_rfsimulator/amf-healthcheck.sh | 57 ----- .../5g_f1_rfsimulator/docker-compose.yaml | 121 ++-------- .../5g_f1_rfsimulator/mysql-healthcheck.sh | 46 ---- .../5g_f1_rfsimulator/nrf-healthcheck.sh | 20 -- .../yaml_files/5g_f1_rfsimulator/oai_db.sql | 219 ------------------ .../5g_f1_rfsimulator/smf-healthcheck.sh | 21 -- .../5g_f1_rfsimulator/spgwu-healthcheck.sh | 28 --- .../5g_fdd_rfsimulator/amf-healthcheck.sh | 57 ----- .../5g_fdd_rfsimulator/docker-compose.yaml | 111 ++------- .../5g_fdd_rfsimulator/mysql-healthcheck.sh | 46 ---- .../5g_fdd_rfsimulator/nrf-healthcheck.sh | 20 -- .../yaml_files/5g_fdd_rfsimulator/oai_db.sql | 217 ----------------- .../5g_fdd_rfsimulator/smf-healthcheck.sh | 21 -- .../5g_fdd_rfsimulator/spgwu-healthcheck.sh | 28 --- .../yaml_files/5g_rfsimulator/README.md | 108 ++++----- .../5g_rfsimulator/docker-compose.yaml | 105 +-------- .../5g_rfsimulator/mini_nonrf_config.yaml | 189 +++++++++++++++ .../yaml_files/5g_rfsimulator/oai_db.sql | 0 .../5g_rfsimulator_24prb/docker-compose.yaml | 105 +-------- .../5g_rfsimulator_2x2/docker-compose.yaml | 105 +-------- .../yaml_files/5g_rfsimulator_e1/README.md | 5 +- .../5g_rfsimulator_e1/docker-compose.yaml | 137 +++-------- .../mini_nonrf_config_3slices.yaml | 213 +++++++++++++++++ .../docker-compose.yaml | 105 +-------- 31 files changed, 588 insertions(+), 1558 deletions(-) delete mode 100755 ci-scripts/yaml_files/5g_f1_rfsimulator/amf-healthcheck.sh delete mode 100755 ci-scripts/yaml_files/5g_f1_rfsimulator/mysql-healthcheck.sh delete mode 100755 ci-scripts/yaml_files/5g_f1_rfsimulator/nrf-healthcheck.sh delete mode 100755 ci-scripts/yaml_files/5g_f1_rfsimulator/oai_db.sql delete mode 100755 ci-scripts/yaml_files/5g_f1_rfsimulator/smf-healthcheck.sh delete mode 100755 ci-scripts/yaml_files/5g_f1_rfsimulator/spgwu-healthcheck.sh delete mode 100755 ci-scripts/yaml_files/5g_fdd_rfsimulator/amf-healthcheck.sh delete mode 100755 ci-scripts/yaml_files/5g_fdd_rfsimulator/mysql-healthcheck.sh delete mode 100755 ci-scripts/yaml_files/5g_fdd_rfsimulator/nrf-healthcheck.sh delete mode 100755 ci-scripts/yaml_files/5g_fdd_rfsimulator/oai_db.sql delete mode 100755 ci-scripts/yaml_files/5g_fdd_rfsimulator/smf-healthcheck.sh delete mode 100755 ci-scripts/yaml_files/5g_fdd_rfsimulator/spgwu-healthcheck.sh create mode 100644 ci-scripts/yaml_files/5g_rfsimulator/mini_nonrf_config.yaml mode change 100755 => 100644 ci-scripts/yaml_files/5g_rfsimulator/oai_db.sql create mode 100644 ci-scripts/yaml_files/5g_rfsimulator_e1/mini_nonrf_config_3slices.yaml diff --git a/ci-scripts/xml_files/container_5g_e1_rfsim.xml b/ci-scripts/xml_files/container_5g_e1_rfsim.xml index b53a01da13..e23cffd0dd 100644 --- a/ci-scripts/xml_files/container_5g_e1_rfsim.xml +++ b/ci-scripts/xml_files/container_5g_e1_rfsim.xml @@ -46,8 +46,8 @@ DeployGenObject Deploy OAI 5G CoreNetwork yaml_files/5g_rfsimulator_e1 - mysql oai-nrf oai-amf oai-smf oai-spgwu - 5 + mysql oai-amf oai-smf oai-upf + 4 @@ -55,7 +55,7 @@ Deploy OAI 5G RAN RF sim SA (1 CU-CP, 3 CU-UPs, 3 DUs) yaml_files/5g_rfsimulator_e1 oai-cucp oai-cuup oai-cuup2 oai-cuup3 oai-du oai-du2 oai-du3 - 12 + 11 @@ -63,7 +63,7 @@ Deploy OAI 5G NR-UE RF sim SA yaml_files/5g_rfsimulator_e1 oai-nr-ue oai-nr-ue2 oai-nr-ue3 - 15 + 14 diff --git a/ci-scripts/xml_files/container_5g_f1_rfsim.xml b/ci-scripts/xml_files/container_5g_f1_rfsim.xml index c6eb681a58..769de69e35 100644 --- a/ci-scripts/xml_files/container_5g_f1_rfsim.xml +++ b/ci-scripts/xml_files/container_5g_f1_rfsim.xml @@ -47,8 +47,8 @@ DeployGenObject Deploy OAI 5G CoreNetwork yaml_files/5g_f1_rfsimulator - mysql oai-nrf oai-amf oai-smf oai-spgwu oai-ext-dn - 6 + mysql oai-amf oai-smf oai-upf oai-ext-dn + 5 @@ -56,7 +56,7 @@ Deploy OAI 5G CU+DU+UE RF sim SA yaml_files/5g_f1_rfsimulator oai-cu oai-du oai-nr-ue - 9 + 8 diff --git a/ci-scripts/xml_files/container_5g_fdd_rfsim.xml b/ci-scripts/xml_files/container_5g_fdd_rfsim.xml index 34f5ceec6e..cfcf40e69e 100644 --- a/ci-scripts/xml_files/container_5g_fdd_rfsim.xml +++ b/ci-scripts/xml_files/container_5g_fdd_rfsim.xml @@ -59,8 +59,8 @@ DeployGenObject Deploy OAI 5G CoreNetwork yaml_files/5g_fdd_rfsimulator - oai-nrf oai-amf oai-smf oai-spgwu oai-ext-dn - 6 + oai-amf oai-smf oai-upf oai-ext-dn + 5 @@ -68,7 +68,7 @@ Deploy OAI 5G gNB RF sim SA yaml_files/5g_fdd_rfsimulator oai-gnb - 7 + 6 @@ -76,7 +76,7 @@ Deploy OAI 5G NR-UE RF sim SA yaml_files/5g_fdd_rfsimulator oai-nr-ue - 8 + 7 diff --git a/ci-scripts/xml_files/container_5g_rfsim.xml b/ci-scripts/xml_files/container_5g_rfsim.xml index dd18ee7132..89a31b55b4 100644 --- a/ci-scripts/xml_files/container_5g_rfsim.xml +++ b/ci-scripts/xml_files/container_5g_rfsim.xml @@ -65,8 +65,8 @@ DeployGenObject Deploy OAI 5G CoreNetwork yaml_files/5g_rfsimulator - mysql oai-nrf oai-amf oai-smf oai-spgwu oai-ext-dn - 6 + mysql oai-amf oai-smf oai-upf oai-ext-dn + 5 @@ -74,7 +74,7 @@ Deploy OAI 5G gNB RF sim SA yaml_files/5g_rfsimulator oai-gnb - 7 + 6 @@ -82,7 +82,7 @@ Deploy OAI 5G NR-UE RF sim SA yaml_files/5g_rfsimulator oai-nr-ue - 8 + 7 @@ -90,7 +90,7 @@ Deploy Second OAI 5G NR-UE RF sim SA yaml_files/5g_rfsimulator oai-nr-ue2 - 9 + 8 @@ -98,7 +98,7 @@ Deploy OAI 5G NR-UEs (#3, #4, #5) RF sim SA yaml_files/5g_rfsimulator oai-nr-ue3 oai-nr-ue4 oai-nr-ue5 - 12 + 11 @@ -106,7 +106,7 @@ Deploy OAI 5G NR-UEs (#6, #7, #8) RF sim SA yaml_files/5g_rfsimulator oai-nr-ue6 oai-nr-ue7 oai-nr-ue8 - 15 + 14 @@ -114,7 +114,7 @@ Deploy OAI 5G NR-UEs (#9, #10) RF sim SA yaml_files/5g_rfsimulator oai-nr-ue9 oai-nr-ue10 - 17 + 16 diff --git a/ci-scripts/xml_files/container_5g_rfsim_24prb.xml b/ci-scripts/xml_files/container_5g_rfsim_24prb.xml index 538122c751..41f25476c3 100644 --- a/ci-scripts/xml_files/container_5g_rfsim_24prb.xml +++ b/ci-scripts/xml_files/container_5g_rfsim_24prb.xml @@ -59,8 +59,8 @@ DeployGenObject Deploy OAI 5G CoreNetwork yaml_files/5g_rfsimulator_24prb - oai-nrf oai-amf oai-smf oai-spgwu oai-ext-dn - 6 + oai-amf oai-smf oai-upf oai-ext-dn + 5 @@ -68,7 +68,7 @@ Deploy OAI 5G gNB RF sim SA yaml_files/5g_rfsimulator_24prb oai-gnb - 7 + 6 @@ -76,7 +76,7 @@ Deploy OAI 5G NR-UE RF sim SA yaml_files/5g_rfsimulator_24prb oai-nr-ue - 8 + 7 diff --git a/ci-scripts/xml_files/container_5g_rfsim_2x2.xml b/ci-scripts/xml_files/container_5g_rfsim_2x2.xml index f6f84eaa50..defe15a1df 100644 --- a/ci-scripts/xml_files/container_5g_rfsim_2x2.xml +++ b/ci-scripts/xml_files/container_5g_rfsim_2x2.xml @@ -59,8 +59,8 @@ DeployGenObject Deploy OAI 5G CoreNetwork yaml_files/5g_rfsimulator_2x2 - oai-nrf oai-amf oai-smf oai-spgwu oai-ext-dn - 6 + oai-amf oai-smf oai-upf oai-ext-dn + 5 @@ -68,7 +68,7 @@ Deploy OAI 5G gNB RF sim SA yaml_files/5g_rfsimulator_2x2 oai-gnb - 7 + 6 @@ -76,7 +76,7 @@ Deploy OAI 5G NR-UE RF sim SA yaml_files/5g_rfsimulator_2x2 oai-nr-ue - 8 + 7 diff --git a/ci-scripts/xml_files/container_5g_rfsim_u0_25prb.xml b/ci-scripts/xml_files/container_5g_rfsim_u0_25prb.xml index 7d8cd6a723..f059d69614 100644 --- a/ci-scripts/xml_files/container_5g_rfsim_u0_25prb.xml +++ b/ci-scripts/xml_files/container_5g_rfsim_u0_25prb.xml @@ -59,8 +59,8 @@ DeployGenObject Deploy OAI 5G CoreNetwork yaml_files/5g_rfsimulator_u0_25prb - oai-nrf oai-amf oai-smf oai-spgwu oai-ext-dn - 6 + oai-amf oai-smf oai-upf oai-ext-dn + 5 @@ -68,7 +68,7 @@ Deploy OAI 5G gNB RF sim SA yaml_files/5g_rfsimulator_u0_25prb oai-gnb - 7 + 6 @@ -76,7 +76,7 @@ Deploy OAI 5G NR-UE RF sim SA yaml_files/5g_rfsimulator_u0_25prb oai-nr-ue - 8 + 7 diff --git a/ci-scripts/yaml_files/5g_f1_rfsimulator/amf-healthcheck.sh b/ci-scripts/yaml_files/5g_f1_rfsimulator/amf-healthcheck.sh deleted file mode 100755 index 8bfdee2aac..0000000000 --- a/ci-scripts/yaml_files/5g_f1_rfsimulator/amf-healthcheck.sh +++ /dev/null @@ -1,57 +0,0 @@ -#!/bin/bash -set -eo pipefail - -STATUS=0 -AMF_PORT_FOR_NGAP=38412 -AMF_PORT_FOR_N11_HTTP=80 -AMF_IP_NGAP_INTERFACE=$(ifconfig $AMF_INTERFACE_NAME_FOR_NGAP | grep inet | awk {'print $2'}) -AMF_IP_N11_INTERFACE=$(ifconfig $AMF_INTERFACE_NAME_FOR_N11 | grep inet | awk {'print $2'}) -N2_PORT_STATUS=$(netstat -Snpl | grep -o "$AMF_IP_NGAP_INTERFACE:$AMF_PORT_FOR_NGAP") -N11_PORT_STATUS=$(netstat -tnpl | grep -o "$AMF_IP_N11_INTERFACE:$AMF_PORT_FOR_N11_HTTP") -#Check if entrypoint properly configured the conf file and no parameter is unset (optional) -NB_UNREPLACED_AT=`cat /openair-amf/etc/*.conf | grep -v contact@openairinterface.org | grep -c @ || true` - -if [ $NB_UNREPLACED_AT -ne 0 ]; then - STATUS=1 - echo "Healthcheck error: configuration file is not configured properly" -fi - -if [[ -z $N2_PORT_STATUS ]]; then - STATUS=1 - echo "Healthcheck error: N2 SCTP port $AMF_PORT_FOR_NGAP is not listening" -fi - -if [[ -z $N11_PORT_STATUS ]]; then - STATUS=1 - echo "Healthcheck error: N11/SBI TCP/HTTP port $AMF_PORT_FOR_N11_HTTP is not listening" -fi - -#host="${MYSQL_SERVER}" -#user="${MYSQL_USER:-root}" -#export MYSQL_PWD="${MYSQL_PASS}" - -#args=( -# -h"$host" -# -u"$user" -# --silent -#) - -#if ! command -v mysql &> /dev/null; then -# echo "Installing mysql command" -# apt update -# apt-get -y install mysql-client -#else -# if select="$(echo 'SELECT 1' | mysql "${args[@]}")" && [ "$select" = '1' ]; then -# database_check=$(mysql -h$host -u$user -D oai_db --silent -e "SELECT * FROM users;") -# if [[ -z $database_check ]]; then -# echo "Healthcheck error: oai_db not populated" -# STATUS=1 -# fi -# STATUS=0 -# else -# echo "Healthcheck error: Mysql port inactive" -# STATUS=1 -# fi -#fi - -exit $STATUS diff --git a/ci-scripts/yaml_files/5g_f1_rfsimulator/docker-compose.yaml b/ci-scripts/yaml_files/5g_f1_rfsimulator/docker-compose.yaml index 308efdc33b..de96389035 100644 --- a/ci-scripts/yaml_files/5g_f1_rfsimulator/docker-compose.yaml +++ b/ci-scripts/yaml_files/5g_f1_rfsimulator/docker-compose.yaml @@ -1,20 +1,11 @@ version: '3.8' services: - oai-nrf: - container_name: "rfsim5g-oai-nrf" - image: oaisoftwarealliance/oai-nrf:v1.5.0 - environment: - - NRF_INTERFACE_NAME_FOR_SBI=eth0 - - TZ=Europe/Paris - networks: - public_net: - ipv4_address: 192.168.71.130 mysql: container_name: "rfsim5g-mysql" image: mysql:8.0 volumes: - - ./oai_db.sql:/docker-entrypoint-initdb.d/oai_db.sql - - ./mysql-healthcheck.sh:/tmp/mysql-healthcheck.sh + - ../5g_rfsimulator/oai_db.sql:/docker-entrypoint-initdb.d/oai_db.sql + - ../5g_rfsimulator/mysql-healthcheck.sh:/tmp/mysql-healthcheck.sh environment: - TZ=Europe/Paris - MYSQL_DATABASE=oai_db @@ -31,118 +22,36 @@ services: ipv4_address: 192.168.71.131 oai-amf: container_name: "rfsim5g-oai-amf" - image: oaisoftwarealliance/oai-amf:v1.5.0 + image: oaisoftwarealliance/oai-amf:v2.0.0 environment: - TZ=Europe/paris - - MCC=208 - - MNC=99 - - REGION_ID=128 - - AMF_SET_ID=1 - - SERVED_GUAMI_MCC_0=208 - - SERVED_GUAMI_MNC_0=99 - - SERVED_GUAMI_REGION_ID_0=128 - - SERVED_GUAMI_AMF_SET_ID_0=1 - - SERVED_GUAMI_MCC_1=460 - - SERVED_GUAMI_MNC_1=11 - - SERVED_GUAMI_REGION_ID_1=10 - - SERVED_GUAMI_AMF_SET_ID_1=1 - - PLMN_SUPPORT_MCC=208 - - PLMN_SUPPORT_MNC=99 - - PLMN_SUPPORT_TAC=0x0001 - # Three slices are defined - - SST_0=1 - - SST_1=2 - - SST_2=3 - - AMF_INTERFACE_NAME_FOR_NGAP=eth0 - - AMF_INTERFACE_NAME_FOR_N11=eth0 - # One single SMF instance - - SMF_INSTANCE_ID_0=1 - - SMF_FQDN_0=oai-smf - - SMF_IPV4_ADDR_0=192.168.71.133 - - SELECTED_0=true - # mysql definition in AMF is mandatory in mini deployment. - - MYSQL_SERVER=192.168.71.131 - - MYSQL_USER=root - - MYSQL_PASS=linux - - MYSQL_DB=oai_db - # NF registration - - NRF_IPV4_ADDRESS=192.168.71.130 - - NRF_FQDN=oai-nrf - - NF_REGISTRATION=yes - - SMF_SELECTION=yes - - USE_FQDN_DNS=yes - - USE_HTTP2=no + volumes: + - ../5g_rfsimulator_e1/mini_nonrf_config_3slices.yaml:/openair-amf/etc/config.yaml depends_on: - - oai-nrf - mysql networks: public_net: ipv4_address: 192.168.71.132 oai-smf: container_name: "rfsim5g-oai-smf" - image: oaisoftwarealliance/oai-smf:v1.5.0 + image: oaisoftwarealliance/oai-smf:v2.0.0 environment: - TZ=Europe/Paris - - SMF_INTERFACE_NAME_FOR_N4=eth0 - - SMF_INTERFACE_NAME_FOR_SBI=eth0 - - DEFAULT_DNS_IPV4_ADDRESS=172.21.3.100 - - DEFAULT_DNS_SEC_IPV4_ADDRESS=4.4.4.4 - - AMF_IPV4_ADDRESS=192.168.71.132 - - AMF_FQDN=oai-amf - - UPF_IPV4_ADDRESS=192.168.71.134 - - UPF_FQDN_0=oai-spgwu - - NRF_IPV4_ADDRESS=192.168.71.130 - - NRF_FQDN=oai-nrf - - REGISTER_NRF=yes - - DISCOVER_UPF=yes - - USE_FQDN_DNS=yes - - USE_LOCAL_SUBSCRIPTION_INFO=yes - - UE_MTU=1500 - # Only one slice is defined (1, 0xFFFFFF) - - DNN_NI0=oai - - TYPE0=IPv4 - - DNN_RANGE0=12.1.1.2 - 12.1.1.127 - - NSSAI_SST0=1 - - NSSAI_SST1=2 - - NSSAI_SST2=3 - - SESSION_AMBR_UL0=200Mbps - - SESSION_AMBR_DL0=400Mbps - - DEFAULT_CSCF_IPV4_ADDRESS=127.0.0.1 - - ENABLE_USAGE_REPORTING=no + volumes: + - ../5g_rfsimulator_e1/mini_nonrf_config_3slices.yaml:/openair-smf/etc/config.yaml depends_on: - - oai-nrf - oai-amf networks: public_net: ipv4_address: 192.168.71.133 - oai-spgwu: - container_name: "rfsim5g-oai-spgwu" - image: oaisoftwarealliance/oai-spgwu-tiny:v1.5.0 + oai-upf: + container_name: "rfsim5g-oai-upf" + image: oaisoftwarealliance/oai-upf:v2.0.0 environment: - TZ=Europe/Paris - - SGW_INTERFACE_NAME_FOR_S1U_S12_S4_UP=eth0 - - SGW_INTERFACE_NAME_FOR_SX=eth0 - - PGW_INTERFACE_NAME_FOR_SGI=eth0 - - NETWORK_UE_NAT_OPTION=yes - - NETWORK_UE_IP=12.1.1.0/24 - - ENABLE_5G_FEATURES=yes - - REGISTER_NRF=yes - - USE_FQDN_NRF=yes - - UPF_FQDN_5G=oai-spgwu - - NRF_IPV4_ADDRESS=192.168.71.130 - - NRF_FQDN=oai-nrf - # Three slices are defined - - NSSAI_SST_0=1 - - NSSAI_SD_0=0xffffff - - DNN_0=oai - - NSSAI_SST_1=2 - - NSSAI_SD_1=0xffffff - - DNN_1=oai - - NSSAI_SST_2=3 - - NSSAI_SD_2=0xffffff - - DNN_2=oai + volumes: + - ../5g_rfsimulator_e1/mini_nonrf_config_3slices.yaml:/openair-upf/etc/config.yaml depends_on: - - oai-nrf - oai-smf cap_add: - NET_ADMIN @@ -164,7 +73,7 @@ services: "iptables -t nat -A POSTROUTING -o eth0 -j MASQUERADE;"\ "ip route add 12.1.1.0/24 via 192.168.72.134 dev eth0; sleep infinity" depends_on: - - oai-spgwu + - oai-upf networks: traffic_net: ipv4_address: 192.168.72.135 @@ -248,7 +157,7 @@ networks: com.docker.network.bridge.name: "rfsim5g-public" traffic_net: driver: bridge - name: rfsim5g-oai-traffic_net-net + name: rfsim5g-oai-traffic-net ipam: config: - subnet: 192.168.72.128/26 diff --git a/ci-scripts/yaml_files/5g_f1_rfsimulator/mysql-healthcheck.sh b/ci-scripts/yaml_files/5g_f1_rfsimulator/mysql-healthcheck.sh deleted file mode 100755 index c92efb9f00..0000000000 --- a/ci-scripts/yaml_files/5g_f1_rfsimulator/mysql-healthcheck.sh +++ /dev/null @@ -1,46 +0,0 @@ -#!/bin/bash -set -eo pipefail - -if [ "$MYSQL_ROOT_PASSWORD" ] && [ -z "$MYSQL_USER" ] && [ -z "$MYSQL_PASSWORD" ]; then - echo >&2 'Healthcheck error: cannot determine root password (and MYSQL_USER and MYSQL_PASSWORD were not set)' - exit 0 -fi - -host="$(hostname --ip-address || echo '127.0.0.1')" -user="${MYSQL_USER:-root}" -export MYSQL_PWD="${MYSQL_PASSWORD:-$MYSQL_ROOT_PASSWORD}" - -args=( - # force mysql to not use the local "mysqld.sock" (test "external" connectivity) - -h"$host" - -u"$user" - --silent -) - -STATUS=0 -if command -v mysqladmin &> /dev/null; then - if mysqladmin "${args[@]}" ping > /dev/null; then - database_check=$(mysql -u$user -D oai_db --silent -e "SELECT * FROM users;") - if [[ -z $database_check ]]; then - echo "Healthcheck error: oai_db not populated" - STATUS=1 - fi - STATUS=0 - else - echo "Healthcheck error: Mysql port inactive" - STATUS=1 - fi -else - if select="$(echo 'SELECT 1' | mysql "${args[@]}")" && [ "$select" = '1' ]; then - database_check=$(mysql -u$user -D oai_db --silent -e "SELECT * FROM users;") - if [[ -z $database_check ]]; then - echo "Healthcheck error: oai_db not populated" - STATUS=1 - fi - STATUS=0 - else - echo "Healthcheck error: Mysql port inactive" - STATUS=1 - fi -fi -exit $STATUS diff --git a/ci-scripts/yaml_files/5g_f1_rfsimulator/nrf-healthcheck.sh b/ci-scripts/yaml_files/5g_f1_rfsimulator/nrf-healthcheck.sh deleted file mode 100755 index 3479c092e8..0000000000 --- a/ci-scripts/yaml_files/5g_f1_rfsimulator/nrf-healthcheck.sh +++ /dev/null @@ -1,20 +0,0 @@ -#!/bin/bash -set -eo pipefail - -STATUS=0 -NRF_IP_SBI_INTERFACE=$(ifconfig $NRF_INTERFACE_NAME_FOR_SBI | grep inet | awk {'print $2'}) -NRF_SBI_PORT_STATUS=$(netstat -tnpl | grep -o "$NRF_IP_SBI_INTERFACE:$NRF_INTERFACE_PORT_FOR_SBI") -#Check if entrypoint properly configured the conf file and no parameter is unset(optional) -NB_UNREPLACED_AT=`cat /openair-nrf/etc/*.conf | grep -v contact@openairinterface.org | grep -c @ || true` - -if [ $NB_UNREPLACED_AT -ne 0 ]; then - STATUS=1 - echo "Healthcheck error: UNHEALTHY configuration file is not configured properly" -fi - -if [[ -z $NRF_SBI_PORT_STATUS ]]; then - STATUS=1 - echo "Healthcheck error: UNHEALTHY SBI TCP/HTTP port $NRF_INTERFACE_PORT_FOR_SBI is not listening." -fi - -exit $STATUS \ No newline at end of file diff --git a/ci-scripts/yaml_files/5g_f1_rfsimulator/oai_db.sql b/ci-scripts/yaml_files/5g_f1_rfsimulator/oai_db.sql deleted file mode 100755 index 19a6e27079..0000000000 --- a/ci-scripts/yaml_files/5g_f1_rfsimulator/oai_db.sql +++ /dev/null @@ -1,219 +0,0 @@ --- MySQL dump 10.13 Distrib 5.5.46, for debian-linux-gnu (x86_64) --- --- Host: localhost Database: oai_db --- ------------------------------------------------------ --- Server version 5.5.46-0ubuntu0.14.04.2 - -/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */; -/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */; -/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */; -/*!40101 SET NAMES utf8 */; -/*!40103 SET @OLD_TIME_ZONE=@@TIME_ZONE */; -/*!40103 SET TIME_ZONE='+00:00' */; -/*!40014 SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0 */; -/*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 */; -/*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */; -/*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */; - --- --- Table structure for table `apn` --- - -DROP TABLE IF EXISTS `apn`; -/*!40101 SET @saved_cs_client = @@character_set_client */; -/*!40101 SET character_set_client = utf8 */; -CREATE TABLE `apn` ( - `id` int(11) NOT NULL AUTO_INCREMENT, - `apn-name` varchar(60) NOT NULL, - `pdn-type` enum('IPv4','IPv6','IPv4v6','IPv4_or_IPv6') NOT NULL, - PRIMARY KEY (`id`), - UNIQUE KEY `apn-name` (`apn-name`) -) ENGINE=InnoDB DEFAULT CHARSET=latin1; -/*!40101 SET character_set_client = @saved_cs_client */; - --- --- Dumping data for table `apn` --- - -LOCK TABLES `apn` WRITE; -/*!40000 ALTER TABLE `apn` DISABLE KEYS */; -/*!40000 ALTER TABLE `apn` ENABLE KEYS */; -UNLOCK TABLES; - --- --- Table structure for table `mmeidentity` --- - -DROP TABLE IF EXISTS `mmeidentity`; -/*!40101 SET @saved_cs_client = @@character_set_client */; -/*!40101 SET character_set_client = utf8 */; -CREATE TABLE `mmeidentity` ( - `idmmeidentity` int(11) NOT NULL AUTO_INCREMENT, - `mmehost` varchar(255) DEFAULT NULL, - `mmerealm` varchar(200) DEFAULT NULL, - `UE-Reachability` tinyint(1) NOT NULL COMMENT 'Indicates whether the MME supports UE Reachability Notifcation', - PRIMARY KEY (`idmmeidentity`) -) ENGINE=MyISAM AUTO_INCREMENT=46 DEFAULT CHARSET=latin1; -/*!40101 SET character_set_client = @saved_cs_client */; - --- --- Dumping data for table `mmeidentity` --- - -LOCK TABLES `mmeidentity` WRITE; -/*!40000 ALTER TABLE `mmeidentity` DISABLE KEYS */; -INSERT INTO `mmeidentity` VALUES (2,'mme2.openair4G.eur','openair4G.eur',0),(1,'nano.openair4G.eur','openair4G.eur',0),(5,'abeille.openair4G.eur','openair4G.eur',0),(4,'yang.openair4G.eur','openair4G.eur',0),(3,'mme3.openair4G.eur','openair4G.eur',0),(6,'calisson.openair4G.eur','openair4G.eur',0); -/*!40000 ALTER TABLE `mmeidentity` ENABLE KEYS */; -UNLOCK TABLES; - --- --- Table structure for table `pdn` --- - -DROP TABLE IF EXISTS `pdn`; -/*!40101 SET @saved_cs_client = @@character_set_client */; -/*!40101 SET character_set_client = utf8 */; -CREATE TABLE `pdn` ( - `id` int(11) NOT NULL AUTO_INCREMENT, - `apn` varchar(60) NOT NULL, - `pdn_type` enum('IPv4','IPv6','IPv4v6','IPv4_or_IPv6') NOT NULL DEFAULT 'IPv4', - `pdn_ipv4` varchar(15) DEFAULT '0.0.0.0', - `pdn_ipv6` varchar(45) CHARACTER SET latin1 COLLATE latin1_general_ci DEFAULT '0:0:0:0:0:0:0:0', - `aggregate_ambr_ul` int(10) unsigned DEFAULT '50000000', - `aggregate_ambr_dl` int(10) unsigned DEFAULT '100000000', - `pgw_id` int(11) NOT NULL, - `users_imsi` varchar(15) NOT NULL, - `qci` tinyint(3) unsigned NOT NULL DEFAULT '9', - `priority_level` tinyint(3) unsigned NOT NULL DEFAULT '15', - `pre_emp_cap` enum('ENABLED','DISABLED') DEFAULT 'DISABLED', - `pre_emp_vul` enum('ENABLED','DISABLED') DEFAULT 'DISABLED', - `LIPA-Permissions` enum('LIPA-prohibited','LIPA-only','LIPA-conditional') NOT NULL DEFAULT 'LIPA-only', - PRIMARY KEY (`id`,`pgw_id`,`users_imsi`), - KEY `fk_pdn_pgw1_idx` (`pgw_id`), - KEY `fk_pdn_users1_idx` (`users_imsi`) -) ENGINE=MyISAM AUTO_INCREMENT=60 DEFAULT CHARSET=latin1; -/*!40101 SET character_set_client = @saved_cs_client */; - --- --- Dumping data for table `pdn` --- - -LOCK TABLES `pdn` WRITE; -/*!40000 ALTER TABLE `pdn` DISABLE KEYS */; -INSERT INTO `pdn` VALUES (1,'oai.ipv4','IPv4','0.0.0.0','0:0:0:0:0:0:0:0',50000000,100000000,3,'208930000000001',9,15,'DISABLED','ENABLED','LIPA-only'),(41,'oai.ipv4','IPv4','0.0.0.0','0:0:0:0:0:0:0:0',50000000,100000000,3,'20834123456789',9,15,'DISABLED','ENABLED','LIPA-only'),(40,'oai.ipv4','IPv4','0.0.0.0','0:0:0:0:0:0:0:0',50000000,100000000,3,'20810000001234',9,15,'DISABLED','ENABLED','LIPA-only'),(42,'oai.ipv4','IPv4','0.0.0.0','0:0:0:0:0:0:0:0',50000000,100000000,3,'31002890832150',9,15,'DISABLED','ENABLED','LIPA-only'),(16,'oai.ipv4','IPv4','0.0.0.0','0:0:0:0:0:0:0:0',50000000,100000000,3,'208950000000002',9,15,'DISABLED','ENABLED','LIPA-only'),(43,'oai.ipv4','IPv4','0.0.0.0','0:0:0:0:0:0:0:0',50000000,100000000,3,'001010123456789',9,15,'DISABLED','ENABLED','LIPA-only'),(2,'oai.ipv4','IPv4','0.0.0.0','0:0:0:0:0:0:0:0',50000000,100000000,3,'208930000000002',9,15,'DISABLED','ENABLED','LIPA-only'),(3,'oai.ipv4','IPv4','0.0.0.0','0:0:0:0:0:0:0:0',50000000,100000000,3,'208930000000003',9,15,'DISABLED','ENABLED','LIPA-only'),(4,'oai.ipv4','IPv4','0.0.0.0','0:0:0:0:0:0:0:0',50000000,100000000,3,'208930000000004',9,15,'DISABLED','ENABLED','LIPA-only'),(5,'oai.ipv4','IPv4','0.0.0.0','0:0:0:0:0:0:0:0',50000000,100000000,3,'208930000000005',9,15,'DISABLED','ENABLED','LIPA-only'),(6,'oai.ipv4','IPv4','0.0.0.0','0:0:0:0:0:0:0:0',50000000,100000000,3,'208930000000006',9,15,'DISABLED','ENABLED','LIPA-only'),(7,'oai.ipv4','IPv4','0.0.0.0','0:0:0:0:0:0:0:0',50000000,100000000,3,'208930000000007',9,15,'DISABLED','ENABLED','LIPA-only'),(8,'oai.ipv4','IPv4','0.0.0.0','0:0:0:0:0:0:0:0',50000000,100000000,3,'208940000000001',9,15,'DISABLED','ENABLED','LIPA-only'),(9,'oai.ipv4','IPv4','0.0.0.0','0:0:0:0:0:0:0:0',50000000,100000000,3,'208940000000002',9,15,'DISABLED','ENABLED','LIPA-only'),(10,'oai.ipv4','IPv4','0.0.0.0','0:0:0:0:0:0:0:0',50000000,100000000,3,'208940000000003',9,15,'DISABLED','ENABLED','LIPA-only'),(11,'oai.ipv4','IPv4','0.0.0.0','0:0:0:0:0:0:0:0',50000000,100000000,3,'208940000000004',9,15,'DISABLED','ENABLED','LIPA-only'),(12,'oai.ipv4','IPv4','0.0.0.0','0:0:0:0:0:0:0:0',50000000,100000000,3,'208940000000005',9,15,'DISABLED','ENABLED','LIPA-only'),(13,'oai.ipv4','IPv4','0.0.0.0','0:0:0:0:0:0:0:0',50000000,100000000,3,'208940000000006',9,15,'DISABLED','ENABLED','LIPA-only'),(14,'oai.ipv4','IPv4','0.0.0.0','0:0:0:0:0:0:0:0',50000000,100000000,3,'208940000000007',9,15,'DISABLED','ENABLED','LIPA-only'),(15,'oai.ipv4','IPv4','0.0.0.0','0:0:0:0:0:0:0:0',50000000,100000000,3,'208950000000001',9,15,'DISABLED','ENABLED','LIPA-only'),(17,'oai.ipv4','IPv4','0.0.0.0','0:0:0:0:0:0:0:0',50000000,100000000,3,'208950000000003',9,15,'DISABLED','ENABLED','LIPA-only'),(18,'oai.ipv4','IPv4','0.0.0.0','0:0:0:0:0:0:0:0',50000000,100000000,3,'208950000000004',9,15,'DISABLED','ENABLED','LIPA-only'),(19,'oai.ipv4','IPv4','0.0.0.0','0:0:0:0:0:0:0:0',50000000,100000000,3,'208950000000005',9,15,'DISABLED','ENABLED','LIPA-only'),(20,'oai.ipv4','IPv4','0.0.0.0','0:0:0:0:0:0:0:0',50000000,100000000,3,'208950000000006',9,15,'DISABLED','ENABLED','LIPA-only'),(21,'oai.ipv4','IPv4','0.0.0.0','0:0:0:0:0:0:0:0',50000000,100000000,3,'208950000000007',9,15,'DISABLED','ENABLED','LIPA-only'),(22,'oai.ipv4','IPv4','0.0.0.0','0:0:0:0:0:0:0:0',50000000,100000000,3,'208920100001100',9,15,'DISABLED','ENABLED','LIPA-only'),(23,'oai.ipv4','IPv4','0.0.0.0','0:0:0:0:0:0:0:0',50000000,100000000,3,'208920100001101',9,15,'DISABLED','ENABLED','LIPA-only'),(24,'oai.ipv4','IPv4','0.0.0.0','0:0:0:0:0:0:0:0',50000000,100000000,3,'208920100001102',9,15,'DISABLED','ENABLED','LIPA-only'),(25,'oai.ipv4','IPv4','0.0.0.0','0:0:0:0:0:0:0:0',50000000,100000000,3,'208920100001103',9,15,'DISABLED','ENABLED','LIPA-only'),(26,'oai.ipv4','IPv4','0.0.0.0','0:0:0:0:0:0:0:0',50000000,100000000,3,'208920100001104',9,15,'DISABLED','ENABLED','LIPA-only'),(27,'oai.ipv4','IPv4','0.0.0.0','0:0:0:0:0:0:0:0',50000000,100000000,3,'208920100001105',9,15,'DISABLED','ENABLED','LIPA-only'),(28,'oai.ipv4','IPv4','0.0.0.0','0:0:0:0:0:0:0:0',50000000,100000000,3,'208920100001106',9,15,'DISABLED','ENABLED','LIPA-only'),(29,'oai.ipv4','IPv4','0.0.0.0','0:0:0:0:0:0:0:0',50000000,100000000,3,'208920100001107',9,15,'DISABLED','ENABLED','LIPA-only'),(30,'oai.ipv4','IPv4','0.0.0.0','0:0:0:0:0:0:0:0',50000000,100000000,3,'208920100001108',9,15,'DISABLED','ENABLED','LIPA-only'),(31,'oai.ipv4','IPv4','0.0.0.0','0:0:0:0:0:0:0:0',50000000,100000000,3,'208920100001109',9,15,'DISABLED','ENABLED','LIPA-only'),(32,'oai.ipv4','IPv4','0.0.0.0','0:0:0:0:0:0:0:0',50000000,100000000,3,'208920100001110',9,15,'DISABLED','ENABLED','LIPA-only'),(33,'oai.ipv4','IPv4','0.0.0.0','0:0:0:0:0:0:0:0',50000000,100000000,3,'208930100001111',9,15,'DISABLED','ENABLED','LIPA-only'),(34,'oai.ipv4','IPv4','0.0.0.0','0:0:0:0:0:0:0:0',50000000,100000000,3,'208930100001112',9,15,'DISABLED','ENABLED','LIPA-only'),(35,'oai.ipv4','IPv4','0.0.0.0','0:0:0:0:0:0:0:0',50000000,100000000,3,'208930100001113',9,15,'DISABLED','ENABLED','LIPA-only'),(44,'operator','IPv4','0.0.0.0','0:0:0:0:0:0:0:0',50000000,100000000,3,'208930100001113',9,15,'DISABLED','ENABLED','LIPA-only'),(45,'operator','IPv4','0.0.0.0','0:0:0:0:0:0:0:0',50000000,100000000,3,'208930100001112',9,15,'DISABLED','ENABLED','LIPA-only'),(46,'operator','IPv4','0.0.0.0','0:0:0:0:0:0:0:0',50000000,100000000,3,'208930100001111',9,15,'DISABLED','ENABLED','LIPA-only'),(47,'operator','IPv4','0.0.0.0','0:0:0:0:0:0:0:0',50000000,100000000,3,'208950000000002',9,15,'DISABLED','ENABLED','LIPA-only'),(48,'oai.ipv4','IPv4','0.0.0.0','0:0:0:0:0:0:0:0',50000000,100000000,3,'208950000000008',9,15,'DISABLED','ENABLED','LIPA-only'),(49,'oai.ipv4','IPv4','0.0.0.0','0:0:0:0:0:0:0:0',50000000,100000000,3,'208950000000009',9,15,'DISABLED','ENABLED','LIPA-only'),(50,'oai.ipv4','IPv4','0.0.0.0','0:0:0:0:0:0:0:0',50000000,100000000,3,'208950000000010',9,15,'DISABLED','ENABLED','LIPA-only'),(51,'oai.ipv4','IPv4','0.0.0.0','0:0:0:0:0:0:0:0',50000000,100000000,3,'208950000000011',9,15,'DISABLED','ENABLED','LIPA-only'),(52,'oai.ipv4','IPv4','0.0.0.0','0:0:0:0:0:0:0:0',50000000,100000000,3,'208950000000012',9,15,'DISABLED','ENABLED','LIPA-only'),(53,'oai.ipv4','IPv4','0.0.0.0','0:0:0:0:0:0:0:0',50000000,100000000,3,'208950000000013',9,15,'DISABLED','ENABLED','LIPA-only'),(54,'oai.ipv4','IPv4','0.0.0.0','0:0:0:0:0:0:0:0',50000000,100000000,3,'208950000000014',9,15,'DISABLED','ENABLED','LIPA-only'),(55,'oai.ipv4','IPv4','0.0.0.0','0:0:0:0:0:0:0:0',50000000,100000000,3,'208950000000015',9,15,'DISABLED','ENABLED','LIPA-only'),(56,'oai.ipv4','IPv4','0.0.0.0','0:0:0:0:0:0:0:0',50000000,100000000,3,'208920100001118',9,15,'DISABLED','ENABLED','LIPA-only'),(57,'oai.ipv4','IPv4','0.0.0.0','0:0:0:0:0:0:0:0',50000000,100000000,3,'208920100001121',9,15,'DISABLED','ENABLED','LIPA-only'),(58,'oai.ipv4','IPv4','0.0.0.0','0:0:0:0:0:0:0:0',50000000,100000000,3,'208920100001120',9,15,'DISABLED','ENABLED','LIPA-only'),(59,'oai.ipv4','IPv4','0.0.0.0','0:0:0:0:0:0:0:0',50000000,100000000,3,'208920100001119',9,15,'DISABLED','ENABLED','LIPA-only'); -/*!40000 ALTER TABLE `pdn` ENABLE KEYS */; -UNLOCK TABLES; - --- --- Table structure for table `pgw` --- - -DROP TABLE IF EXISTS `pgw`; -/*!40101 SET @saved_cs_client = @@character_set_client */; -/*!40101 SET character_set_client = utf8 */; -CREATE TABLE `pgw` ( - `id` int(11) NOT NULL AUTO_INCREMENT, - `ipv4` varchar(15) NOT NULL, - `ipv6` varchar(39) NOT NULL, - PRIMARY KEY (`id`), - UNIQUE KEY `ipv4` (`ipv4`), - UNIQUE KEY `ipv6` (`ipv6`) -) ENGINE=MyISAM AUTO_INCREMENT=4 DEFAULT CHARSET=latin1; -/*!40101 SET character_set_client = @saved_cs_client */; - --- --- Dumping data for table `pgw` --- - -LOCK TABLES `pgw` WRITE; -/*!40000 ALTER TABLE `pgw` DISABLE KEYS */; -INSERT INTO `pgw` VALUES (1,'127.0.0.1','0:0:0:0:0:0:0:1'),(2,'192.168.56.101',''),(3,'10.0.0.2','0'); -/*!40000 ALTER TABLE `pgw` ENABLE KEYS */; -UNLOCK TABLES; - --- --- Table structure for table `terminal-info` --- - -DROP TABLE IF EXISTS `terminal-info`; -/*!40101 SET @saved_cs_client = @@character_set_client */; -/*!40101 SET character_set_client = utf8 */; -CREATE TABLE `terminal-info` ( - `imei` varchar(15) NOT NULL, - `sv` varchar(2) NOT NULL, - UNIQUE KEY `imei` (`imei`) -) ENGINE=InnoDB DEFAULT CHARSET=latin1; -/*!40101 SET character_set_client = @saved_cs_client */; - --- --- Dumping data for table `terminal-info` --- - -LOCK TABLES `terminal-info` WRITE; -/*!40000 ALTER TABLE `terminal-info` DISABLE KEYS */; -/*!40000 ALTER TABLE `terminal-info` ENABLE KEYS */; -UNLOCK TABLES; - --- --- Table structure for table `users` --- - -DROP TABLE IF EXISTS `users`; -/*!40101 SET @saved_cs_client = @@character_set_client */; -/*!40101 SET character_set_client = utf8 */; -CREATE TABLE `users` ( - `imsi` varchar(15) NOT NULL COMMENT 'IMSI is the main reference key.', - `msisdn` varchar(46) DEFAULT NULL COMMENT 'The basic MSISDN of the UE (Presence of MSISDN is optional).', - `imei` varchar(15) DEFAULT NULL COMMENT 'International Mobile Equipment Identity', - `imei_sv` varchar(2) DEFAULT NULL COMMENT 'International Mobile Equipment Identity Software Version Number', - `ms_ps_status` enum('PURGED','NOT_PURGED') DEFAULT 'PURGED' COMMENT 'Indicates that ESM and EMM status are purged from MME', - `rau_tau_timer` int(10) unsigned DEFAULT '120', - `ue_ambr_ul` bigint(20) unsigned DEFAULT '50000000' COMMENT 'The Maximum Aggregated uplink MBRs to be shared across all Non-GBR bearers according to the subscription of the user.', - `ue_ambr_dl` bigint(20) unsigned DEFAULT '100000000' COMMENT 'The Maximum Aggregated downlink MBRs to be shared across all Non-GBR bearers according to the subscription of the user.', - `access_restriction` int(10) unsigned DEFAULT '60' COMMENT 'Indicates the access restriction subscription information. 3GPP TS.29272 #7.3.31', - `mme_cap` int(10) unsigned zerofill DEFAULT NULL COMMENT 'Indicates the capabilities of the MME with respect to core functionality e.g. regional access restrictions.', - `mmeidentity_idmmeidentity` int(11) NOT NULL DEFAULT '0', - `key` varbinary(16) NOT NULL DEFAULT '0' COMMENT 'UE security key', - `RFSP-Index` smallint(5) unsigned NOT NULL DEFAULT '1' COMMENT 'An index to specific RRM configuration in the E-UTRAN. Possible values from 1 to 256', - `urrp_mme` tinyint(1) NOT NULL DEFAULT '0' COMMENT 'UE Reachability Request Parameter indicating that UE activity notification from MME has been requested by the HSS.', - `sqn` bigint(20) unsigned zerofill NOT NULL, - `rand` varbinary(16) NOT NULL, - `OPc` varbinary(16) DEFAULT NULL COMMENT 'Can be computed by HSS', - PRIMARY KEY (`imsi`,`mmeidentity_idmmeidentity`), - KEY `fk_users_mmeidentity_idx1` (`mmeidentity_idmmeidentity`) -) ENGINE=MyISAM DEFAULT CHARSET=latin1; -/*!40101 SET character_set_client = @saved_cs_client */; - --- --- Dumping data for table `users` --- - -LOCK TABLES `users` WRITE; -/*!40000 ALTER TABLE `users` DISABLE KEYS */; -INSERT INTO `users` VALUES ('20834123456789','380561234567','35609204079300',NULL,'PURGED',50,40000000,100000000,47,0000000000,1,'+�E��ų\0�,IH��H',0,0,00000000000000000096,'Px�X \Z1��x��','^��K�����FeU���'),('20810000001234','33611123456','35609204079299',NULL,'PURGED',120,40000000,100000000,47,0000000000,1,'��G?/�Д���� |hb',1,0,00000281454575616225,'\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0','�4�s@���z��~�'),('31002890832150','33638060059','35611302209414',NULL,'PURGED',120,40000000,100000000,47,0000000000,1,'��G?/�Д���� |hb',1,0,00000000000000012416,'`�F�݆��D��ϛ���','�4�s@���z��~�'),('001010123456789','33600101789','35609204079298',NULL,'PURGED',120,50000000,100000000,47,0000000000,1,'\0 \n \r',1,0,00000000000000000351,'\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0','L�*\\�����^��]� '),('208930000000001','33638030001','35609204079301',NULL,'PURGED',120,50000000,100000000,47,0000000000,1,'��G?/�Д���� |hb',1,0,00000000000000006103,'��wq��gzW�Ё��Z]','�4�s@���z��~�'),('208950000000002','33638050002','35609204079502',NULL,'PURGED',120,50000000,100000000,47,0000000000,1,'��G?/�Д���� |hb',1,0,00000000000000020471,'\0 \n \r','�4�s@���z��~�'),('208950000000003','33638050003','35609204079503',NULL,'PURGED',120,50000000,100000000,47,0000000000,1,'��G?/�Д���� |hb',1,0,00000000000000012343,'\0 \n \r','�4�s@���z��~�'),('208950000000004','33638050004','35609204079504',NULL,'PURGED',120,50000000,100000000,47,0000000000,1,'��G?/�Д���� |hb',1,0,00000000000000012215,'56f0261d9d051063','�4�s@���z��~�'),('208950000000005','33638050005','35609204079505',NULL,'PURGED',120,50000000,100000000,47,0000000000,1,'��G?/�Д���� |hb',1,0,00000000000000012215,'56f0261d9d051063','�4�s@���z��~�'),('208950000000001','33638050001','35609204079501',NULL,'PURGED',120,50000000,100000000,47,0000000000,1,'��G?/�Д���� |hb',1,0,00000000000000006103,'��wq��gzW�Ё��Z]','�4�s@���z��~�'),('208950000000006','33638050006','35609204079506',NULL,'PURGED',120,50000000,100000000,47,0000000000,1,'��G?/�Д���� |hb',1,0,00000000000000012215,'56f0261d9d051063','�4�s@���z��~�'),('208950000000007','33638050007','35609204079507',NULL,'PURGED',120,50000000,100000000,47,0000000000,1,'��G?/�Д���� |hb',1,0,00000000000000012215,'56f0261d9d051063','�4�s@���z��~�'),('208930000000002','33638030002','35609204079302',NULL,'PURGED',120,50000000,100000000,47,0000000000,1,'��G?/�Д���� |hb',1,0,00000000000000006103,'��wq��gzW�Ё��Z]','�4�s@���z��~�'),('208930000000003','33638030003','35609204079303',NULL,'PURGED',120,50000000,100000000,47,0000000000,1,'��G?/�Д���� |hb',1,0,00000000000000006103,'��wq��gzW�Ё��Z]','�4�s@���z��~�'),('208930000000004','33638030004','35609204079304',NULL,'PURGED',120,50000000,100000000,47,0000000000,1,'��G?/�Д���� |hb',1,0,00000000000000006103,'��wq��gzW�Ё��Z]','�4�s@���z��~�'),('208930000000005','33638030005','35609204079305',NULL,'PURGED',120,50000000,100000000,47,0000000000,1,'��G?/�Д���� |hb',1,0,00000000000000006103,'��wq��gzW�Ё��Z]','�4�s@���z��~�'),('208930000000006','33638030006','35609204079306',NULL,'PURGED',120,50000000,100000000,47,0000000000,1,'��G?/�Д���� |hb',1,0,00000000000000006103,'��wq��gzW�Ё��Z]','�4�s@���z��~�'),('208930000000007','33638030007','35609204079307',NULL,'PURGED',120,50000000,100000000,47,0000000000,1,'��G?/�Д���� |hb',1,0,00000000000000006103,'��wq��gzW�Ё��Z]','�4�s@���z��~�'),('208940000000007','33638040007','35609204079407',NULL,'PURGED',120,50000000,100000000,47,0000000000,1,'��G?/�Д���� |hb',1,0,00000000000000006103,'��wq��gzW�Ё��Z]','�4�s@���z��~�'),('208940000000006','33638040006','35609204079406',NULL,'PURGED',120,50000000,100000000,47,0000000000,1,'��G?/�Д���� |hb',1,0,00000000000000006103,'��wq��gzW�Ё��Z]','�4�s@���z��~�'),('208940000000005','33638040005','35609204079405',NULL,'PURGED',120,50000000,100000000,47,0000000000,1,'��G?/�Д���� |hb',1,0,00000000000000006103,'��wq��gzW�Ё��Z]','�4�s@���z��~�'),('208940000000004','33638040004','35609204079404',NULL,'PURGED',120,50000000,100000000,47,0000000000,1,'��G?/�Д���� |hb',1,0,00000000000000006103,'��wq��gzW�Ё��Z]','�4�s@���z��~�'),('208940000000003','33638040003','35609204079403',NULL,'PURGED',120,50000000,100000000,47,0000000000,1,'��G?/�Д���� |hb',1,0,00000000000000006103,'��wq��gzW�Ё��Z]','�4�s@���z��~�'),('208940000000002','33638040002','35609204079402',NULL,'PURGED',120,50000000,100000000,47,0000000000,1,'��G?/�Д���� |hb',1,0,00000000000000006103,'��wq��gzW�Ё��Z]','�4�s@���z��~�'),('208940000000001','33638040001','35609204079401',NULL,'PURGED',120,50000000,100000000,47,0000000000,1,'��G?/�Д���� |hb',1,0,00000000000000006103,'��wq��gzW�Ё��Z]','�4�s@���z��~�'),('208920100001100','33638020001','35609204079201',NULL,'PURGED',120,50000000,100000000,47,0000000000,1,'��G?/�Д���� |hb',1,0,00000000000000006103,'ebd07771ace8677a','�4�s@���z��~�'),('208920100001101','33638020001','35609204079201',NULL,'NOT_PURGED',120,50000000,100000000,47,0000000000,1,'��k��p~Љu{�K�',1,0,00000281044204937234,'\0 \n \r','�$I6;��+f�k�u�|�'),('208920100001102','33638020002','35609204079202',NULL,'PURGED',120,50000000,100000000,47,0000000000,1,'��G?/�Д���� |hb',1,0,00000000000000006103,'ebd07771ace8677a','�4�s@���z��~�'),('208920100001103','33638020003','35609204079203',NULL,'PURGED',120,50000000,100000000,47,0000000000,1,'��G?/�Д���� |hb',1,0,00000000000000006103,'ebd07771ace8677a','�4�s@���z��~�'),('208920100001104','33638020004','35609204079204',NULL,'PURGED',120,50000000,100000000,47,0000000000,1,'��G?/�Д���� |hb',1,0,00000000000000006103,'ebd07771ace8677a','�4�s@���z��~�'),('208920100001105','33638020005','35609204079205',NULL,'PURGED',120,50000000,100000000,47,0000000000,1,'��G?/�Д���� |hb',1,0,00000000000000006103,'ebd07771ace8677a','�4�s@���z��~�'),('208920100001106','33638020006','35609204079206',NULL,'PURGED',120,50000000,100000000,47,0000000000,1,'��k��p~Љu{�K�',1,0,00000000000000006103,'ebd07771ace8677a','�$I6;��+f�k�u�|�'),('208920100001107','33638020007','35609204079207',NULL,'PURGED',120,50000000,100000000,47,0000000000,1,'��G?/�Д���� |hb',1,0,00000000000000006103,'ebd07771ace8677a','�4�s@���z��~�'),('208920100001108','33638020008','35609204079208',NULL,'PURGED',120,50000000,100000000,47,0000000000,1,'��G?/�Д���� |hb',1,0,00000000000000006103,'ebd07771ace8677a','�4�s@���z��~�'),('208920100001109','33638020009','35609204079209',NULL,'PURGED',120,50000000,100000000,47,0000000000,1,'��G?/�Д���� |hb',1,0,00000000000000006103,'ebd07771ace8677a','�4�s@���z��~�'),('208920100001110','33638020010','35609204079210',NULL,'PURGED',120,50000000,100000000,47,0000000000,1,'��G?/�Д���� |hb',1,0,00000000000000006103,'ebd07771ace8677a','�4�s@���z��~�'),('208930100001111','33638030011','35609304079211',NULL,'PURGED',120,50000000,100000000,47,0000000000,1,'��G?/�Д���� |hb',1,0,00000000000000006103,'ebd07771ace8677a','�4�s@���z��~�'),('208930100001112','33638030012','35609304079212',NULL,'PURGED',120,50000000,100000000,47,0000000000,1,'��G?/�Д���� |hb',1,0,00000000000000006103,'ebd07771ace8677a','�4�s@���z��~�'),('208930100001113','33638030013','35609304079213',NULL,'PURGED',120,50000000,100000000,47,0000000000,1,'��G?/�Д���� |hb',1,0,00000000000000006263,'�SNܒ�Iv��e�6','�4�s@���z��~�'),('208950000000008','33638050008','35609204079508',NULL,'PURGED',120,50000000,100000000,47,0000000000,1,'��G?/�Д���� |hb',1,0,00000000000000012215,'56f0261d9d051063','�4�s@���z��~�'),('208950000000009','33638050009','35609204079509',NULL,'PURGED',120,50000000,100000000,47,0000000000,1,'��G?/�Д���� |hb',1,0,00000000000000012215,'56f0261d9d051063','�4�s@���z��~�'),('208950000000010','33638050010','35609204079510',NULL,'PURGED',120,50000000,100000000,47,0000000000,1,'��G?/�Д���� |hb',1,0,00000000000000012215,'56f0261d9d051063','�4�s@���z��~�'),('208950000000011','33638050011','35609204079511',NULL,'PURGED',120,50000000,100000000,47,0000000000,1,'��G?/�Д���� |hb',1,0,00000000000000012215,'56f0261d9d051063','�4�s@���z��~�'),('208950000000012','33638050012','35609204079512',NULL,'PURGED',120,50000000,100000000,47,0000000000,1,'��G?/�Д���� |hb',1,0,00000000000000012215,'56f0261d9d051063','�4�s@���z��~�'),('208950000000013','33638050013','35609204079513',NULL,'PURGED',120,50000000,100000000,47,0000000000,1,'��G?/�Д���� |hb',1,0,00000000000000012215,'56f0261d9d051063','�4�s@���z��~�'),('208950000000014','33638050014','35609204079514',NULL,'PURGED',120,50000000,100000000,47,0000000000,1,'��G?/�Д���� |hb',1,0,00000000000000012215,'56f0261d9d051063','�4�s@���z��~�'),('208950000000015','33638050015','35609204079515',NULL,'PURGED',120,50000000,100000000,47,0000000000,1,'��G?/�Д���� |hb',1,0,00000000000000000000,'3536663032363164','�4�s@���z��~�'),('208920100001118','33638020010','35609204079210',NULL,'NOT_PURGED',120,50000000,100000000,47,0000000000,1,'��k��p~Љu{�K�',1,0,00000281044204934762,'~?03�u-%�ey�y�','�$I6;��+f�k�u�|�'),('208920100001121','33638020010','35609204079210',NULL,'NOT_PURGED',120,50000000,100000000,47,0000000000,1,'��k��p~Љu{�K�',1,0,00000281044204935293,'&��@xg�]���\n��Vp','�$I6;��+f�k�u�|�'),('208920100001119','33638020010','35609204079210',NULL,'NOT_PURGED',120,50000000,100000000,47,0000000000,1,'��k��p~Љu{�K�',1,0,00000281044204935293,'269482407867805d','�$I6;��+f�k�u�|�'),('208920100001120','33638020010','35609204079210',NULL,'NOT_PURGED',120,50000000,100000000,47,0000000000,1,'��k��p~Љu{�K�',1,0,00000281044204935293,'3236393438323430','�$I6;��+f�k�u�|�'); -INSERT INTO `users` VALUES ('208990100001100','1','55000000000000',NULL,'PURGED',50,40000000,100000000,47,0000000000,1,0xfec86ba6eb707ed08905757b1bb44b8f,0,0,0x40,'ebd07771ace8677a',0xc42449363bbad02b66d16bc975d77cc1); -INSERT INTO `users` VALUES ('208990100001101','1','55000000000000',NULL,'PURGED',50,40000000,100000000,47,0000000000,1,0xfec86ba6eb707ed08905757b1bb44b8f,0,0,0x40,'ebd07771ace8677a',0xc42449363bbad02b66d16bc975d77cc1); -INSERT INTO `users` VALUES ('208990100001102','1','55000000000000',NULL,'PURGED',50,40000000,100000000,47,0000000000,1,0xfec86ba6eb707ed08905757b1bb44b8f,0,0,0x40,'ebd07771ace8677a',0xc42449363bbad02b66d16bc975d77cc1); -INSERT INTO `users` VALUES ('208950000000031','380561234567','55000000000001',NULL,'PURGED',50,40000000,100000000,47,0000000000,1,0x0C0A34601D4F07677303652C0462535B,0,0,0x40,'ebd07771ace8677a',0x63bfa50ee6523365ff14c1f45f88737d); -INSERT INTO `users` VALUES ('208950000000032','380561234567','55000000000001',NULL,'PURGED',50,40000000,100000000,47,0000000000,1,0x0C0A34601D4F07677303652C0462535B,0,0,0x40,'ebd07771ace8677a',0x63bfa50ee6523365ff14c1f45f88737d); -INSERT INTO `users` VALUES ('208950000000033','380561234567','55000000000001',NULL,'PURGED',50,40000000,100000000,47,0000000000,1,0x0C0A34601D4F07677303652C0462535B,0,0,0x40,'ebd07771ace8677a',0x63bfa50ee6523365ff14c1f45f88737d); -INSERT INTO `users` VALUES ('208950000000034','380561234567','55000000000001',NULL,'PURGED',50,40000000,100000000,47,0000000000,1,0x0C0A34601D4F07677303652C0462535B,0,0,0x40,'ebd07771ace8677a',0x63bfa50ee6523365ff14c1f45f88737d); -INSERT INTO `users` VALUES ('208950000000035','380561234567','55000000000001',NULL,'PURGED',50,40000000,100000000,47,0000000000,1,0x0C0A34601D4F07677303652C0462535B,0,0,0x40,'ebd07771ace8677a',0x63bfa50ee6523365ff14c1f45f88737d); -INSERT INTO `users` VALUES ('208950000000036','380561234567','55000000000001',NULL,'PURGED',50,40000000,100000000,47,0000000000,1,0x0C0A34601D4F07677303652C0462535B,0,0,0x40,'ebd07771ace8677a',0x63bfa50ee6523365ff14c1f45f88737d); -INSERT INTO `users` VALUES ('208950000000037','380561234567','55000000000001',NULL,'PURGED',50,40000000,100000000,47,0000000000,1,0x0C0A34601D4F07677303652C0462535B,0,0,0x40,'ebd07771ace8677a',0x63bfa50ee6523365ff14c1f45f88737d); -INSERT INTO `users` VALUES ('208950000000038','380561234567','55000000000001',NULL,'PURGED',50,40000000,100000000,47,0000000000,1,0x0C0A34601D4F07677303652C0462535B,0,0,0x40,'ebd07771ace8677a',0x63bfa50ee6523365ff14c1f45f88737d); -INSERT INTO `users` VALUES ('208950000000039','380561234567','55000000000001',NULL,'PURGED',50,40000000,100000000,47,0000000000,1,0x0C0A34601D4F07677303652C0462535B,0,0,0x40,'ebd07771ace8677a',0x63bfa50ee6523365ff14c1f45f88737d); -INSERT INTO `users` VALUES ('208950000000040','380561234567','55000000000001',NULL,'PURGED',50,40000000,100000000,47,0000000000,1,0x0C0A34601D4F07677303652C0462535B,0,0,0x40,'ebd07771ace8677a',0x63bfa50ee6523365ff14c1f45f88737d); -/*!40000 ALTER TABLE `users` ENABLE KEYS */; -UNLOCK TABLES; -/*!40103 SET TIME_ZONE=@OLD_TIME_ZONE */; - -/*!40101 SET SQL_MODE=@OLD_SQL_MODE */; -/*!40014 SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS */; -/*!40014 SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS */; -/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */; -/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */; -/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */; -/*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */; - --- Dump completed on 2016-06-28 11:41:40 diff --git a/ci-scripts/yaml_files/5g_f1_rfsimulator/smf-healthcheck.sh b/ci-scripts/yaml_files/5g_f1_rfsimulator/smf-healthcheck.sh deleted file mode 100755 index d9ff7608e8..0000000000 --- a/ci-scripts/yaml_files/5g_f1_rfsimulator/smf-healthcheck.sh +++ /dev/null @@ -1,21 +0,0 @@ -#!/bin/bash -set -eo pipefail - -STATUS=0 -SMF_IP_SBI_INTERFACE=$(ifconfig $SMF_INTERFACE_NAME_FOR_SBI | grep inet | awk {'print $2'}) -SMF_SBI_PORT_STATUS=$(netstat -tnpl | grep -o "$SMF_IP_SBI_INTERFACE:$SMF_INTERFACE_PORT_FOR_SBI") - -#Check if entrypoint properly configured the conf file and no parameter is unset(optional) -#NB_UNREPLACED_AT=`cat /openair-smf/etc/*.conf | grep -v contact@openairinterface.org | grep -c @ || true` - -#if [ $NB_UNREPLACED_AT -ne 0 ]; then -# STATUS=-1 -# echo "Healthcheck error: UNHEALTHY configuration file is not configured properly" -#fi -# -if [[ -z $SMF_SBI_PORT_STATUS ]]; then - STATUS=-1 - echo "Healthcheck error: UNHEALTHY SBI TCP/HTTP port $SMF_INTERFACE_PORT_FOR_SBI is not listening." -fi - -exit $STATUS diff --git a/ci-scripts/yaml_files/5g_f1_rfsimulator/spgwu-healthcheck.sh b/ci-scripts/yaml_files/5g_f1_rfsimulator/spgwu-healthcheck.sh deleted file mode 100755 index 0e3b67ee7e..0000000000 --- a/ci-scripts/yaml_files/5g_f1_rfsimulator/spgwu-healthcheck.sh +++ /dev/null @@ -1,28 +0,0 @@ -#!/bin/bash -set -eo pipefail - -STATUS=0 -SGW_PORT_FOR_S1U_S12_S4_UP=2152 -SGW_PORT_FOR_SX=8805 -SGW_IP_S1U_INTERFACE=$(ifconfig $SGW_INTERFACE_NAME_FOR_S1U_S12_S4_UP | grep inet | awk {'print $2'}) -SGW_IP_SX_INTERFACE=$(ifconfig $SGW_INTERFACE_NAME_FOR_SX | grep inet | awk {'print $2'}) -S1U_S12_S4_UP_PORT_STATUS=$(netstat -unpl | grep -o "$SGW_IP_S1U_INTERFACE:$SGW_PORT_FOR_S1U_S12_S4_UP") -SX_PORT_STATUS=$(netstat -unpl | grep -o "$SGW_IP_SX_INTERFACE:$SGW_PORT_FOR_SX") -#Check if entrypoint properly configured the conf file and no parameter is unset (optional) -NB_UNREPLACED_AT=`cat /openair-spgwu/etc/*.conf | grep -v contact@openairinterface.org | grep -c @ || true` -if [ $NB_UNREPLACED_AT -ne 0 ]; then - STATUS=1 - echo "Healthcheck error: UNHEALTHY configuration file is not configured properly" -fi - -if [[ -z $S1U_S12_S4_UP_PORT_STATUS ]]; then - STATUS=1 - echo "Healthcheck error: UNHEALTHY S1U port $SGW_PORT_FOR_S1U_S12_S4_UP is not listening." -fi - -if [[ -z $SX_PORT_STATUS ]]; then - STATUS=1 - echo "Healthcheck error: UNHEALTHY SX port $SGW_PORT_FOR_SX is not listening." -fi - -exit $STATUS \ No newline at end of file diff --git a/ci-scripts/yaml_files/5g_fdd_rfsimulator/amf-healthcheck.sh b/ci-scripts/yaml_files/5g_fdd_rfsimulator/amf-healthcheck.sh deleted file mode 100755 index 8bfdee2aac..0000000000 --- a/ci-scripts/yaml_files/5g_fdd_rfsimulator/amf-healthcheck.sh +++ /dev/null @@ -1,57 +0,0 @@ -#!/bin/bash -set -eo pipefail - -STATUS=0 -AMF_PORT_FOR_NGAP=38412 -AMF_PORT_FOR_N11_HTTP=80 -AMF_IP_NGAP_INTERFACE=$(ifconfig $AMF_INTERFACE_NAME_FOR_NGAP | grep inet | awk {'print $2'}) -AMF_IP_N11_INTERFACE=$(ifconfig $AMF_INTERFACE_NAME_FOR_N11 | grep inet | awk {'print $2'}) -N2_PORT_STATUS=$(netstat -Snpl | grep -o "$AMF_IP_NGAP_INTERFACE:$AMF_PORT_FOR_NGAP") -N11_PORT_STATUS=$(netstat -tnpl | grep -o "$AMF_IP_N11_INTERFACE:$AMF_PORT_FOR_N11_HTTP") -#Check if entrypoint properly configured the conf file and no parameter is unset (optional) -NB_UNREPLACED_AT=`cat /openair-amf/etc/*.conf | grep -v contact@openairinterface.org | grep -c @ || true` - -if [ $NB_UNREPLACED_AT -ne 0 ]; then - STATUS=1 - echo "Healthcheck error: configuration file is not configured properly" -fi - -if [[ -z $N2_PORT_STATUS ]]; then - STATUS=1 - echo "Healthcheck error: N2 SCTP port $AMF_PORT_FOR_NGAP is not listening" -fi - -if [[ -z $N11_PORT_STATUS ]]; then - STATUS=1 - echo "Healthcheck error: N11/SBI TCP/HTTP port $AMF_PORT_FOR_N11_HTTP is not listening" -fi - -#host="${MYSQL_SERVER}" -#user="${MYSQL_USER:-root}" -#export MYSQL_PWD="${MYSQL_PASS}" - -#args=( -# -h"$host" -# -u"$user" -# --silent -#) - -#if ! command -v mysql &> /dev/null; then -# echo "Installing mysql command" -# apt update -# apt-get -y install mysql-client -#else -# if select="$(echo 'SELECT 1' | mysql "${args[@]}")" && [ "$select" = '1' ]; then -# database_check=$(mysql -h$host -u$user -D oai_db --silent -e "SELECT * FROM users;") -# if [[ -z $database_check ]]; then -# echo "Healthcheck error: oai_db not populated" -# STATUS=1 -# fi -# STATUS=0 -# else -# echo "Healthcheck error: Mysql port inactive" -# STATUS=1 -# fi -#fi - -exit $STATUS diff --git a/ci-scripts/yaml_files/5g_fdd_rfsimulator/docker-compose.yaml b/ci-scripts/yaml_files/5g_fdd_rfsimulator/docker-compose.yaml index 7912c48408..515e91d110 100644 --- a/ci-scripts/yaml_files/5g_fdd_rfsimulator/docker-compose.yaml +++ b/ci-scripts/yaml_files/5g_fdd_rfsimulator/docker-compose.yaml @@ -1,20 +1,11 @@ version: '3.8' services: - oai-nrf: - container_name: "rfsim5g-oai-nrf" - image: oaisoftwarealliance/oai-nrf:v1.5.0 - environment: - - NRF_INTERFACE_NAME_FOR_SBI=eth0 - - TZ=Europe/Paris - networks: - public_net: - ipv4_address: 192.168.71.130 mysql: container_name: "rfsim5g-mysql" image: mysql:8.0 volumes: - - ./oai_db.sql:/docker-entrypoint-initdb.d/oai_db.sql - - ./mysql-healthcheck.sh:/tmp/mysql-healthcheck.sh + - ../5g_rfsimulator/oai_db.sql:/docker-entrypoint-initdb.d/oai_db.sql + - ../5g_rfsimulator/mysql-healthcheck.sh:/tmp/mysql-healthcheck.sh environment: - TZ=Europe/Paris - MYSQL_DATABASE=oai_db @@ -31,108 +22,36 @@ services: ipv4_address: 192.168.71.131 oai-amf: container_name: "rfsim5g-oai-amf" - image: oaisoftwarealliance/oai-amf:v1.5.0 + image: oaisoftwarealliance/oai-amf:v2.0.0 environment: - TZ=Europe/paris - - MCC=208 - - MNC=99 - - REGION_ID=128 - - AMF_SET_ID=1 - - SERVED_GUAMI_MCC_0=208 - - SERVED_GUAMI_MNC_0=99 - - SERVED_GUAMI_REGION_ID_0=128 - - SERVED_GUAMI_AMF_SET_ID_0=1 - - SERVED_GUAMI_MCC_1=460 - - SERVED_GUAMI_MNC_1=11 - - SERVED_GUAMI_REGION_ID_1=10 - - SERVED_GUAMI_AMF_SET_ID_1=1 - - PLMN_SUPPORT_MCC=208 - - PLMN_SUPPORT_MNC=99 - - PLMN_SUPPORT_TAC=0x0001 - # Only one slice is defined (1, 0xFFFFFF). - - SST_0=1 - - AMF_INTERFACE_NAME_FOR_NGAP=eth0 - - AMF_INTERFACE_NAME_FOR_N11=eth0 - # One single SMF instance - - SMF_INSTANCE_ID_0=1 - - SMF_FQDN_0=oai-smf - - SMF_IPV4_ADDR_0=192.168.71.133 - - SELECTED_0=true - # mysql definition in AMF is mandatory in mini deployment. - - MYSQL_SERVER=192.168.71.131 - - MYSQL_USER=root - - MYSQL_PASS=linux - - MYSQL_DB=oai_db - # NF registration - - NRF_IPV4_ADDRESS=192.168.71.130 - - NRF_FQDN=oai-nrf - - NF_REGISTRATION=yes - - SMF_SELECTION=yes - - USE_FQDN_DNS=yes - - USE_HTTP2=no + volumes: + - ../5g_rfsimulator/mini_nonrf_config.yaml:/openair-amf/etc/config.yaml depends_on: - - oai-nrf - mysql networks: public_net: ipv4_address: 192.168.71.132 oai-smf: container_name: "rfsim5g-oai-smf" - image: oaisoftwarealliance/oai-smf:v1.5.0 + image: oaisoftwarealliance/oai-smf:v2.0.0 environment: - TZ=Europe/Paris - - SMF_INTERFACE_NAME_FOR_N4=eth0 - - SMF_INTERFACE_NAME_FOR_SBI=eth0 - - DEFAULT_DNS_IPV4_ADDRESS=172.21.3.100 - - DEFAULT_DNS_SEC_IPV4_ADDRESS=4.4.4.4 - - AMF_IPV4_ADDRESS=192.168.71.132 - - AMF_FQDN=oai-amf - - UPF_IPV4_ADDRESS=192.168.71.134 - - UPF_FQDN_0=oai-spgwu - - NRF_IPV4_ADDRESS=192.168.71.130 - - NRF_FQDN=oai-nrf - - REGISTER_NRF=yes - - DISCOVER_UPF=yes - - USE_FQDN_DNS=yes - - USE_LOCAL_SUBSCRIPTION_INFO=yes - - UE_MTU=1500 - # Only one slice is defined (1, 0xFFFFFF) - - DNN_NI0=oai - - TYPE0=IPv4 - - DNN_RANGE0=12.1.1.2 - 12.1.1.127 - - NSSAI_SST0=1 - - SESSION_AMBR_UL0=200Mbps - - SESSION_AMBR_DL0=400Mbps - - DEFAULT_CSCF_IPV4_ADDRESS=127.0.0.1 - - ENABLE_USAGE_REPORTING=no + volumes: + - ../5g_rfsimulator/mini_nonrf_config.yaml:/openair-smf/etc/config.yaml depends_on: - - oai-nrf - oai-amf networks: public_net: ipv4_address: 192.168.71.133 - oai-spgwu: - container_name: "rfsim5g-oai-spgwu" - image: oaisoftwarealliance/oai-spgwu-tiny:v1.5.0 + oai-upf: + container_name: "rfsim5g-oai-upf" + image: oaisoftwarealliance/oai-upf:v2.0.0 environment: - TZ=Europe/Paris - - SGW_INTERFACE_NAME_FOR_S1U_S12_S4_UP=eth0 - - SGW_INTERFACE_NAME_FOR_SX=eth0 - - PGW_INTERFACE_NAME_FOR_SGI=eth0 - - NETWORK_UE_NAT_OPTION=yes - - NETWORK_UE_IP=12.1.1.0/24 - - ENABLE_5G_FEATURES=yes - - REGISTER_NRF=yes - - USE_FQDN_NRF=yes - - UPF_FQDN_5G=oai-spgwu - - NRF_IPV4_ADDRESS=192.168.71.130 - - NRF_FQDN=oai-nrf - # Only one slice is defined (1, 0xFFFFFF) - - NSSAI_SST_0=1 - - NSSAI_SD_0=0xffffff - - DNN_0=oai + volumes: + - ../5g_rfsimulator/mini_nonrf_config.yaml:/openair-upf/etc/config.yaml depends_on: - - oai-nrf - oai-smf cap_add: - NET_ADMIN @@ -153,7 +72,7 @@ services: "iptables -t nat -A POSTROUTING -o eth0 -j MASQUERADE;"\ "ip route add 12.1.1.0/24 via 192.168.72.134 dev eth0; sleep infinity" depends_on: - - oai-spgwu + - oai-upf networks: traffic_net: ipv4_address: 192.168.72.135 @@ -166,7 +85,7 @@ services: image: oaisoftwarealliance/oai-gnb:develop privileged: true container_name: rfsim5g-oai-gnb - environment: + environment: USE_ADDITIONAL_OPTIONS: --sa -E --rfsim --log_config.global_log_options level,nocolor,time ASAN_OPTIONS: detect_leaks=0 depends_on: diff --git a/ci-scripts/yaml_files/5g_fdd_rfsimulator/mysql-healthcheck.sh b/ci-scripts/yaml_files/5g_fdd_rfsimulator/mysql-healthcheck.sh deleted file mode 100755 index c92efb9f00..0000000000 --- a/ci-scripts/yaml_files/5g_fdd_rfsimulator/mysql-healthcheck.sh +++ /dev/null @@ -1,46 +0,0 @@ -#!/bin/bash -set -eo pipefail - -if [ "$MYSQL_ROOT_PASSWORD" ] && [ -z "$MYSQL_USER" ] && [ -z "$MYSQL_PASSWORD" ]; then - echo >&2 'Healthcheck error: cannot determine root password (and MYSQL_USER and MYSQL_PASSWORD were not set)' - exit 0 -fi - -host="$(hostname --ip-address || echo '127.0.0.1')" -user="${MYSQL_USER:-root}" -export MYSQL_PWD="${MYSQL_PASSWORD:-$MYSQL_ROOT_PASSWORD}" - -args=( - # force mysql to not use the local "mysqld.sock" (test "external" connectivity) - -h"$host" - -u"$user" - --silent -) - -STATUS=0 -if command -v mysqladmin &> /dev/null; then - if mysqladmin "${args[@]}" ping > /dev/null; then - database_check=$(mysql -u$user -D oai_db --silent -e "SELECT * FROM users;") - if [[ -z $database_check ]]; then - echo "Healthcheck error: oai_db not populated" - STATUS=1 - fi - STATUS=0 - else - echo "Healthcheck error: Mysql port inactive" - STATUS=1 - fi -else - if select="$(echo 'SELECT 1' | mysql "${args[@]}")" && [ "$select" = '1' ]; then - database_check=$(mysql -u$user -D oai_db --silent -e "SELECT * FROM users;") - if [[ -z $database_check ]]; then - echo "Healthcheck error: oai_db not populated" - STATUS=1 - fi - STATUS=0 - else - echo "Healthcheck error: Mysql port inactive" - STATUS=1 - fi -fi -exit $STATUS diff --git a/ci-scripts/yaml_files/5g_fdd_rfsimulator/nrf-healthcheck.sh b/ci-scripts/yaml_files/5g_fdd_rfsimulator/nrf-healthcheck.sh deleted file mode 100755 index 3479c092e8..0000000000 --- a/ci-scripts/yaml_files/5g_fdd_rfsimulator/nrf-healthcheck.sh +++ /dev/null @@ -1,20 +0,0 @@ -#!/bin/bash -set -eo pipefail - -STATUS=0 -NRF_IP_SBI_INTERFACE=$(ifconfig $NRF_INTERFACE_NAME_FOR_SBI | grep inet | awk {'print $2'}) -NRF_SBI_PORT_STATUS=$(netstat -tnpl | grep -o "$NRF_IP_SBI_INTERFACE:$NRF_INTERFACE_PORT_FOR_SBI") -#Check if entrypoint properly configured the conf file and no parameter is unset(optional) -NB_UNREPLACED_AT=`cat /openair-nrf/etc/*.conf | grep -v contact@openairinterface.org | grep -c @ || true` - -if [ $NB_UNREPLACED_AT -ne 0 ]; then - STATUS=1 - echo "Healthcheck error: UNHEALTHY configuration file is not configured properly" -fi - -if [[ -z $NRF_SBI_PORT_STATUS ]]; then - STATUS=1 - echo "Healthcheck error: UNHEALTHY SBI TCP/HTTP port $NRF_INTERFACE_PORT_FOR_SBI is not listening." -fi - -exit $STATUS \ No newline at end of file diff --git a/ci-scripts/yaml_files/5g_fdd_rfsimulator/oai_db.sql b/ci-scripts/yaml_files/5g_fdd_rfsimulator/oai_db.sql deleted file mode 100755 index fbd7907a71..0000000000 --- a/ci-scripts/yaml_files/5g_fdd_rfsimulator/oai_db.sql +++ /dev/null @@ -1,217 +0,0 @@ --- MySQL dump 10.13 Distrib 5.5.46, for debian-linux-gnu (x86_64) --- --- Host: localhost Database: oai_db --- ------------------------------------------------------ --- Server version 5.5.46-0ubuntu0.14.04.2 - -/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */; -/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */; -/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */; -/*!40101 SET NAMES utf8 */; -/*!40103 SET @OLD_TIME_ZONE=@@TIME_ZONE */; -/*!40103 SET TIME_ZONE='+00:00' */; -/*!40014 SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0 */; -/*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 */; -/*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */; -/*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */; - --- --- Table structure for table `apn` --- - -DROP TABLE IF EXISTS `apn`; -/*!40101 SET @saved_cs_client = @@character_set_client */; -/*!40101 SET character_set_client = utf8 */; -CREATE TABLE `apn` ( - `id` int(11) NOT NULL AUTO_INCREMENT, - `apn-name` varchar(60) NOT NULL, - `pdn-type` enum('IPv4','IPv6','IPv4v6','IPv4_or_IPv6') NOT NULL, - PRIMARY KEY (`id`), - UNIQUE KEY `apn-name` (`apn-name`) -) ENGINE=InnoDB DEFAULT CHARSET=latin1; -/*!40101 SET character_set_client = @saved_cs_client */; - --- --- Dumping data for table `apn` --- - -LOCK TABLES `apn` WRITE; -/*!40000 ALTER TABLE `apn` DISABLE KEYS */; -/*!40000 ALTER TABLE `apn` ENABLE KEYS */; -UNLOCK TABLES; - --- --- Table structure for table `mmeidentity` --- - -DROP TABLE IF EXISTS `mmeidentity`; -/*!40101 SET @saved_cs_client = @@character_set_client */; -/*!40101 SET character_set_client = utf8 */; -CREATE TABLE `mmeidentity` ( - `idmmeidentity` int(11) NOT NULL AUTO_INCREMENT, - `mmehost` varchar(255) DEFAULT NULL, - `mmerealm` varchar(200) DEFAULT NULL, - `UE-Reachability` tinyint(1) NOT NULL COMMENT 'Indicates whether the MME supports UE Reachability Notifcation', - PRIMARY KEY (`idmmeidentity`) -) ENGINE=MyISAM AUTO_INCREMENT=46 DEFAULT CHARSET=latin1; -/*!40101 SET character_set_client = @saved_cs_client */; - --- --- Dumping data for table `mmeidentity` --- - -LOCK TABLES `mmeidentity` WRITE; -/*!40000 ALTER TABLE `mmeidentity` DISABLE KEYS */; -INSERT INTO `mmeidentity` VALUES (2,'mme2.openair4G.eur','openair4G.eur',0),(1,'nano.openair4G.eur','openair4G.eur',0),(5,'abeille.openair4G.eur','openair4G.eur',0),(4,'yang.openair4G.eur','openair4G.eur',0),(3,'mme3.openair4G.eur','openair4G.eur',0),(6,'calisson.openair4G.eur','openair4G.eur',0); -/*!40000 ALTER TABLE `mmeidentity` ENABLE KEYS */; -UNLOCK TABLES; - --- --- Table structure for table `pdn` --- - -DROP TABLE IF EXISTS `pdn`; -/*!40101 SET @saved_cs_client = @@character_set_client */; -/*!40101 SET character_set_client = utf8 */; -CREATE TABLE `pdn` ( - `id` int(11) NOT NULL AUTO_INCREMENT, - `apn` varchar(60) NOT NULL, - `pdn_type` enum('IPv4','IPv6','IPv4v6','IPv4_or_IPv6') NOT NULL DEFAULT 'IPv4', - `pdn_ipv4` varchar(15) DEFAULT '0.0.0.0', - `pdn_ipv6` varchar(45) CHARACTER SET latin1 COLLATE latin1_general_ci DEFAULT '0:0:0:0:0:0:0:0', - `aggregate_ambr_ul` int(10) unsigned DEFAULT '50000000', - `aggregate_ambr_dl` int(10) unsigned DEFAULT '100000000', - `pgw_id` int(11) NOT NULL, - `users_imsi` varchar(15) NOT NULL, - `qci` tinyint(3) unsigned NOT NULL DEFAULT '9', - `priority_level` tinyint(3) unsigned NOT NULL DEFAULT '15', - `pre_emp_cap` enum('ENABLED','DISABLED') DEFAULT 'DISABLED', - `pre_emp_vul` enum('ENABLED','DISABLED') DEFAULT 'DISABLED', - `LIPA-Permissions` enum('LIPA-prohibited','LIPA-only','LIPA-conditional') NOT NULL DEFAULT 'LIPA-only', - PRIMARY KEY (`id`,`pgw_id`,`users_imsi`), - KEY `fk_pdn_pgw1_idx` (`pgw_id`), - KEY `fk_pdn_users1_idx` (`users_imsi`) -) ENGINE=MyISAM AUTO_INCREMENT=60 DEFAULT CHARSET=latin1; -/*!40101 SET character_set_client = @saved_cs_client */; - --- --- Dumping data for table `pdn` --- - -LOCK TABLES `pdn` WRITE; -/*!40000 ALTER TABLE `pdn` DISABLE KEYS */; -INSERT INTO `pdn` VALUES (1,'oai.ipv4','IPv4','0.0.0.0','0:0:0:0:0:0:0:0',50000000,100000000,3,'208930000000001',9,15,'DISABLED','ENABLED','LIPA-only'),(41,'oai.ipv4','IPv4','0.0.0.0','0:0:0:0:0:0:0:0',50000000,100000000,3,'20834123456789',9,15,'DISABLED','ENABLED','LIPA-only'),(40,'oai.ipv4','IPv4','0.0.0.0','0:0:0:0:0:0:0:0',50000000,100000000,3,'20810000001234',9,15,'DISABLED','ENABLED','LIPA-only'),(42,'oai.ipv4','IPv4','0.0.0.0','0:0:0:0:0:0:0:0',50000000,100000000,3,'31002890832150',9,15,'DISABLED','ENABLED','LIPA-only'),(16,'oai.ipv4','IPv4','0.0.0.0','0:0:0:0:0:0:0:0',50000000,100000000,3,'208950000000002',9,15,'DISABLED','ENABLED','LIPA-only'),(43,'oai.ipv4','IPv4','0.0.0.0','0:0:0:0:0:0:0:0',50000000,100000000,3,'001010123456789',9,15,'DISABLED','ENABLED','LIPA-only'),(2,'oai.ipv4','IPv4','0.0.0.0','0:0:0:0:0:0:0:0',50000000,100000000,3,'208930000000002',9,15,'DISABLED','ENABLED','LIPA-only'),(3,'oai.ipv4','IPv4','0.0.0.0','0:0:0:0:0:0:0:0',50000000,100000000,3,'208930000000003',9,15,'DISABLED','ENABLED','LIPA-only'),(4,'oai.ipv4','IPv4','0.0.0.0','0:0:0:0:0:0:0:0',50000000,100000000,3,'208930000000004',9,15,'DISABLED','ENABLED','LIPA-only'),(5,'oai.ipv4','IPv4','0.0.0.0','0:0:0:0:0:0:0:0',50000000,100000000,3,'208930000000005',9,15,'DISABLED','ENABLED','LIPA-only'),(6,'oai.ipv4','IPv4','0.0.0.0','0:0:0:0:0:0:0:0',50000000,100000000,3,'208930000000006',9,15,'DISABLED','ENABLED','LIPA-only'),(7,'oai.ipv4','IPv4','0.0.0.0','0:0:0:0:0:0:0:0',50000000,100000000,3,'208930000000007',9,15,'DISABLED','ENABLED','LIPA-only'),(8,'oai.ipv4','IPv4','0.0.0.0','0:0:0:0:0:0:0:0',50000000,100000000,3,'208940000000001',9,15,'DISABLED','ENABLED','LIPA-only'),(9,'oai.ipv4','IPv4','0.0.0.0','0:0:0:0:0:0:0:0',50000000,100000000,3,'208940000000002',9,15,'DISABLED','ENABLED','LIPA-only'),(10,'oai.ipv4','IPv4','0.0.0.0','0:0:0:0:0:0:0:0',50000000,100000000,3,'208940000000003',9,15,'DISABLED','ENABLED','LIPA-only'),(11,'oai.ipv4','IPv4','0.0.0.0','0:0:0:0:0:0:0:0',50000000,100000000,3,'208940000000004',9,15,'DISABLED','ENABLED','LIPA-only'),(12,'oai.ipv4','IPv4','0.0.0.0','0:0:0:0:0:0:0:0',50000000,100000000,3,'208940000000005',9,15,'DISABLED','ENABLED','LIPA-only'),(13,'oai.ipv4','IPv4','0.0.0.0','0:0:0:0:0:0:0:0',50000000,100000000,3,'208940000000006',9,15,'DISABLED','ENABLED','LIPA-only'),(14,'oai.ipv4','IPv4','0.0.0.0','0:0:0:0:0:0:0:0',50000000,100000000,3,'208940000000007',9,15,'DISABLED','ENABLED','LIPA-only'),(15,'oai.ipv4','IPv4','0.0.0.0','0:0:0:0:0:0:0:0',50000000,100000000,3,'208950000000001',9,15,'DISABLED','ENABLED','LIPA-only'),(17,'oai.ipv4','IPv4','0.0.0.0','0:0:0:0:0:0:0:0',50000000,100000000,3,'208950000000003',9,15,'DISABLED','ENABLED','LIPA-only'),(18,'oai.ipv4','IPv4','0.0.0.0','0:0:0:0:0:0:0:0',50000000,100000000,3,'208950000000004',9,15,'DISABLED','ENABLED','LIPA-only'),(19,'oai.ipv4','IPv4','0.0.0.0','0:0:0:0:0:0:0:0',50000000,100000000,3,'208950000000005',9,15,'DISABLED','ENABLED','LIPA-only'),(20,'oai.ipv4','IPv4','0.0.0.0','0:0:0:0:0:0:0:0',50000000,100000000,3,'208950000000006',9,15,'DISABLED','ENABLED','LIPA-only'),(21,'oai.ipv4','IPv4','0.0.0.0','0:0:0:0:0:0:0:0',50000000,100000000,3,'208950000000007',9,15,'DISABLED','ENABLED','LIPA-only'),(22,'oai.ipv4','IPv4','0.0.0.0','0:0:0:0:0:0:0:0',50000000,100000000,3,'208920100001100',9,15,'DISABLED','ENABLED','LIPA-only'),(23,'oai.ipv4','IPv4','0.0.0.0','0:0:0:0:0:0:0:0',50000000,100000000,3,'208920100001101',9,15,'DISABLED','ENABLED','LIPA-only'),(24,'oai.ipv4','IPv4','0.0.0.0','0:0:0:0:0:0:0:0',50000000,100000000,3,'208920100001102',9,15,'DISABLED','ENABLED','LIPA-only'),(25,'oai.ipv4','IPv4','0.0.0.0','0:0:0:0:0:0:0:0',50000000,100000000,3,'208920100001103',9,15,'DISABLED','ENABLED','LIPA-only'),(26,'oai.ipv4','IPv4','0.0.0.0','0:0:0:0:0:0:0:0',50000000,100000000,3,'208920100001104',9,15,'DISABLED','ENABLED','LIPA-only'),(27,'oai.ipv4','IPv4','0.0.0.0','0:0:0:0:0:0:0:0',50000000,100000000,3,'208920100001105',9,15,'DISABLED','ENABLED','LIPA-only'),(28,'oai.ipv4','IPv4','0.0.0.0','0:0:0:0:0:0:0:0',50000000,100000000,3,'208920100001106',9,15,'DISABLED','ENABLED','LIPA-only'),(29,'oai.ipv4','IPv4','0.0.0.0','0:0:0:0:0:0:0:0',50000000,100000000,3,'208920100001107',9,15,'DISABLED','ENABLED','LIPA-only'),(30,'oai.ipv4','IPv4','0.0.0.0','0:0:0:0:0:0:0:0',50000000,100000000,3,'208920100001108',9,15,'DISABLED','ENABLED','LIPA-only'),(31,'oai.ipv4','IPv4','0.0.0.0','0:0:0:0:0:0:0:0',50000000,100000000,3,'208920100001109',9,15,'DISABLED','ENABLED','LIPA-only'),(32,'oai.ipv4','IPv4','0.0.0.0','0:0:0:0:0:0:0:0',50000000,100000000,3,'208920100001110',9,15,'DISABLED','ENABLED','LIPA-only'),(33,'oai.ipv4','IPv4','0.0.0.0','0:0:0:0:0:0:0:0',50000000,100000000,3,'208930100001111',9,15,'DISABLED','ENABLED','LIPA-only'),(34,'oai.ipv4','IPv4','0.0.0.0','0:0:0:0:0:0:0:0',50000000,100000000,3,'208930100001112',9,15,'DISABLED','ENABLED','LIPA-only'),(35,'oai.ipv4','IPv4','0.0.0.0','0:0:0:0:0:0:0:0',50000000,100000000,3,'208930100001113',9,15,'DISABLED','ENABLED','LIPA-only'),(44,'operator','IPv4','0.0.0.0','0:0:0:0:0:0:0:0',50000000,100000000,3,'208930100001113',9,15,'DISABLED','ENABLED','LIPA-only'),(45,'operator','IPv4','0.0.0.0','0:0:0:0:0:0:0:0',50000000,100000000,3,'208930100001112',9,15,'DISABLED','ENABLED','LIPA-only'),(46,'operator','IPv4','0.0.0.0','0:0:0:0:0:0:0:0',50000000,100000000,3,'208930100001111',9,15,'DISABLED','ENABLED','LIPA-only'),(47,'operator','IPv4','0.0.0.0','0:0:0:0:0:0:0:0',50000000,100000000,3,'208950000000002',9,15,'DISABLED','ENABLED','LIPA-only'),(48,'oai.ipv4','IPv4','0.0.0.0','0:0:0:0:0:0:0:0',50000000,100000000,3,'208950000000008',9,15,'DISABLED','ENABLED','LIPA-only'),(49,'oai.ipv4','IPv4','0.0.0.0','0:0:0:0:0:0:0:0',50000000,100000000,3,'208950000000009',9,15,'DISABLED','ENABLED','LIPA-only'),(50,'oai.ipv4','IPv4','0.0.0.0','0:0:0:0:0:0:0:0',50000000,100000000,3,'208950000000010',9,15,'DISABLED','ENABLED','LIPA-only'),(51,'oai.ipv4','IPv4','0.0.0.0','0:0:0:0:0:0:0:0',50000000,100000000,3,'208950000000011',9,15,'DISABLED','ENABLED','LIPA-only'),(52,'oai.ipv4','IPv4','0.0.0.0','0:0:0:0:0:0:0:0',50000000,100000000,3,'208950000000012',9,15,'DISABLED','ENABLED','LIPA-only'),(53,'oai.ipv4','IPv4','0.0.0.0','0:0:0:0:0:0:0:0',50000000,100000000,3,'208950000000013',9,15,'DISABLED','ENABLED','LIPA-only'),(54,'oai.ipv4','IPv4','0.0.0.0','0:0:0:0:0:0:0:0',50000000,100000000,3,'208950000000014',9,15,'DISABLED','ENABLED','LIPA-only'),(55,'oai.ipv4','IPv4','0.0.0.0','0:0:0:0:0:0:0:0',50000000,100000000,3,'208950000000015',9,15,'DISABLED','ENABLED','LIPA-only'),(56,'oai.ipv4','IPv4','0.0.0.0','0:0:0:0:0:0:0:0',50000000,100000000,3,'208920100001118',9,15,'DISABLED','ENABLED','LIPA-only'),(57,'oai.ipv4','IPv4','0.0.0.0','0:0:0:0:0:0:0:0',50000000,100000000,3,'208920100001121',9,15,'DISABLED','ENABLED','LIPA-only'),(58,'oai.ipv4','IPv4','0.0.0.0','0:0:0:0:0:0:0:0',50000000,100000000,3,'208920100001120',9,15,'DISABLED','ENABLED','LIPA-only'),(59,'oai.ipv4','IPv4','0.0.0.0','0:0:0:0:0:0:0:0',50000000,100000000,3,'208920100001119',9,15,'DISABLED','ENABLED','LIPA-only'); -/*!40000 ALTER TABLE `pdn` ENABLE KEYS */; -UNLOCK TABLES; - --- --- Table structure for table `pgw` --- - -DROP TABLE IF EXISTS `pgw`; -/*!40101 SET @saved_cs_client = @@character_set_client */; -/*!40101 SET character_set_client = utf8 */; -CREATE TABLE `pgw` ( - `id` int(11) NOT NULL AUTO_INCREMENT, - `ipv4` varchar(15) NOT NULL, - `ipv6` varchar(39) NOT NULL, - PRIMARY KEY (`id`), - UNIQUE KEY `ipv4` (`ipv4`), - UNIQUE KEY `ipv6` (`ipv6`) -) ENGINE=MyISAM AUTO_INCREMENT=4 DEFAULT CHARSET=latin1; -/*!40101 SET character_set_client = @saved_cs_client */; - --- --- Dumping data for table `pgw` --- - -LOCK TABLES `pgw` WRITE; -/*!40000 ALTER TABLE `pgw` DISABLE KEYS */; -INSERT INTO `pgw` VALUES (1,'127.0.0.1','0:0:0:0:0:0:0:1'),(2,'192.168.56.101',''),(3,'10.0.0.2','0'); -/*!40000 ALTER TABLE `pgw` ENABLE KEYS */; -UNLOCK TABLES; - --- --- Table structure for table `terminal-info` --- - -DROP TABLE IF EXISTS `terminal-info`; -/*!40101 SET @saved_cs_client = @@character_set_client */; -/*!40101 SET character_set_client = utf8 */; -CREATE TABLE `terminal-info` ( - `imei` varchar(15) NOT NULL, - `sv` varchar(2) NOT NULL, - UNIQUE KEY `imei` (`imei`) -) ENGINE=InnoDB DEFAULT CHARSET=latin1; -/*!40101 SET character_set_client = @saved_cs_client */; - --- --- Dumping data for table `terminal-info` --- - -LOCK TABLES `terminal-info` WRITE; -/*!40000 ALTER TABLE `terminal-info` DISABLE KEYS */; -/*!40000 ALTER TABLE `terminal-info` ENABLE KEYS */; -UNLOCK TABLES; - --- --- Table structure for table `users` --- - -DROP TABLE IF EXISTS `users`; -/*!40101 SET @saved_cs_client = @@character_set_client */; -/*!40101 SET character_set_client = utf8 */; -CREATE TABLE `users` ( - `imsi` varchar(15) NOT NULL COMMENT 'IMSI is the main reference key.', - `msisdn` varchar(46) DEFAULT NULL COMMENT 'The basic MSISDN of the UE (Presence of MSISDN is optional).', - `imei` varchar(15) DEFAULT NULL COMMENT 'International Mobile Equipment Identity', - `imei_sv` varchar(2) DEFAULT NULL COMMENT 'International Mobile Equipment Identity Software Version Number', - `ms_ps_status` enum('PURGED','NOT_PURGED') DEFAULT 'PURGED' COMMENT 'Indicates that ESM and EMM status are purged from MME', - `rau_tau_timer` int(10) unsigned DEFAULT '120', - `ue_ambr_ul` bigint(20) unsigned DEFAULT '50000000' COMMENT 'The Maximum Aggregated uplink MBRs to be shared across all Non-GBR bearers according to the subscription of the user.', - `ue_ambr_dl` bigint(20) unsigned DEFAULT '100000000' COMMENT 'The Maximum Aggregated downlink MBRs to be shared across all Non-GBR bearers according to the subscription of the user.', - `access_restriction` int(10) unsigned DEFAULT '60' COMMENT 'Indicates the access restriction subscription information. 3GPP TS.29272 #7.3.31', - `mme_cap` int(10) unsigned zerofill DEFAULT NULL COMMENT 'Indicates the capabilities of the MME with respect to core functionality e.g. regional access restrictions.', - `mmeidentity_idmmeidentity` int(11) NOT NULL DEFAULT '0', - `key` varbinary(16) NOT NULL DEFAULT '0' COMMENT 'UE security key', - `RFSP-Index` smallint(5) unsigned NOT NULL DEFAULT '1' COMMENT 'An index to specific RRM configuration in the E-UTRAN. Possible values from 1 to 256', - `urrp_mme` tinyint(1) NOT NULL DEFAULT '0' COMMENT 'UE Reachability Request Parameter indicating that UE activity notification from MME has been requested by the HSS.', - `sqn` bigint(20) unsigned zerofill NOT NULL, - `rand` varbinary(16) NOT NULL, - `OPc` varbinary(16) DEFAULT NULL COMMENT 'Can be computed by HSS', - PRIMARY KEY (`imsi`,`mmeidentity_idmmeidentity`), - KEY `fk_users_mmeidentity_idx1` (`mmeidentity_idmmeidentity`) -) ENGINE=MyISAM DEFAULT CHARSET=latin1; -/*!40101 SET character_set_client = @saved_cs_client */; - --- --- Dumping data for table `users` --- - -LOCK TABLES `users` WRITE; -/*!40000 ALTER TABLE `users` DISABLE KEYS */; -INSERT INTO `users` VALUES ('20834123456789','380561234567','35609204079300',NULL,'PURGED',50,40000000,100000000,47,0000000000,1,'+�E��ų\0�,IH��H',0,0,00000000000000000096,'Px�X \Z1��x��','^��K�����FeU���'),('20810000001234','33611123456','35609204079299',NULL,'PURGED',120,40000000,100000000,47,0000000000,1,'��G?/�Д���� |hb',1,0,00000281454575616225,'\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0','�4�s@���z��~�'),('31002890832150','33638060059','35611302209414',NULL,'PURGED',120,40000000,100000000,47,0000000000,1,'��G?/�Д���� |hb',1,0,00000000000000012416,'`�F�݆��D��ϛ���','�4�s@���z��~�'),('001010123456789','33600101789','35609204079298',NULL,'PURGED',120,50000000,100000000,47,0000000000,1,'\0 \n \r',1,0,00000000000000000351,'\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0','L�*\\�����^��]� '),('208930000000001','33638030001','35609204079301',NULL,'PURGED',120,50000000,100000000,47,0000000000,1,'��G?/�Д���� |hb',1,0,00000000000000006103,'��wq��gzW�Ё��Z]','�4�s@���z��~�'),('208950000000002','33638050002','35609204079502',NULL,'PURGED',120,50000000,100000000,47,0000000000,1,'��G?/�Д���� |hb',1,0,00000000000000020471,'\0 \n \r','�4�s@���z��~�'),('208950000000003','33638050003','35609204079503',NULL,'PURGED',120,50000000,100000000,47,0000000000,1,'��G?/�Д���� |hb',1,0,00000000000000012343,'\0 \n \r','�4�s@���z��~�'),('208950000000004','33638050004','35609204079504',NULL,'PURGED',120,50000000,100000000,47,0000000000,1,'��G?/�Д���� |hb',1,0,00000000000000012215,'56f0261d9d051063','�4�s@���z��~�'),('208950000000005','33638050005','35609204079505',NULL,'PURGED',120,50000000,100000000,47,0000000000,1,'��G?/�Д���� |hb',1,0,00000000000000012215,'56f0261d9d051063','�4�s@���z��~�'),('208950000000001','33638050001','35609204079501',NULL,'PURGED',120,50000000,100000000,47,0000000000,1,'��G?/�Д���� |hb',1,0,00000000000000006103,'��wq��gzW�Ё��Z]','�4�s@���z��~�'),('208950000000006','33638050006','35609204079506',NULL,'PURGED',120,50000000,100000000,47,0000000000,1,'��G?/�Д���� |hb',1,0,00000000000000012215,'56f0261d9d051063','�4�s@���z��~�'),('208950000000007','33638050007','35609204079507',NULL,'PURGED',120,50000000,100000000,47,0000000000,1,'��G?/�Д���� |hb',1,0,00000000000000012215,'56f0261d9d051063','�4�s@���z��~�'),('208930000000002','33638030002','35609204079302',NULL,'PURGED',120,50000000,100000000,47,0000000000,1,'��G?/�Д���� |hb',1,0,00000000000000006103,'��wq��gzW�Ё��Z]','�4�s@���z��~�'),('208930000000003','33638030003','35609204079303',NULL,'PURGED',120,50000000,100000000,47,0000000000,1,'��G?/�Д���� |hb',1,0,00000000000000006103,'��wq��gzW�Ё��Z]','�4�s@���z��~�'),('208930000000004','33638030004','35609204079304',NULL,'PURGED',120,50000000,100000000,47,0000000000,1,'��G?/�Д���� |hb',1,0,00000000000000006103,'��wq��gzW�Ё��Z]','�4�s@���z��~�'),('208930000000005','33638030005','35609204079305',NULL,'PURGED',120,50000000,100000000,47,0000000000,1,'��G?/�Д���� |hb',1,0,00000000000000006103,'��wq��gzW�Ё��Z]','�4�s@���z��~�'),('208930000000006','33638030006','35609204079306',NULL,'PURGED',120,50000000,100000000,47,0000000000,1,'��G?/�Д���� |hb',1,0,00000000000000006103,'��wq��gzW�Ё��Z]','�4�s@���z��~�'),('208930000000007','33638030007','35609204079307',NULL,'PURGED',120,50000000,100000000,47,0000000000,1,'��G?/�Д���� |hb',1,0,00000000000000006103,'��wq��gzW�Ё��Z]','�4�s@���z��~�'),('208940000000007','33638040007','35609204079407',NULL,'PURGED',120,50000000,100000000,47,0000000000,1,'��G?/�Д���� |hb',1,0,00000000000000006103,'��wq��gzW�Ё��Z]','�4�s@���z��~�'),('208940000000006','33638040006','35609204079406',NULL,'PURGED',120,50000000,100000000,47,0000000000,1,'��G?/�Д���� |hb',1,0,00000000000000006103,'��wq��gzW�Ё��Z]','�4�s@���z��~�'),('208940000000005','33638040005','35609204079405',NULL,'PURGED',120,50000000,100000000,47,0000000000,1,'��G?/�Д���� |hb',1,0,00000000000000006103,'��wq��gzW�Ё��Z]','�4�s@���z��~�'),('208940000000004','33638040004','35609204079404',NULL,'PURGED',120,50000000,100000000,47,0000000000,1,'��G?/�Д���� |hb',1,0,00000000000000006103,'��wq��gzW�Ё��Z]','�4�s@���z��~�'),('208940000000003','33638040003','35609204079403',NULL,'PURGED',120,50000000,100000000,47,0000000000,1,'��G?/�Д���� |hb',1,0,00000000000000006103,'��wq��gzW�Ё��Z]','�4�s@���z��~�'),('208940000000002','33638040002','35609204079402',NULL,'PURGED',120,50000000,100000000,47,0000000000,1,'��G?/�Д���� |hb',1,0,00000000000000006103,'��wq��gzW�Ё��Z]','�4�s@���z��~�'),('208940000000001','33638040001','35609204079401',NULL,'PURGED',120,50000000,100000000,47,0000000000,1,'��G?/�Д���� |hb',1,0,00000000000000006103,'��wq��gzW�Ё��Z]','�4�s@���z��~�'),('208920100001100','33638020001','35609204079201',NULL,'PURGED',120,50000000,100000000,47,0000000000,1,'��G?/�Д���� |hb',1,0,00000000000000006103,'ebd07771ace8677a','�4�s@���z��~�'),('208920100001101','33638020001','35609204079201',NULL,'NOT_PURGED',120,50000000,100000000,47,0000000000,1,'��k��p~Љu{�K�',1,0,00000281044204937234,'\0 \n \r','�$I6;��+f�k�u�|�'),('208920100001102','33638020002','35609204079202',NULL,'PURGED',120,50000000,100000000,47,0000000000,1,'��G?/�Д���� |hb',1,0,00000000000000006103,'ebd07771ace8677a','�4�s@���z��~�'),('208920100001103','33638020003','35609204079203',NULL,'PURGED',120,50000000,100000000,47,0000000000,1,'��G?/�Д���� |hb',1,0,00000000000000006103,'ebd07771ace8677a','�4�s@���z��~�'),('208920100001104','33638020004','35609204079204',NULL,'PURGED',120,50000000,100000000,47,0000000000,1,'��G?/�Д���� |hb',1,0,00000000000000006103,'ebd07771ace8677a','�4�s@���z��~�'),('208920100001105','33638020005','35609204079205',NULL,'PURGED',120,50000000,100000000,47,0000000000,1,'��G?/�Д���� |hb',1,0,00000000000000006103,'ebd07771ace8677a','�4�s@���z��~�'),('208920100001106','33638020006','35609204079206',NULL,'PURGED',120,50000000,100000000,47,0000000000,1,'��k��p~Љu{�K�',1,0,00000000000000006103,'ebd07771ace8677a','�$I6;��+f�k�u�|�'),('208920100001107','33638020007','35609204079207',NULL,'PURGED',120,50000000,100000000,47,0000000000,1,'��G?/�Д���� |hb',1,0,00000000000000006103,'ebd07771ace8677a','�4�s@���z��~�'),('208920100001108','33638020008','35609204079208',NULL,'PURGED',120,50000000,100000000,47,0000000000,1,'��G?/�Д���� |hb',1,0,00000000000000006103,'ebd07771ace8677a','�4�s@���z��~�'),('208920100001109','33638020009','35609204079209',NULL,'PURGED',120,50000000,100000000,47,0000000000,1,'��G?/�Д���� |hb',1,0,00000000000000006103,'ebd07771ace8677a','�4�s@���z��~�'),('208920100001110','33638020010','35609204079210',NULL,'PURGED',120,50000000,100000000,47,0000000000,1,'��G?/�Д���� |hb',1,0,00000000000000006103,'ebd07771ace8677a','�4�s@���z��~�'),('208930100001111','33638030011','35609304079211',NULL,'PURGED',120,50000000,100000000,47,0000000000,1,'��G?/�Д���� |hb',1,0,00000000000000006103,'ebd07771ace8677a','�4�s@���z��~�'),('208930100001112','33638030012','35609304079212',NULL,'PURGED',120,50000000,100000000,47,0000000000,1,'��G?/�Д���� |hb',1,0,00000000000000006103,'ebd07771ace8677a','�4�s@���z��~�'),('208930100001113','33638030013','35609304079213',NULL,'PURGED',120,50000000,100000000,47,0000000000,1,'��G?/�Д���� |hb',1,0,00000000000000006263,'�SNܒ�Iv��e�6','�4�s@���z��~�'),('208950000000008','33638050008','35609204079508',NULL,'PURGED',120,50000000,100000000,47,0000000000,1,'��G?/�Д���� |hb',1,0,00000000000000012215,'56f0261d9d051063','�4�s@���z��~�'),('208950000000009','33638050009','35609204079509',NULL,'PURGED',120,50000000,100000000,47,0000000000,1,'��G?/�Д���� |hb',1,0,00000000000000012215,'56f0261d9d051063','�4�s@���z��~�'),('208950000000010','33638050010','35609204079510',NULL,'PURGED',120,50000000,100000000,47,0000000000,1,'��G?/�Д���� |hb',1,0,00000000000000012215,'56f0261d9d051063','�4�s@���z��~�'),('208950000000011','33638050011','35609204079511',NULL,'PURGED',120,50000000,100000000,47,0000000000,1,'��G?/�Д���� |hb',1,0,00000000000000012215,'56f0261d9d051063','�4�s@���z��~�'),('208950000000012','33638050012','35609204079512',NULL,'PURGED',120,50000000,100000000,47,0000000000,1,'��G?/�Д���� |hb',1,0,00000000000000012215,'56f0261d9d051063','�4�s@���z��~�'),('208950000000013','33638050013','35609204079513',NULL,'PURGED',120,50000000,100000000,47,0000000000,1,'��G?/�Д���� |hb',1,0,00000000000000012215,'56f0261d9d051063','�4�s@���z��~�'),('208950000000014','33638050014','35609204079514',NULL,'PURGED',120,50000000,100000000,47,0000000000,1,'��G?/�Д���� |hb',1,0,00000000000000012215,'56f0261d9d051063','�4�s@���z��~�'),('208950000000015','33638050015','35609204079515',NULL,'PURGED',120,50000000,100000000,47,0000000000,1,'��G?/�Д���� |hb',1,0,00000000000000000000,'3536663032363164','�4�s@���z��~�'),('208920100001118','33638020010','35609204079210',NULL,'NOT_PURGED',120,50000000,100000000,47,0000000000,1,'��k��p~Љu{�K�',1,0,00000281044204934762,'~?03�u-%�ey�y�','�$I6;��+f�k�u�|�'),('208920100001121','33638020010','35609204079210',NULL,'NOT_PURGED',120,50000000,100000000,47,0000000000,1,'��k��p~Љu{�K�',1,0,00000281044204935293,'&��@xg�]���\n��Vp','�$I6;��+f�k�u�|�'),('208920100001119','33638020010','35609204079210',NULL,'NOT_PURGED',120,50000000,100000000,47,0000000000,1,'��k��p~Љu{�K�',1,0,00000281044204935293,'269482407867805d','�$I6;��+f�k�u�|�'),('208920100001120','33638020010','35609204079210',NULL,'NOT_PURGED',120,50000000,100000000,47,0000000000,1,'��k��p~Љu{�K�',1,0,00000281044204935293,'3236393438323430','�$I6;��+f�k�u�|�'); -INSERT INTO `users` VALUES ('208990100001100','1','55000000000000',NULL,'PURGED',50,40000000,100000000,47,0000000000,1,0xfec86ba6eb707ed08905757b1bb44b8f,0,0,0x40,'ebd07771ace8677a',0xc42449363bbad02b66d16bc975d77cc1); -INSERT INTO `users` VALUES ('208950000000031','380561234567','55000000000001',NULL,'PURGED',50,40000000,100000000,47,0000000000,1,0x0C0A34601D4F07677303652C0462535B,0,0,0x40,'ebd07771ace8677a',0x63bfa50ee6523365ff14c1f45f88737d); -INSERT INTO `users` VALUES ('208950000000032','380561234567','55000000000001',NULL,'PURGED',50,40000000,100000000,47,0000000000,1,0x0C0A34601D4F07677303652C0462535B,0,0,0x40,'ebd07771ace8677a',0x63bfa50ee6523365ff14c1f45f88737d); -INSERT INTO `users` VALUES ('208950000000033','380561234567','55000000000001',NULL,'PURGED',50,40000000,100000000,47,0000000000,1,0x0C0A34601D4F07677303652C0462535B,0,0,0x40,'ebd07771ace8677a',0x63bfa50ee6523365ff14c1f45f88737d); -INSERT INTO `users` VALUES ('208950000000034','380561234567','55000000000001',NULL,'PURGED',50,40000000,100000000,47,0000000000,1,0x0C0A34601D4F07677303652C0462535B,0,0,0x40,'ebd07771ace8677a',0x63bfa50ee6523365ff14c1f45f88737d); -INSERT INTO `users` VALUES ('208950000000035','380561234567','55000000000001',NULL,'PURGED',50,40000000,100000000,47,0000000000,1,0x0C0A34601D4F07677303652C0462535B,0,0,0x40,'ebd07771ace8677a',0x63bfa50ee6523365ff14c1f45f88737d); -INSERT INTO `users` VALUES ('208950000000036','380561234567','55000000000001',NULL,'PURGED',50,40000000,100000000,47,0000000000,1,0x0C0A34601D4F07677303652C0462535B,0,0,0x40,'ebd07771ace8677a',0x63bfa50ee6523365ff14c1f45f88737d); -INSERT INTO `users` VALUES ('208950000000037','380561234567','55000000000001',NULL,'PURGED',50,40000000,100000000,47,0000000000,1,0x0C0A34601D4F07677303652C0462535B,0,0,0x40,'ebd07771ace8677a',0x63bfa50ee6523365ff14c1f45f88737d); -INSERT INTO `users` VALUES ('208950000000038','380561234567','55000000000001',NULL,'PURGED',50,40000000,100000000,47,0000000000,1,0x0C0A34601D4F07677303652C0462535B,0,0,0x40,'ebd07771ace8677a',0x63bfa50ee6523365ff14c1f45f88737d); -INSERT INTO `users` VALUES ('208950000000039','380561234567','55000000000001',NULL,'PURGED',50,40000000,100000000,47,0000000000,1,0x0C0A34601D4F07677303652C0462535B,0,0,0x40,'ebd07771ace8677a',0x63bfa50ee6523365ff14c1f45f88737d); -INSERT INTO `users` VALUES ('208950000000040','380561234567','55000000000001',NULL,'PURGED',50,40000000,100000000,47,0000000000,1,0x0C0A34601D4F07677303652C0462535B,0,0,0x40,'ebd07771ace8677a',0x63bfa50ee6523365ff14c1f45f88737d); -/*!40000 ALTER TABLE `users` ENABLE KEYS */; -UNLOCK TABLES; -/*!40103 SET TIME_ZONE=@OLD_TIME_ZONE */; - -/*!40101 SET SQL_MODE=@OLD_SQL_MODE */; -/*!40014 SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS */; -/*!40014 SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS */; -/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */; -/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */; -/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */; -/*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */; - --- Dump completed on 2016-06-28 11:41:40 diff --git a/ci-scripts/yaml_files/5g_fdd_rfsimulator/smf-healthcheck.sh b/ci-scripts/yaml_files/5g_fdd_rfsimulator/smf-healthcheck.sh deleted file mode 100755 index d9ff7608e8..0000000000 --- a/ci-scripts/yaml_files/5g_fdd_rfsimulator/smf-healthcheck.sh +++ /dev/null @@ -1,21 +0,0 @@ -#!/bin/bash -set -eo pipefail - -STATUS=0 -SMF_IP_SBI_INTERFACE=$(ifconfig $SMF_INTERFACE_NAME_FOR_SBI | grep inet | awk {'print $2'}) -SMF_SBI_PORT_STATUS=$(netstat -tnpl | grep -o "$SMF_IP_SBI_INTERFACE:$SMF_INTERFACE_PORT_FOR_SBI") - -#Check if entrypoint properly configured the conf file and no parameter is unset(optional) -#NB_UNREPLACED_AT=`cat /openair-smf/etc/*.conf | grep -v contact@openairinterface.org | grep -c @ || true` - -#if [ $NB_UNREPLACED_AT -ne 0 ]; then -# STATUS=-1 -# echo "Healthcheck error: UNHEALTHY configuration file is not configured properly" -#fi -# -if [[ -z $SMF_SBI_PORT_STATUS ]]; then - STATUS=-1 - echo "Healthcheck error: UNHEALTHY SBI TCP/HTTP port $SMF_INTERFACE_PORT_FOR_SBI is not listening." -fi - -exit $STATUS diff --git a/ci-scripts/yaml_files/5g_fdd_rfsimulator/spgwu-healthcheck.sh b/ci-scripts/yaml_files/5g_fdd_rfsimulator/spgwu-healthcheck.sh deleted file mode 100755 index 0e3b67ee7e..0000000000 --- a/ci-scripts/yaml_files/5g_fdd_rfsimulator/spgwu-healthcheck.sh +++ /dev/null @@ -1,28 +0,0 @@ -#!/bin/bash -set -eo pipefail - -STATUS=0 -SGW_PORT_FOR_S1U_S12_S4_UP=2152 -SGW_PORT_FOR_SX=8805 -SGW_IP_S1U_INTERFACE=$(ifconfig $SGW_INTERFACE_NAME_FOR_S1U_S12_S4_UP | grep inet | awk {'print $2'}) -SGW_IP_SX_INTERFACE=$(ifconfig $SGW_INTERFACE_NAME_FOR_SX | grep inet | awk {'print $2'}) -S1U_S12_S4_UP_PORT_STATUS=$(netstat -unpl | grep -o "$SGW_IP_S1U_INTERFACE:$SGW_PORT_FOR_S1U_S12_S4_UP") -SX_PORT_STATUS=$(netstat -unpl | grep -o "$SGW_IP_SX_INTERFACE:$SGW_PORT_FOR_SX") -#Check if entrypoint properly configured the conf file and no parameter is unset (optional) -NB_UNREPLACED_AT=`cat /openair-spgwu/etc/*.conf | grep -v contact@openairinterface.org | grep -c @ || true` -if [ $NB_UNREPLACED_AT -ne 0 ]; then - STATUS=1 - echo "Healthcheck error: UNHEALTHY configuration file is not configured properly" -fi - -if [[ -z $S1U_S12_S4_UP_PORT_STATUS ]]; then - STATUS=1 - echo "Healthcheck error: UNHEALTHY S1U port $SGW_PORT_FOR_S1U_S12_S4_UP is not listening." -fi - -if [[ -z $SX_PORT_STATUS ]]; then - STATUS=1 - echo "Healthcheck error: UNHEALTHY SX port $SGW_PORT_FOR_SX is not listening." -fi - -exit $STATUS \ No newline at end of file diff --git a/ci-scripts/yaml_files/5g_rfsimulator/README.md b/ci-scripts/yaml_files/5g_rfsimulator/README.md index 4efd2714b4..5807081155 100644 --- a/ci-scripts/yaml_files/5g_rfsimulator/README.md +++ b/ci-scripts/yaml_files/5g_rfsimulator/README.md @@ -37,10 +37,9 @@ Now pull images. ```bash $ docker pull mysql:8.0 -$ docker pull oaisoftwarealliance/oai-amf:v1.5.0 -$ docker pull oaisoftwarealliance/oai-nrf:v1.5.0 -$ docker pull oaisoftwarealliance/oai-smf:v1.5.0 -$ docker pull oaisoftwarealliance/oai-spgwu-tiny:v1.5.0 +$ docker pull oaisoftwarealliance/oai-amf:v2.0.0 +$ docker pull oaisoftwarealliance/oai-smf:v2.0.0 +$ docker pull oaisoftwarealliance/oai-upf:v2.0.0 $ docker pull oaisoftwarealliance/trf-gen-cn5g:focal $ docker pull oaisoftwarealliance/oai-gnb:develop @@ -53,7 +52,7 @@ $ docker logout **CAUTION: 2023/01/27 with the release `v1.5.0` of the `CN5G`, the previous version was not compatible any-more.** -**This new version is working only with the `v1.5.0` of the `CN5G`.** +**This new version is working only with the `v2.0.0` of the `CN5G`.** # 2. Deploy containers # @@ -72,12 +71,11 @@ For a deployment with the gNB split in CU-CP, CU-UP, and DU components, please r ```bash $ cd ci-scripts/yaml_files/5g_rfsimulator -$ docker-compose up -d mysql oai-nrf oai-amf oai-smf oai-spgwu oai-ext-dn +$ docker-compose up -d mysql oai-amf oai-smf oai-upf oai-ext-dn Creating network "rfsim5g-oai-public-net" with driver "bridge" Creating network "rfsim5g-oai-traffic_net-net" with driver "bridge" -Creating rfsim5g-oai-nrf ... done Creating rfsim5g-mysql ... done -Creating rfsim5g-oai-spgwu ... done +Creating rfsim5g-oai-upf ... done Creating rfsim5g-oai-amf ... done Creating rfsim5g-oai-smf ... done Creating rfsim5g-oai-ext-dn ... done @@ -87,20 +85,19 @@ Wait for a bit. ```bash $ docker-compose ps -a - Name Command State Ports + Name Command State Ports ------------------------------------------------------------------------------------------------- -rfsim5g-mysql docker-entrypoint.sh mysqld Up (healthy) 3306/tcp, 33060/tcp +rfsim5g-mysql docker-entrypoint.sh mysqld Up (healthy) 3306/tcp, 33060/tcp rfsim5g-oai-amf /bin/bash /openair-amf/bin ... Up (healthy) 38412/sctp, 80/tcp, 9090/tcp -rfsim5g-oai-ext-dn /bin/bash -c apt update; ... Up (healthy) -rfsim5g-oai-nrf /bin/bash /openair-nrf/bin ... Up (healthy) 80/tcp, 9090/tcp -rfsim5g-oai-smf /bin/bash -c /openair-smf/ ... Up (healthy) 80/tcp, 8805/udp, 9090/tcp -rfsim5g-oai-spgwu /openair-spgwu-tiny/bin/en ... Up (healthy) 2152/udp, 8805/udp +rfsim5g-oai-ext-dn /bin/bash -c apt update; ... Up (healthy) +rfsim5g-oai-smf /bin/bash -c /openair-smf/ ... Up (healthy) 80/tcp, 8805/udp, 9090/tcp +rfsim5g-oai-upf /bin/bash -c /openair-upf/ ... Up (healthy) 2152/udp, 8805/udp ``` At this point, you can prepare a capture on the newly-created public docker bridges: ```bash -$ ifconfig +$ ifconfig ... rfsim5g-public: flags=4163 mtu 1500 inet 192.168.71.129 netmask 255.255.255.192 broadcast 192.168.71.191 @@ -131,8 +128,7 @@ The gNB can be deployed either in monolithic mode, or in CU/DU split mode. ```bash $ docker-compose up -d oai-gnb -rfsim5g-oai-nrf is up-to-date -rfsim5g-oai-spgwu is up-to-date +rfsim5g-oai-upf is up-to-date rfsim5g-oai-ext-dn is up-to-date Creating rfsim5g-oai-gnb ... done ``` @@ -150,15 +146,14 @@ Wait for a bit. ```bash $ docker-compose ps -a - Name Command State Ports + Name Command State Ports ------------------------------------------------------------------------------------------------- -rfsim5g-mysql docker-entrypoint.sh mysqld Up (healthy) 3306/tcp, 33060/tcp +rfsim5g-mysql docker-entrypoint.sh mysqld Up (healthy) 3306/tcp, 33060/tcp rfsim5g-oai-amf /bin/bash /openair-amf/bin ... Up (healthy) 38412/sctp, 80/tcp, 9090/tcp -rfsim5g-oai-ext-dn /bin/bash -c apt update; ... Up (healthy) -rfsim5g-oai-gnb /opt/oai-gnb/bin/entrypoin ... Up (healthy) -rfsim5g-oai-nrf /bin/bash /openair-nrf/bin ... Up (healthy) 80/tcp, 9090/tcp -rfsim5g-oai-smf /bin/bash -c /openair-smf/ ... Up (healthy) 80/tcp, 8805/udp, 9090/tcp -rfsim5g-oai-spgwu /openair-spgwu-tiny/bin/en ... Up (healthy) 2152/udp, 8805/udp +rfsim5g-oai-ext-dn /bin/bash -c apt update; ... Up (healthy) +rfsim5g-oai-gnb /opt/oai-gnb/bin/entrypoin ... Up (healthy) +rfsim5g-oai-smf /bin/bash -c /openair-smf/ ... Up (healthy) 80/tcp, 8805/udp, 9090/tcp +rfsim5g-oai-upf /bin/bash -c /openair-upf/ ... Up (healthy) 2152/udp, 8805/udp ``` You can verify that the `gNB` is connected with the `AMF`: @@ -178,10 +173,9 @@ $ docker logs rfsim5g-oai-amf ```bash $ docker-compose up -d oai-nr-ue rfsim5g-mysql is up-to-date -rfsim5g-oai-nrf is up-to-date rfsim5g-oai-amf is up-to-date rfsim5g-oai-smf is up-to-date -rfsim5g-oai-spgwu is up-to-date +rfsim5g-oai-upf is up-to-date rfsim5g-oai-ext-dn is up-to-date rfsim5g-oai-gnb is up-to-date Creating rfsim5g-oai-nr-ue ... done @@ -191,23 +185,22 @@ Wait for a bit. ```bash $ docker-compose ps -a - Name Command State Ports + Name Command State Ports ------------------------------------------------------------------------------------------------- -rfsim5g-mysql docker-entrypoint.sh mysqld Up (healthy) 3306/tcp, 33060/tcp +rfsim5g-mysql docker-entrypoint.sh mysqld Up (healthy) 3306/tcp, 33060/tcp rfsim5g-oai-amf /bin/bash /openair-amf/bin ... Up (healthy) 38412/sctp, 80/tcp, 9090/tcp -rfsim5g-oai-ext-dn /bin/bash -c apt update; ... Up (healthy) -rfsim5g-oai-gnb /opt/oai-gnb/bin/entrypoin ... Up (healthy) -rfsim5g-oai-nr-ue /opt/oai-nr-ue/bin/entrypo ... Up (healthy) -rfsim5g-oai-nrf /bin/bash /openair-nrf/bin ... Up (healthy) 80/tcp, 9090/tcp -rfsim5g-oai-smf /bin/bash -c /openair-smf/ ... Up (healthy) 80/tcp, 8805/udp, 9090/tcp -rfsim5g-oai-spgwu /openair-spgwu-tiny/bin/en ... Up (healthy) 2152/udp, 8805/udp +rfsim5g-oai-ext-dn /bin/bash -c apt update; ... Up (healthy) +rfsim5g-oai-gnb /opt/oai-gnb/bin/entrypoin ... Up (healthy) +rfsim5g-oai-nr-ue /opt/oai-nr-ue/bin/entrypo ... Up (healthy) +rfsim5g-oai-smf /bin/bash -c /openair-smf/ ... Up (healthy) 80/tcp, 8805/udp, 9090/tcp +rfsim5g-oai-upf /bin/bash -c /openair-upf/ ... Up (healthy) 2152/udp, 8805/udp ``` Making sure the OAI UE is connected: ```bash $ docker exec -it rfsim5g-oai-nr-ue /bin/bash -root@bb4d400a832d:/opt/oai-nr-ue# ifconfig +root@bb4d400a832d:/opt/oai-nr-ue# ifconfig eth0: flags=4163 mtu 1500 inet 192.168.71.150 netmask 255.255.255.192 broadcast 192.168.71.191 ether 02:42:c0:a8:47:89 txqueuelen 0 (Ethernet) @@ -266,10 +259,9 @@ Create the entry for the second UE in `docker-compose.yaml` file as follows: ```bash $ docker-compose up -d oai-nr-ue2 rfsim5g-mysql is up-to-date -rfsim5g-oai-nrf is up-to-date rfsim5g-oai-amf is up-to-date rfsim5g-oai-smf is up-to-date -rfsim5g-oai-spgwu is up-to-date +rfsim5g-oai-upf is up-to-date rfsim5g-oai-ext-dn is up-to-date rfsim5g-oai-gnb is up-to-date Creating rfsim5g-oai-nr-ue2 ... done @@ -279,7 +271,7 @@ Wait for a bit. ```bash $ docker-compose ps -a - Name Command State Ports + Name Command State Ports ------------------------------------------------------------------------------------------------- rfsim5g-mysql docker-entrypoint.sh mysqld Up (healthy) 3306/tcp, 33060/tcp rfsim5g-oai-amf /bin/bash /openair-amf/bin ... Up (healthy) 38412/sctp, 80/tcp, 9090/tcp @@ -287,16 +279,15 @@ rfsim5g-oai-ext-dn /bin/bash -c apt update; ... Up (healthy) rfsim5g-oai-gnb /opt/oai-gnb/bin/entrypoin ... Up (healthy) rfsim5g-oai-nr-ue /opt/oai-nr-ue/bin/entrypo ... Up (healthy) rfsim5g-oai-nr-ue2 /opt/oai-nr-ue/bin/entrypo ... Up (healthy) -rfsim5g-oai-nrf /bin/bash /openair-nrf/bin ... Up (healthy) 80/tcp, 9090/tcp rfsim5g-oai-smf /bin/bash /openair-smf/bin ... Up (healthy) 80/tcp, 8805/udp, 9090/tcp -rfsim5g-oai-spgwu /openair-spgwu-tiny/bin/en ... Up (healthy) 2152/udp, 8805/udp +rfsim5g-oai-upf /bin/bash /openair-upf/bin ... Up (healthy) 2152/udp, 8805/udp ``` Making sure the Second OAI UE is connected: ```bash $ docker exec -it rfsim5g-oai-nr-ue2 /bin/bash -root@bb4d400a832d:/opt/oai-nr-ue# ifconfig +root@bb4d400a832d:/opt/oai-nr-ue# ifconfig eth0: flags=4163 mtu 1500 inet 192.168.71.151 netmask 255.255.255.192 broadcast 192.168.71.191 ether 02:42:c0:a8:47:8a txqueuelen 0 (Ethernet) @@ -458,19 +449,17 @@ Stopping rfsim5g-oai-nr-ue2 ... done Stopping rfsim5g-oai-nr-ue ... done Stopping rfsim5g-oai-gnb ... done Stopping rfsim5g-oai-ext-dn ... done -Stopping rfsim5g-oai-spgwu ... done +Stopping rfsim5g-oai-upf ... done Stopping rfsim5g-oai-smf ... done Stopping rfsim5g-oai-amf ... done -Stopping rfsim5g-oai-nrf ... done Stopping rfsim5g-mysql ... done Removing rfsim5g-oai-nr-ue2 ... done Removing rfsim5g-oai-nr-ue ... done Removing rfsim5g-oai-gnb ... done Removing rfsim5g-oai-ext-dn ... done -Removing rfsim5g-oai-spgwu ... done +Removing rfsim5g-oai-upf ... done Removing rfsim5g-oai-smf ... done Removing rfsim5g-oai-amf ... done -Removing rfsim5g-oai-nrf ... done Removing rfsim5g-mysql ... done Removing network rfsim5g-oai-public-net Removing network rfsim5g-oai-traffic-net @@ -522,24 +511,21 @@ docker-compose entry mount another config, or add `--uicc0.imsi feature of the configuration module to overwrite any configuration option in the config file on the command line. -We are also using a dedicated `oai-smf.conf` for the `SMF` container: the `oai` DNN shall match the one in the NR-UE section of `docker-compose.yaml` (`DNN: oai`). - ## 5.2. Making the gNB connect to the core network ## -Mainly you need to match the PLMN in `gNB`, `AMF` and `SPGWU` parameters: +Mainly you need to match the PLMN in `gNB`, `AMF` and `UPF` parameters in the `mini_nonrf_config.yaml`: -* `AMF` - - `MCC=208` - - `MNC=99` - - `PLMN_SUPPORT_TAC=0x0001` - - ... -* `SPGWU` - - `MCC=208` - - `MNC=99` - - `TAC=1` -* `gNB` - - `MCC: '208'` - - `MNC: '99'` - - `TAC: 1` +```yaml + plmn_support_list: + - mcc: 208 + mnc: 99 + tac: 0x0001 + nssai: + - *embb_slice1 +... +snssais: + - &embb_slice1 + sst: 1 +``` The `ST` and `SD` values shall also match. diff --git a/ci-scripts/yaml_files/5g_rfsimulator/docker-compose.yaml b/ci-scripts/yaml_files/5g_rfsimulator/docker-compose.yaml index d238d63ea1..ef7055b65b 100644 --- a/ci-scripts/yaml_files/5g_rfsimulator/docker-compose.yaml +++ b/ci-scripts/yaml_files/5g_rfsimulator/docker-compose.yaml @@ -1,14 +1,5 @@ version: '3.8' services: - oai-nrf: - container_name: "rfsim5g-oai-nrf" - image: oaisoftwarealliance/oai-nrf:v1.5.0 - environment: - - NRF_INTERFACE_NAME_FOR_SBI=eth0 - - TZ=Europe/Paris - networks: - public_net: - ipv4_address: 192.168.71.130 mysql: container_name: "rfsim5g-mysql" image: mysql:8.0 @@ -31,108 +22,36 @@ services: ipv4_address: 192.168.71.131 oai-amf: container_name: "rfsim5g-oai-amf" - image: oaisoftwarealliance/oai-amf:v1.5.0 + image: oaisoftwarealliance/oai-amf:v2.0.0 environment: - TZ=Europe/paris - - MCC=208 - - MNC=99 - - REGION_ID=128 - - AMF_SET_ID=1 - - SERVED_GUAMI_MCC_0=208 - - SERVED_GUAMI_MNC_0=99 - - SERVED_GUAMI_REGION_ID_0=128 - - SERVED_GUAMI_AMF_SET_ID_0=1 - - SERVED_GUAMI_MCC_1=460 - - SERVED_GUAMI_MNC_1=11 - - SERVED_GUAMI_REGION_ID_1=10 - - SERVED_GUAMI_AMF_SET_ID_1=1 - - PLMN_SUPPORT_MCC=208 - - PLMN_SUPPORT_MNC=99 - - PLMN_SUPPORT_TAC=0x0001 - # Only one slice is defined (1, 0xFFFFFF). - - SST_0=1 - - AMF_INTERFACE_NAME_FOR_NGAP=eth0 - - AMF_INTERFACE_NAME_FOR_N11=eth0 - # One single SMF instance - - SMF_INSTANCE_ID_0=1 - - SMF_FQDN_0=oai-smf - - SMF_IPV4_ADDR_0=192.168.71.133 - - SELECTED_0=true - # mysql definition in AMF is mandatory in mini deployment. - - MYSQL_SERVER=192.168.71.131 - - MYSQL_USER=root - - MYSQL_PASS=linux - - MYSQL_DB=oai_db - # NF registration - - NRF_IPV4_ADDRESS=192.168.71.130 - - NRF_FQDN=oai-nrf - - NF_REGISTRATION=yes - - SMF_SELECTION=yes - - USE_FQDN_DNS=yes - - USE_HTTP2=no + volumes: + - ./mini_nonrf_config.yaml:/openair-amf/etc/config.yaml depends_on: - - oai-nrf - mysql networks: public_net: ipv4_address: 192.168.71.132 oai-smf: container_name: "rfsim5g-oai-smf" - image: oaisoftwarealliance/oai-smf:v1.5.0 + image: oaisoftwarealliance/oai-smf:v2.0.0 environment: - TZ=Europe/Paris - - SMF_INTERFACE_NAME_FOR_N4=eth0 - - SMF_INTERFACE_NAME_FOR_SBI=eth0 - - DEFAULT_DNS_IPV4_ADDRESS=172.21.3.100 - - DEFAULT_DNS_SEC_IPV4_ADDRESS=4.4.4.4 - - AMF_IPV4_ADDRESS=192.168.71.132 - - AMF_FQDN=oai-amf - - UPF_IPV4_ADDRESS=192.168.71.134 - - UPF_FQDN_0=oai-spgwu - - NRF_IPV4_ADDRESS=192.168.71.130 - - NRF_FQDN=oai-nrf - - REGISTER_NRF=yes - - DISCOVER_UPF=yes - - USE_FQDN_DNS=yes - - USE_LOCAL_SUBSCRIPTION_INFO=yes - - UE_MTU=1500 - # Only one slice is defined (1, 0xFFFFFF) - - DNN_NI0=oai - - TYPE0=IPv4 - - DNN_RANGE0=12.1.1.2 - 12.1.1.127 - - NSSAI_SST0=1 - - SESSION_AMBR_UL0=200Mbps - - SESSION_AMBR_DL0=400Mbps - - DEFAULT_CSCF_IPV4_ADDRESS=127.0.0.1 - - ENABLE_USAGE_REPORTING=no + volumes: + - ./mini_nonrf_config.yaml:/openair-smf/etc/config.yaml depends_on: - - oai-nrf - oai-amf networks: public_net: ipv4_address: 192.168.71.133 - oai-spgwu: - container_name: "rfsim5g-oai-spgwu" - image: oaisoftwarealliance/oai-spgwu-tiny:v1.5.0 + oai-upf: + container_name: "rfsim5g-oai-upf" + image: oaisoftwarealliance/oai-upf:v2.0.0 environment: - TZ=Europe/Paris - - SGW_INTERFACE_NAME_FOR_S1U_S12_S4_UP=eth0 - - SGW_INTERFACE_NAME_FOR_SX=eth0 - - PGW_INTERFACE_NAME_FOR_SGI=eth0 - - NETWORK_UE_NAT_OPTION=yes - - NETWORK_UE_IP=12.1.1.0/24 - - ENABLE_5G_FEATURES=yes - - REGISTER_NRF=yes - - USE_FQDN_NRF=yes - - UPF_FQDN_5G=oai-spgwu - - NRF_IPV4_ADDRESS=192.168.71.130 - - NRF_FQDN=oai-nrf - # Only one slice is defined (1, 0xFFFFFF) - - NSSAI_SST_0=1 - - NSSAI_SD_0=0xffffff - - DNN_0=oai + volumes: + - ./mini_nonrf_config.yaml:/openair-upf/etc/config.yaml depends_on: - - oai-nrf - oai-smf cap_add: - NET_ADMIN @@ -153,7 +72,7 @@ services: "iptables -t nat -A POSTROUTING -o eth0 -j MASQUERADE;"\ "ip route add 12.1.1.0/24 via 192.168.72.134 dev eth0; sleep infinity" depends_on: - - oai-spgwu + - oai-upf networks: traffic_net: ipv4_address: 192.168.72.135 diff --git a/ci-scripts/yaml_files/5g_rfsimulator/mini_nonrf_config.yaml b/ci-scripts/yaml_files/5g_rfsimulator/mini_nonrf_config.yaml new file mode 100644 index 0000000000..037fa1e41e --- /dev/null +++ b/ci-scripts/yaml_files/5g_rfsimulator/mini_nonrf_config.yaml @@ -0,0 +1,189 @@ +################################################################################ +# 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 +################################################################################ + +# OAI CN Configuration File +### This file can be used by all OAI NFs +### Some fields are specific to an NF and will be ignored by other NFs + +## NOTE ON YAML ANCHORS ## +# We use YAML anchors to ease the configuration and to avoid duplicating parts of the configuration. +# This is especially true for the SNSSAIs, as we have to define them for multiple NFs. +# Please note that the use of anchors is not mandatory, and you can define the SNSSAI in each NF yourself. +# You can read more about anchors here: https://yaml.org/spec/1.2.2/#anchors-and-aliases + +############# Common configuration + +# Log level for all the NFs +log_level: + general: debug + +# If you enable registration, the other NFs will use the NRF discovery mechanism +register_nf: + general: no + +http_version: 1 + +############## SBI Interfaces +### Each NF takes its local SBI interfaces and remote interfaces from here, unless it gets them using NRF discovery mechanisms +nfs: + amf: + host: oai-amf + sbi: + port: 80 + api_version: v1 + interface_name: eth0 + n2: + interface_name: eth0 + port: 38412 + smf: + host: oai-smf + sbi: + port: 80 + api_version: v1 + interface_name: eth0 + n4: + interface_name: eth0 + port: 8805 + + upf: + host: oai-upf + sbi: + port: 80 + api_version: v1 + interface_name: eth0 + n3: + interface_name: eth0 + port: 2152 + n4: + interface_name: eth0 + port: 8805 + n6: + interface_name: eth1 + n9: + interface_name: eth0 + port: 2152 + +#### Common for UDR and AMF +database: + host: mysql + user: test + type: mysql + password: test + database_name: oai_db + generate_random: true + connection_timeout: 300 # seconds + +## general single_nssai configuration +## Defines YAML anchors, which are reused in the config file +snssais: + - &embb_slice1 + sst: 1 + +############## NF-specific configuration +amf: + amf_name: "OAI-AMF" + # This really depends on if we want to keep the "mini" version or not + support_features_options: + enable_simple_scenario: yes # "no" by default with the normal deployment scenarios with AMF/SMF/UPF/AUSF/UDM/UDR/NRF. + # set it to "yes" to use with the minimalist deployment scenario (including only AMF/SMF/UPF) by using the internal AUSF/UDM implemented inside AMF. + # There's no NRF in this scenario, SMF info is taken from "nfs" section. + enable_nssf: no + enable_smf_selection: no + relative_capacity: 30 + statistics_timer_interval: 20 # in seconds + emergency_support: false + served_guami_list: + - mcc: 208 + mnc: 99 + amf_region_id: 01 + amf_set_id: 001 + amf_pointer: 01 + plmn_support_list: + - mcc: 208 + mnc: 99 + tac: 0x0001 + nssai: + - *embb_slice1 + supported_integrity_algorithms: + - "NIA0" + - "NIA1" + - "NIA2" + supported_encryption_algorithms: + - "NEA0" + - "NEA1" + - "NEA2" + +smf: + ue_mtu: 1500 + support_features: + use_local_subscription_info: yes # Use infos from local_subscription_info or from UDM + use_local_pcc_rules: yes # Use infos from local_pcc_rules or from PCF + upfs: + - host: oai-upf + port: 8805 + config: + enable_usage_reporting: no + # follows UPFInfo from 3GPP TS 29.510, currently only these values from interfaceUpfInfoList are supported + upf_info: + interfaceUpfInfoList: + - interfaceType: "N3" + networkInstance: "access.oai.org" + - interfaceType: "N6" + networkInstance: "core.oai.org" + ue_dns: + primary_ipv4: "172.21.3.100" + primary_ipv6: "2001:4860:4860::8888" + secondary_ipv4: "8.8.8.8" + secondary_ipv6: "2001:4860:4860::8888" + ims: + pcscf_ipv4: "127.0.0.1" + pcscf_ipv6: "fe80::7915:f408:1787:db8b" + # the DNN you configure here should be configured in "dnns" + # follows the SmfInfo datatype from 3GPP TS 29.510 + smf_info: + sNssaiSmfInfoList: + - sNssai: *embb_slice1 + dnnSmfInfoList: + - dnn: "oai" + local_subscription_infos: + - single_nssai: *embb_slice1 + dnn: "oai" + qos_profile: + 5qi: 9 + session_ambr_ul: "200Mbps" + session_ambr_dl: "400Mbps" + +upf: + support_features: + enable_bpf_datapath: no # If "on": BPF is used as datapath else simpleswitch is used, DEFAULT= off + enable_snat: yes # If "on": Source natting is done for UE, DEFAULT= off + remote_n6_gw: localhost # Dummy host since simple-switch does not use N6 GW + upf_info: + sNssaiUpfInfoList: + - sNssai: *embb_slice1 + dnnUpfInfoList: + - dnn: "oai" + +## DNN configuration +dnns: + - dnn: "oai" + pdu_session_type: "IPV4" + ipv4_subnet: "12.1.1.0/24" diff --git a/ci-scripts/yaml_files/5g_rfsimulator/oai_db.sql b/ci-scripts/yaml_files/5g_rfsimulator/oai_db.sql old mode 100755 new mode 100644 diff --git a/ci-scripts/yaml_files/5g_rfsimulator_24prb/docker-compose.yaml b/ci-scripts/yaml_files/5g_rfsimulator_24prb/docker-compose.yaml index eaadeb1b1b..29ebe61419 100644 --- a/ci-scripts/yaml_files/5g_rfsimulator_24prb/docker-compose.yaml +++ b/ci-scripts/yaml_files/5g_rfsimulator_24prb/docker-compose.yaml @@ -1,14 +1,5 @@ version: '3.8' services: - oai-nrf: - container_name: "rfsim5g-oai-nrf" - image: oaisoftwarealliance/oai-nrf:v1.5.0 - environment: - - NRF_INTERFACE_NAME_FOR_SBI=eth0 - - TZ=Europe/Paris - networks: - public_net: - ipv4_address: 192.168.71.130 mysql: container_name: "rfsim5g-mysql" image: mysql:8.0 @@ -31,108 +22,36 @@ services: ipv4_address: 192.168.71.131 oai-amf: container_name: "rfsim5g-oai-amf" - image: oaisoftwarealliance/oai-amf:v1.5.0 + image: oaisoftwarealliance/oai-amf:v2.0.0 environment: - TZ=Europe/paris - - MCC=208 - - MNC=99 - - REGION_ID=128 - - AMF_SET_ID=1 - - SERVED_GUAMI_MCC_0=208 - - SERVED_GUAMI_MNC_0=99 - - SERVED_GUAMI_REGION_ID_0=128 - - SERVED_GUAMI_AMF_SET_ID_0=1 - - SERVED_GUAMI_MCC_1=460 - - SERVED_GUAMI_MNC_1=11 - - SERVED_GUAMI_REGION_ID_1=10 - - SERVED_GUAMI_AMF_SET_ID_1=1 - - PLMN_SUPPORT_MCC=208 - - PLMN_SUPPORT_MNC=99 - - PLMN_SUPPORT_TAC=0x0001 - # Only one slice is defined (1, 0xFFFFFF). - - SST_0=1 - - AMF_INTERFACE_NAME_FOR_NGAP=eth0 - - AMF_INTERFACE_NAME_FOR_N11=eth0 - # One single SMF instance - - SMF_INSTANCE_ID_0=1 - - SMF_FQDN_0=oai-smf - - SMF_IPV4_ADDR_0=192.168.71.133 - - SELECTED_0=true - # mysql definition in AMF is mandatory in mini deployment. - - MYSQL_SERVER=192.168.71.131 - - MYSQL_USER=root - - MYSQL_PASS=linux - - MYSQL_DB=oai_db - # NF registration - - NRF_IPV4_ADDRESS=192.168.71.130 - - NRF_FQDN=oai-nrf - - NF_REGISTRATION=yes - - SMF_SELECTION=yes - - USE_FQDN_DNS=yes - - USE_HTTP2=no + volumes: + - ../5g_rfsimulator/mini_nonrf_config.yaml:/openair-amf/etc/config.yaml depends_on: - - oai-nrf - mysql networks: public_net: ipv4_address: 192.168.71.132 oai-smf: container_name: "rfsim5g-oai-smf" - image: oaisoftwarealliance/oai-smf:v1.5.0 + image: oaisoftwarealliance/oai-smf:v2.0.0 environment: - TZ=Europe/Paris - - SMF_INTERFACE_NAME_FOR_N4=eth0 - - SMF_INTERFACE_NAME_FOR_SBI=eth0 - - DEFAULT_DNS_IPV4_ADDRESS=172.21.3.100 - - DEFAULT_DNS_SEC_IPV4_ADDRESS=4.4.4.4 - - AMF_IPV4_ADDRESS=192.168.71.132 - - AMF_FQDN=oai-amf - - UPF_IPV4_ADDRESS=192.168.71.134 - - UPF_FQDN_0=oai-spgwu - - NRF_IPV4_ADDRESS=192.168.71.130 - - NRF_FQDN=oai-nrf - - REGISTER_NRF=yes - - DISCOVER_UPF=yes - - USE_FQDN_DNS=yes - - USE_LOCAL_SUBSCRIPTION_INFO=yes - - UE_MTU=1500 - # Only one slice is defined (1, 0xFFFFFF) - - DNN_NI0=oai - - TYPE0=IPv4 - - DNN_RANGE0=12.1.1.2 - 12.1.1.127 - - NSSAI_SST0=1 - - SESSION_AMBR_UL0=200Mbps - - SESSION_AMBR_DL0=400Mbps - - DEFAULT_CSCF_IPV4_ADDRESS=127.0.0.1 - - ENABLE_USAGE_REPORTING=no + volumes: + - ../5g_rfsimulator/mini_nonrf_config.yaml:/openair-smf/etc/config.yaml depends_on: - - oai-nrf - oai-amf networks: public_net: ipv4_address: 192.168.71.133 - oai-spgwu: - container_name: "rfsim5g-oai-spgwu" - image: oaisoftwarealliance/oai-spgwu-tiny:v1.5.0 + oai-upf: + container_name: "rfsim5g-oai-upf" + image: oaisoftwarealliance/oai-upf:v2.0.0 environment: - TZ=Europe/Paris - - SGW_INTERFACE_NAME_FOR_S1U_S12_S4_UP=eth0 - - SGW_INTERFACE_NAME_FOR_SX=eth0 - - PGW_INTERFACE_NAME_FOR_SGI=eth0 - - NETWORK_UE_NAT_OPTION=yes - - NETWORK_UE_IP=12.1.1.0/24 - - ENABLE_5G_FEATURES=yes - - REGISTER_NRF=yes - - USE_FQDN_NRF=yes - - UPF_FQDN_5G=oai-spgwu - - NRF_IPV4_ADDRESS=192.168.71.130 - - NRF_FQDN=oai-nrf - # Only one slice is defined (1, 0xFFFFFF) - - NSSAI_SST_0=1 - - NSSAI_SD_0=0xffffff - - DNN_0=oai + volumes: + - ../5g_rfsimulator/mini_nonrf_config.yaml:/openair-upf/etc/config.yaml depends_on: - - oai-nrf - oai-smf cap_add: - NET_ADMIN @@ -153,7 +72,7 @@ services: "iptables -t nat -A POSTROUTING -o eth0 -j MASQUERADE;"\ "ip route add 12.1.1.0/24 via 192.168.72.134 dev eth0; sleep infinity" depends_on: - - oai-spgwu + - oai-upf networks: traffic_net: ipv4_address: 192.168.72.135 diff --git a/ci-scripts/yaml_files/5g_rfsimulator_2x2/docker-compose.yaml b/ci-scripts/yaml_files/5g_rfsimulator_2x2/docker-compose.yaml index 8ebf8602eb..133c36f36e 100644 --- a/ci-scripts/yaml_files/5g_rfsimulator_2x2/docker-compose.yaml +++ b/ci-scripts/yaml_files/5g_rfsimulator_2x2/docker-compose.yaml @@ -1,14 +1,5 @@ version: '3.8' services: - oai-nrf: - container_name: "rfsim5g-oai-nrf" - image: oaisoftwarealliance/oai-nrf:v1.5.0 - environment: - - NRF_INTERFACE_NAME_FOR_SBI=eth0 - - TZ=Europe/Paris - networks: - public_net: - ipv4_address: 192.168.71.130 mysql: container_name: "rfsim5g-mysql" image: mysql:8.0 @@ -31,108 +22,36 @@ services: ipv4_address: 192.168.71.131 oai-amf: container_name: "rfsim5g-oai-amf" - image: oaisoftwarealliance/oai-amf:v1.5.0 + image: oaisoftwarealliance/oai-amf:v2.0.0 environment: - TZ=Europe/paris - - MCC=208 - - MNC=99 - - REGION_ID=128 - - AMF_SET_ID=1 - - SERVED_GUAMI_MCC_0=208 - - SERVED_GUAMI_MNC_0=99 - - SERVED_GUAMI_REGION_ID_0=128 - - SERVED_GUAMI_AMF_SET_ID_0=1 - - SERVED_GUAMI_MCC_1=460 - - SERVED_GUAMI_MNC_1=11 - - SERVED_GUAMI_REGION_ID_1=10 - - SERVED_GUAMI_AMF_SET_ID_1=1 - - PLMN_SUPPORT_MCC=208 - - PLMN_SUPPORT_MNC=99 - - PLMN_SUPPORT_TAC=0x0001 - # Only one slice is defined (1, 0xFFFFFF). - - SST_0=1 - - AMF_INTERFACE_NAME_FOR_NGAP=eth0 - - AMF_INTERFACE_NAME_FOR_N11=eth0 - # One single SMF instance - - SMF_INSTANCE_ID_0=1 - - SMF_FQDN_0=oai-smf - - SMF_IPV4_ADDR_0=192.168.71.133 - - SELECTED_0=true - # mysql definition in AMF is mandatory in mini deployment. - - MYSQL_SERVER=192.168.71.131 - - MYSQL_USER=root - - MYSQL_PASS=linux - - MYSQL_DB=oai_db - # NF registration - - NRF_IPV4_ADDRESS=192.168.71.130 - - NRF_FQDN=oai-nrf - - NF_REGISTRATION=yes - - SMF_SELECTION=yes - - USE_FQDN_DNS=yes - - USE_HTTP2=no + volumes: + - ../5g_rfsimulator/mini_nonrf_config.yaml:/openair-amf/etc/config.yaml depends_on: - - oai-nrf - mysql networks: public_net: ipv4_address: 192.168.71.132 oai-smf: container_name: "rfsim5g-oai-smf" - image: oaisoftwarealliance/oai-smf:v1.5.0 + image: oaisoftwarealliance/oai-smf:v2.0.0 environment: - TZ=Europe/Paris - - SMF_INTERFACE_NAME_FOR_N4=eth0 - - SMF_INTERFACE_NAME_FOR_SBI=eth0 - - DEFAULT_DNS_IPV4_ADDRESS=172.21.3.100 - - DEFAULT_DNS_SEC_IPV4_ADDRESS=4.4.4.4 - - AMF_IPV4_ADDRESS=192.168.71.132 - - AMF_FQDN=oai-amf - - UPF_IPV4_ADDRESS=192.168.71.134 - - UPF_FQDN_0=oai-spgwu - - NRF_IPV4_ADDRESS=192.168.71.130 - - NRF_FQDN=oai-nrf - - REGISTER_NRF=yes - - DISCOVER_UPF=yes - - USE_FQDN_DNS=yes - - USE_LOCAL_SUBSCRIPTION_INFO=yes - - UE_MTU=1500 - # Only one slice is defined (1, 0xFFFFFF) - - DNN_NI0=oai - - TYPE0=IPv4 - - DNN_RANGE0=12.1.1.2 - 12.1.1.127 - - NSSAI_SST0=1 - - SESSION_AMBR_UL0=200Mbps - - SESSION_AMBR_DL0=400Mbps - - DEFAULT_CSCF_IPV4_ADDRESS=127.0.0.1 - - ENABLE_USAGE_REPORTING=no + volumes: + - ../5g_rfsimulator/mini_nonrf_config.yaml:/openair-smf/etc/config.yaml depends_on: - - oai-nrf - oai-amf networks: public_net: ipv4_address: 192.168.71.133 - oai-spgwu: - container_name: "rfsim5g-oai-spgwu" - image: oaisoftwarealliance/oai-spgwu-tiny:v1.5.0 + oai-upf: + container_name: "rfsim5g-oai-upf" + image: oaisoftwarealliance/oai-upf:v2.0.0 environment: - TZ=Europe/Paris - - SGW_INTERFACE_NAME_FOR_S1U_S12_S4_UP=eth0 - - SGW_INTERFACE_NAME_FOR_SX=eth0 - - PGW_INTERFACE_NAME_FOR_SGI=eth0 - - NETWORK_UE_NAT_OPTION=yes - - NETWORK_UE_IP=12.1.1.0/24 - - ENABLE_5G_FEATURES=yes - - REGISTER_NRF=yes - - USE_FQDN_NRF=yes - - UPF_FQDN_5G=oai-spgwu - - NRF_IPV4_ADDRESS=192.168.71.130 - - NRF_FQDN=oai-nrf - # Only one slice is defined (1, 0xFFFFFF) - - NSSAI_SST_0=1 - - NSSAI_SD_0=0xffffff - - DNN_0=oai + volumes: + - ../5g_rfsimulator/mini_nonrf_config.yaml:/openair-upf/etc/config.yaml depends_on: - - oai-nrf - oai-smf cap_add: - NET_ADMIN @@ -153,7 +72,7 @@ services: "iptables -t nat -A POSTROUTING -o eth0 -j MASQUERADE;"\ "ip route add 12.1.1.0/24 via 192.168.72.134 dev eth0; sleep infinity" depends_on: - - oai-spgwu + - oai-upf networks: traffic_net: ipv4_address: 192.168.72.135 diff --git a/ci-scripts/yaml_files/5g_rfsimulator_e1/README.md b/ci-scripts/yaml_files/5g_rfsimulator_e1/README.md index 2cc0ec88ab..a0c26dc438 100644 --- a/ci-scripts/yaml_files/5g_rfsimulator_e1/README.md +++ b/ci-scripts/yaml_files/5g_rfsimulator_e1/README.md @@ -20,8 +20,7 @@ Core network components are on `core_net` network, CU-CP <--> CU-UP X communicat ``` AMF --> 192.168.71.132 (N2,Namf) SMF --> 192.168.71.133 (N4,Nsmf) -NRF --> 192.168.71.130 (Nnrf) -SPGWU --> 192.168.71.134 (N3) +UPF --> 192.168.71.134 (N3) CU-CP --> 192.168.71.X (N2), 192.168.72.2 (F1C), 192.168.77.2 (E1) CU-UP1 --> 192.168.71.X (N3), 192.168.73.2 (F1U), 192.168.77.3 (E1) CU-UP2 --> 192.168.71.X (N3), 192.168.74.2 (F1U), 192.168.77.4 (E1) @@ -41,7 +40,7 @@ You should be able to deploy the [basic 5G RFsim deployment](../5g_rfsimulator/R First, start the MySQL server and 5GC: ```bash -docker-compose up -d mysql oai-nrf oai-amf oai-smf oai-spgwu +docker-compose up -d mysql oai-amf oai-smf oai-upf docker-compose ps -a ``` diff --git a/ci-scripts/yaml_files/5g_rfsimulator_e1/docker-compose.yaml b/ci-scripts/yaml_files/5g_rfsimulator_e1/docker-compose.yaml index adfdefbccf..468f7bb67e 100644 --- a/ci-scripts/yaml_files/5g_rfsimulator_e1/docker-compose.yaml +++ b/ci-scripts/yaml_files/5g_rfsimulator_e1/docker-compose.yaml @@ -1,22 +1,13 @@ version: '3.8' services: - oai-nrf: - container_name: "rfsim5g-oai-nrf" - image: oaisoftwarealliance/oai-nrf:v1.5.0 - environment: - - NRF_INTERFACE_NAME_FOR_SBI=eth0 - - TZ=Europe/1 - networks: - core_net: - ipv4_address: 192.168.71.130 mysql: container_name: "rfsim5g-mysql" image: mysql:8.0 volumes: - - ../5g_f1_rfsimulator/oai_db.sql:/docker-entrypoint-initdb.d/oai_db.sql - - ../5g_f1_rfsimulator/mysql-healthcheck.sh:/tmp/mysql-healthcheck.sh + - ../5g_rfsimulator/oai_db.sql:/docker-entrypoint-initdb.d/oai_db.sql + - ../5g_rfsimulator/mysql-healthcheck.sh:/tmp/mysql-healthcheck.sh environment: - - TZ=Europe/1 + - TZ=Europe/Paris - MYSQL_DATABASE=oai_db - MYSQL_USER=test - MYSQL_PASSWORD=test @@ -31,118 +22,36 @@ services: ipv4_address: 192.168.71.131 oai-amf: container_name: "rfsim5g-oai-amf" - image: oaisoftwarealliance/oai-amf:v1.5.0 + image: oaisoftwarealliance/oai-amf:v2.0.0 environment: - - TZ=Europe/1 - - MCC=208 - - MNC=99 - - REGION_ID=128 - - AMF_SET_ID=1 - - SERVED_GUAMI_MCC_0=208 - - SERVED_GUAMI_MNC_0=99 - - SERVED_GUAMI_REGION_ID_0=128 - - SERVED_GUAMI_AMF_SET_ID_0=1 - - SERVED_GUAMI_MCC_1=460 - - SERVED_GUAMI_MNC_1=11 - - SERVED_GUAMI_REGION_ID_1=10 - - SERVED_GUAMI_AMF_SET_ID_1=1 - - PLMN_SUPPORT_MCC=208 - - PLMN_SUPPORT_MNC=99 - - PLMN_SUPPORT_TAC=0x0001 - # Three slices are defined - - SST_0=1 - - SST_1=2 - - SST_2=3 - - AMF_INTERFACE_NAME_FOR_NGAP=eth0 - - AMF_INTERFACE_NAME_FOR_N11=eth0 - # One single SMF instance - - SMF_INSTANCE_ID_0=1 - - SMF_FQDN_0=oai-smf - - SMF_IPV4_ADDR_0=192.168.71.133 - - SELECTED_0=true - # mysql definition in AMF is mandatory in mini deployment. - - MYSQL_SERVER=192.168.71.131 - - MYSQL_USER=root - - MYSQL_PASS=linux - - MYSQL_DB=oai_db - # NF registration - - NRF_IPV4_ADDRESS=192.168.71.130 - - NRF_FQDN=oai-nrf - - NF_REGISTRATION=yes - - SMF_SELECTION=yes - - USE_FQDN_DNS=yes - - USE_HTTP2=no + - TZ=Europe/paris + volumes: + - ./mini_nonrf_config_3slices.yaml:/openair-amf/etc/config.yaml depends_on: - - oai-nrf - mysql networks: core_net: ipv4_address: 192.168.71.132 oai-smf: container_name: "rfsim5g-oai-smf" - image: oaisoftwarealliance/oai-smf:v1.5.0 + image: oaisoftwarealliance/oai-smf:v2.0.0 environment: - - TZ=Europe/1 - - SMF_INTERFACE_NAME_FOR_N4=eth0 - - SMF_INTERFACE_NAME_FOR_SBI=eth0 - - DEFAULT_DNS_IPV4_ADDRESS=172.21.3.100 - - DEFAULT_DNS_SEC_IPV4_ADDRESS=4.4.4.4 - - AMF_IPV4_ADDRESS=192.168.71.132 - - AMF_FQDN=oai-amf - - UPF_IPV4_ADDRESS=192.168.71.134 - - UPF_FQDN_0=oai-spgwu - - NRF_IPV4_ADDRESS=192.168.71.130 - - NRF_FQDN=oai-nrf - - REGISTER_NRF=yes - - DISCOVER_UPF=yes - - USE_FQDN_DNS=yes - - USE_LOCAL_SUBSCRIPTION_INFO=yes - - UE_MTU=1500 - # Only one slice is defined (1, 0xFFFFFF) - - DNN_NI0=oai - - TYPE0=IPv4 - - DNN_RANGE0=12.1.1.2 - 12.1.1.127 - - NSSAI_SST0=1 - - NSSAI_SST1=2 - - NSSAI_SST2=3 - - SESSION_AMBR_UL0=200Mbps - - SESSION_AMBR_DL0=400Mbps - - DEFAULT_CSCF_IPV4_ADDRESS=127.0.0.1 - - ENABLE_USAGE_REPORTING=no + - TZ=Europe/Paris + volumes: + - ./mini_nonrf_config_3slices.yaml:/openair-smf/etc/config.yaml depends_on: - - oai-nrf - oai-amf networks: core_net: ipv4_address: 192.168.71.133 - oai-spgwu: - container_name: "rfsim5g-oai-spgwu" - image: oaisoftwarealliance/oai-spgwu-tiny:v1.5.0 + oai-upf: + container_name: "rfsim5g-oai-upf" + image: oaisoftwarealliance/oai-upf:v2.0.0 environment: - - TZ=Europe/1 - - SGW_INTERFACE_NAME_FOR_S1U_S12_S4_UP=eth0 - - SGW_INTERFACE_NAME_FOR_SX=eth0 - - PGW_INTERFACE_NAME_FOR_SGI=eth0 - - NETWORK_UE_NAT_OPTION=yes - - NETWORK_UE_IP=12.1.1.0/24 - - ENABLE_5G_FEATURES=yes - - REGISTER_NRF=yes - - USE_FQDN_NRF=yes - - UPF_FQDN_5G=oai-spgwu - - NRF_IPV4_ADDRESS=192.168.71.130 - - NRF_FQDN=oai-nrf - # Three slices are defined - - NSSAI_SST_0=1 - - NSSAI_SD_0=0xffffff - - DNN_0=oai - - NSSAI_SST_1=2 - - NSSAI_SD_1=0xffffff - - DNN_1=oai - - NSSAI_SST_2=3 - - NSSAI_SD_2=0xffffff - - DNN_2=oai + - TZ=Europe/Paris + volumes: + - ./mini_nonrf_config_3slices.yaml:/openair-upf/etc/config.yaml depends_on: - - oai-nrf - oai-smf cap_add: - NET_ADMIN @@ -153,6 +62,8 @@ services: networks: core_net: ipv4_address: 192.168.71.134 + traffic_net: + ipv4_address: 192.168.72.134 oai-cucp: image: oaisoftwarealliance/oai-gnb:develop @@ -164,7 +75,7 @@ services: --gNBs.[0].local_s_address 192.168.72.2 ASAN_OPTIONS: detect_leaks=0 depends_on: - - oai-spgwu + - oai-upf networks: core_net: ipv4_address: 192.168.71.150 @@ -435,6 +346,14 @@ networks: - subnet: 192.168.71.128/26 driver_opts: com.docker.network.bridge.name: "rfsim5g-core" + traffic_net: + driver: bridge + name: rfsim5g-oai-traffic-net + ipam: + config: + - subnet: 192.168.72.128/26 + driver_opts: + com.docker.network.bridge.name: "rfsim5g-traffic" f1c_net: driver: bridge name: rfsim5g-oai-f1c-net diff --git a/ci-scripts/yaml_files/5g_rfsimulator_e1/mini_nonrf_config_3slices.yaml b/ci-scripts/yaml_files/5g_rfsimulator_e1/mini_nonrf_config_3slices.yaml new file mode 100644 index 0000000000..369eb6356a --- /dev/null +++ b/ci-scripts/yaml_files/5g_rfsimulator_e1/mini_nonrf_config_3slices.yaml @@ -0,0 +1,213 @@ +################################################################################ +# 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 +################################################################################ + +# OAI CN Configuration File +### This file can be used by all OAI NFs +### Some fields are specific to an NF and will be ignored by other NFs + +## NOTE ON YAML ANCHORS ## +# We use YAML anchors to ease the configuration and to avoid duplicating parts of the configuration. +# This is especially true for the SNSSAIs, as we have to define them for multiple NFs. +# Please note that the use of anchors is not mandatory, and you can define the SNSSAI in each NF yourself. +# You can read more about anchors here: https://yaml.org/spec/1.2.2/#anchors-and-aliases + +############# Common configuration + +# Log level for all the NFs +log_level: + general: debug + +# If you enable registration, the other NFs will use the NRF discovery mechanism +register_nf: + general: no + +http_version: 1 + +############## SBI Interfaces +### Each NF takes its local SBI interfaces and remote interfaces from here, unless it gets them using NRF discovery mechanisms +nfs: + amf: + host: oai-amf + sbi: + port: 80 + api_version: v1 + interface_name: eth0 + n2: + interface_name: eth0 + port: 38412 + smf: + host: oai-smf + sbi: + port: 80 + api_version: v1 + interface_name: eth0 + n4: + interface_name: eth0 + port: 8805 + + upf: + host: oai-upf + sbi: + port: 80 + api_version: v1 + interface_name: eth0 + n3: + interface_name: eth0 + port: 2152 + n4: + interface_name: eth0 + port: 8805 + n6: + interface_name: eth1 + n9: + interface_name: eth0 + port: 2152 + +#### Common for UDR and AMF +database: + host: mysql + user: test + type: mysql + password: test + database_name: oai_db + generate_random: true + connection_timeout: 300 # seconds + +## general single_nssai configuration +## Defines YAML anchors, which are reused in the config file +snssais: + - &embb_slice1 + sst: 1 + - &embb_slice2 + sst: 2 + - &embb_slice3 + sst: 3 + +############## NF-specific configuration +amf: + amf_name: "OAI-AMF" + # This really depends on if we want to keep the "mini" version or not + support_features_options: + enable_simple_scenario: yes # "no" by default with the normal deployment scenarios with AMF/SMF/UPF/AUSF/UDM/UDR/NRF. + # set it to "yes" to use with the minimalist deployment scenario (including only AMF/SMF/UPF) by using the internal AUSF/UDM implemented inside AMF. + # There's no NRF in this scenario, SMF info is taken from "nfs" section. + enable_nssf: no + enable_smf_selection: no + relative_capacity: 30 + statistics_timer_interval: 20 # in seconds + emergency_support: false + served_guami_list: + - mcc: 208 + mnc: 99 + amf_region_id: 01 + amf_set_id: 001 + amf_pointer: 01 + plmn_support_list: + - mcc: 208 + mnc: 99 + tac: 0x0001 + nssai: + - *embb_slice1 + - *embb_slice2 + - *embb_slice3 + supported_integrity_algorithms: + - "NIA0" + - "NIA1" + - "NIA2" + supported_encryption_algorithms: + - "NEA0" + - "NEA1" + - "NEA2" + +smf: + ue_mtu: 1500 + support_features: + use_local_subscription_info: yes # Use infos from local_subscription_info or from UDM + use_local_pcc_rules: yes # Use infos from local_pcc_rules or from PCF + upfs: + - host: oai-upf + port: 8805 + config: + enable_usage_reporting: no + # follows UPFInfo from 3GPP TS 29.510, currently only these values from interfaceUpfInfoList are supported + upf_info: + interfaceUpfInfoList: + - interfaceType: "N3" + networkInstance: "access.oai.org" + - interfaceType: "N6" + networkInstance: "core.oai.org" + ue_dns: + primary_ipv4: "172.21.3.100" + primary_ipv6: "2001:4860:4860::8888" + secondary_ipv4: "8.8.8.8" + secondary_ipv6: "2001:4860:4860::8888" + ims: + pcscf_ipv4: "127.0.0.1" + pcscf_ipv6: "fe80::7915:f408:1787:db8b" + # the DNN you configure here should be configured in "dnns" + # follows the SmfInfo datatype from 3GPP TS 29.510 + smf_info: + sNssaiSmfInfoList: + - sNssai: *embb_slice1 + dnnSmfInfoList: + - dnn: "oai" + local_subscription_infos: + - single_nssai: *embb_slice1 + dnn: "oai" + qos_profile: + 5qi: 9 + session_ambr_ul: "200Mbps" + session_ambr_dl: "400Mbps" + - single_nssai: *embb_slice2 + dnn: "oai" + qos_profile: + 5qi: 9 + session_ambr_ul: "200Mbps" + session_ambr_dl: "400Mbps" + - single_nssai: *embb_slice3 + dnn: "oai" + qos_profile: + 5qi: 9 + session_ambr_ul: "200Mbps" + session_ambr_dl: "400Mbps" + +upf: + support_features: + enable_bpf_datapath: no # If "on": BPF is used as datapath else simpleswitch is used, DEFAULT= off + enable_snat: yes # If "on": Source natting is done for UE, DEFAULT= off + remote_n6_gw: localhost # Dummy host since simple-switch does not use N6 GW + upf_info: + sNssaiUpfInfoList: + - sNssai: *embb_slice1 + dnnUpfInfoList: + - dnn: "oai" + - sNssai: *embb_slice2 + dnnUpfInfoList: + - dnn: "oai" + - sNssai: *embb_slice3 + dnnUpfInfoList: + - dnn: "oai" + +## DNN configuration +dnns: + - dnn: "oai" + pdu_session_type: "IPV4" + ipv4_subnet: "12.1.1.0/24" diff --git a/ci-scripts/yaml_files/5g_rfsimulator_u0_25prb/docker-compose.yaml b/ci-scripts/yaml_files/5g_rfsimulator_u0_25prb/docker-compose.yaml index 42fb6648e8..c5657efb41 100644 --- a/ci-scripts/yaml_files/5g_rfsimulator_u0_25prb/docker-compose.yaml +++ b/ci-scripts/yaml_files/5g_rfsimulator_u0_25prb/docker-compose.yaml @@ -1,14 +1,5 @@ version: '3.8' services: - oai-nrf: - container_name: "rfsim5g-oai-nrf" - image: oaisoftwarealliance/oai-nrf:v1.5.0 - environment: - - NRF_INTERFACE_NAME_FOR_SBI=eth0 - - TZ=Europe/Paris - networks: - public_net: - ipv4_address: 192.168.71.130 mysql: container_name: "rfsim5g-mysql" image: mysql:8.0 @@ -31,108 +22,36 @@ services: ipv4_address: 192.168.71.131 oai-amf: container_name: "rfsim5g-oai-amf" - image: oaisoftwarealliance/oai-amf:v1.5.0 + image: oaisoftwarealliance/oai-amf:v2.0.0 environment: - TZ=Europe/paris - - MCC=208 - - MNC=99 - - REGION_ID=128 - - AMF_SET_ID=1 - - SERVED_GUAMI_MCC_0=208 - - SERVED_GUAMI_MNC_0=99 - - SERVED_GUAMI_REGION_ID_0=128 - - SERVED_GUAMI_AMF_SET_ID_0=1 - - SERVED_GUAMI_MCC_1=460 - - SERVED_GUAMI_MNC_1=11 - - SERVED_GUAMI_REGION_ID_1=10 - - SERVED_GUAMI_AMF_SET_ID_1=1 - - PLMN_SUPPORT_MCC=208 - - PLMN_SUPPORT_MNC=99 - - PLMN_SUPPORT_TAC=0x0001 - # Only one slice is defined (1, 0xFFFFFF). - - SST_0=1 - - AMF_INTERFACE_NAME_FOR_NGAP=eth0 - - AMF_INTERFACE_NAME_FOR_N11=eth0 - # One single SMF instance - - SMF_INSTANCE_ID_0=1 - - SMF_FQDN_0=oai-smf - - SMF_IPV4_ADDR_0=192.168.71.133 - - SELECTED_0=true - # mysql definition in AMF is mandatory in mini deployment. - - MYSQL_SERVER=192.168.71.131 - - MYSQL_USER=root - - MYSQL_PASS=linux - - MYSQL_DB=oai_db - # NF registration - - NRF_IPV4_ADDRESS=192.168.71.130 - - NRF_FQDN=oai-nrf - - NF_REGISTRATION=yes - - SMF_SELECTION=yes - - USE_FQDN_DNS=yes - - USE_HTTP2=no + volumes: + - ../5g_rfsimulator/mini_nonrf_config.yaml:/openair-amf/etc/config.yaml depends_on: - - oai-nrf - mysql networks: public_net: ipv4_address: 192.168.71.132 oai-smf: container_name: "rfsim5g-oai-smf" - image: oaisoftwarealliance/oai-smf:v1.5.0 + image: oaisoftwarealliance/oai-smf:v2.0.0 environment: - TZ=Europe/Paris - - SMF_INTERFACE_NAME_FOR_N4=eth0 - - SMF_INTERFACE_NAME_FOR_SBI=eth0 - - DEFAULT_DNS_IPV4_ADDRESS=172.21.3.100 - - DEFAULT_DNS_SEC_IPV4_ADDRESS=4.4.4.4 - - AMF_IPV4_ADDRESS=192.168.71.132 - - AMF_FQDN=oai-amf - - UPF_IPV4_ADDRESS=192.168.71.134 - - UPF_FQDN_0=oai-spgwu - - NRF_IPV4_ADDRESS=192.168.71.130 - - NRF_FQDN=oai-nrf - - REGISTER_NRF=yes - - DISCOVER_UPF=yes - - USE_FQDN_DNS=yes - - USE_LOCAL_SUBSCRIPTION_INFO=yes - - UE_MTU=1500 - # Only one slice is defined (1, 0xFFFFFF) - - DNN_NI0=oai - - TYPE0=IPv4 - - DNN_RANGE0=12.1.1.2 - 12.1.1.127 - - NSSAI_SST0=1 - - SESSION_AMBR_UL0=200Mbps - - SESSION_AMBR_DL0=400Mbps - - DEFAULT_CSCF_IPV4_ADDRESS=127.0.0.1 - - ENABLE_USAGE_REPORTING=no + volumes: + - ../5g_rfsimulator/mini_nonrf_config.yaml:/openair-smf/etc/config.yaml depends_on: - - oai-nrf - oai-amf networks: public_net: ipv4_address: 192.168.71.133 - oai-spgwu: - container_name: "rfsim5g-oai-spgwu" - image: oaisoftwarealliance/oai-spgwu-tiny:v1.5.0 + oai-upf: + container_name: "rfsim5g-oai-upf" + image: oaisoftwarealliance/oai-upf:v2.0.0 environment: - TZ=Europe/Paris - - SGW_INTERFACE_NAME_FOR_S1U_S12_S4_UP=eth0 - - SGW_INTERFACE_NAME_FOR_SX=eth0 - - PGW_INTERFACE_NAME_FOR_SGI=eth0 - - NETWORK_UE_NAT_OPTION=yes - - NETWORK_UE_IP=12.1.1.0/24 - - ENABLE_5G_FEATURES=yes - - REGISTER_NRF=yes - - USE_FQDN_NRF=yes - - UPF_FQDN_5G=oai-spgwu - - NRF_IPV4_ADDRESS=192.168.71.130 - - NRF_FQDN=oai-nrf - # Only one slice is defined (1, 0xFFFFFF) - - NSSAI_SST_0=1 - - NSSAI_SD_0=0xffffff - - DNN_0=oai + volumes: + - ../5g_rfsimulator/mini_nonrf_config.yaml:/openair-upf/etc/config.yaml depends_on: - - oai-nrf - oai-smf cap_add: - NET_ADMIN @@ -153,7 +72,7 @@ services: "iptables -t nat -A POSTROUTING -o eth0 -j MASQUERADE;"\ "ip route add 12.1.1.0/24 via 192.168.72.134 dev eth0; sleep infinity" depends_on: - - oai-spgwu + - oai-upf networks: traffic_net: ipv4_address: 192.168.72.135 From ca2dfc0e619c8fb10baf06e9e3e2cd445c97c4f7 Mon Sep 17 00:00:00 2001 From: Raphael Defosseux Date: Thu, 11 Jan 2024 10:03:34 +0100 Subject: [PATCH 28/29] chore(ci): updating l2-simulator scenario to CN v2.0 Signed-off-by: Raphael Defosseux --- .../xml_files/container_5g_l2sim_tdd.xml | 8 +- ci-scripts/yaml_files/5g_l2sim_tdd/README.md | 64 +++++------ .../5g_l2sim_tdd/docker-compose.yaml | 107 +++--------------- 3 files changed, 44 insertions(+), 135 deletions(-) diff --git a/ci-scripts/xml_files/container_5g_l2sim_tdd.xml b/ci-scripts/xml_files/container_5g_l2sim_tdd.xml index 50ad28e5ca..8fcdcd6cb0 100644 --- a/ci-scripts/xml_files/container_5g_l2sim_tdd.xml +++ b/ci-scripts/xml_files/container_5g_l2sim_tdd.xml @@ -60,8 +60,8 @@ DeployGenObject Deploy OAI 5G CoreNetwork yaml_files/5g_l2sim_tdd - oai-nrf oai-amf oai-smf oai-spgwu oai-ext-dn - 6 + oai-amf oai-smf oai-upf oai-ext-dn + 5 @@ -69,7 +69,7 @@ Deploy OAI 5G gNB L2 sim SA yaml_files/5g_l2sim_tdd oai-gnb - 7 + 6 @@ -77,7 +77,7 @@ Deploy OAI 5G NR-UE L2 sim SA and Proxy yaml_files/5g_l2sim_tdd proxy oai-nr-ue0 - 9 + 8 diff --git a/ci-scripts/yaml_files/5g_l2sim_tdd/README.md b/ci-scripts/yaml_files/5g_l2sim_tdd/README.md index 6bdff1c3e4..9062044b2c 100644 --- a/ci-scripts/yaml_files/5g_l2sim_tdd/README.md +++ b/ci-scripts/yaml_files/5g_l2sim_tdd/README.md @@ -96,10 +96,9 @@ Now pull images. ```bash docker pull mysql:8.0 -docker pull oaisoftwarealliance/oai-amf:v1.5.0 -docker pull oaisoftwarealliance/oai-nrf:v1.5.0 -docker pull oaisoftwarealliance/oai-smf:v1.5.0 -docker pull oaisoftwarealliance/oai-spgwu-tiny:v1.5.0 +docker pull oaisoftwarealliance/oai-amf:v2.0.0 +docker pull oaisoftwarealliance/oai-smf:v2.0.0 +docker pull oaisoftwarealliance/oai-upf:v2.0.0 docker pull oaisoftwarealliance/trf-gen-cn5g:focal docker pull oaisoftwarealliance/oai-gnb:develop @@ -139,14 +138,13 @@ sudo ifconfig lo: 127.0.0.2 netmask 255.0.0.0 up ```bash cd ci-scripts/yaml_files/5g_l2sim_tdd -docker-compose up -d mysql oai-nrf oai-amf oai-smf oai-spgwu oai-ext-dn +docker-compose up -d mysql oai-amf oai-smf oai-upf oai-ext-dn ``` ```bash Creating network "l2sim-oai-public-net" with driver "bridge" Creating network "l2sim-oai-traffic_net-net" with driver "bridge" -Creating l2sim-oai-nrf ... done Creating l2sim-mysql ... done -Creating l2sim-oai-spgwu ... done +Creating l2sim-oai-upf ... done Creating l2sim-oai-amf ... done Creating l2sim-oai-smf ... done Creating l2sim-oai-ext-dn ... done @@ -160,12 +158,11 @@ docker-compose ps -a ```bash Name Command State Ports ------------------------------------------------------------------------------------------------- -l2sim-mysql docker-entrypoint.sh mysqld Up (healthy) 3306/tcp, 33060/tcp +l2sim-mysql docker-entrypoint.sh mysqld Up (healthy) 3306/tcp, 33060/tcp l2sim-oai-amf /bin/bash /openair-amf/bin ... Up (healthy) 38412/sctp, 80/tcp, 9090/tcp -l2sim-oai-ext-dn /bin/bash -c apt update; ... Up (healthy) -l2sim-oai-nrf /bin/bash /openair-nrf/bin ... Up (healthy) 80/tcp, 9090/tcp -l2sim-oai-smf /bin/bash /openair-smf/bin ... Up (healthy) 80/tcp, 8805/udp, 9090/tcp -l2sim-oai-spgwu /openair-spgwu-tiny/bin/en ... Up (healthy) 2152/udp, 8805/udp +l2sim-oai-ext-dn /bin/bash -c apt update; ... Up (healthy) +l2sim-oai-smf /bin/bash /openair-smf/bin ... Up (healthy) 80/tcp, 8805/udp, 9090/tcp +l2sim-oai-upf /bin/bash /openair-upf/bin ... Up (healthy) 2152/udp, 8805/udp ``` At this point, you can prepare a capture on the newly-created public docker bridges: @@ -206,8 +203,7 @@ sudo nohup tshark -f "(host 192.168.72.135 and icmp) or (not host 192.168.72.135 docker-compose up -d oai-gnb ``` ```bash -l2sim-oai-nrf is up-to-date -l2sim-oai-spgwu is up-to-date +l2sim-oai-upf is up-to-date l2sim-oai-ext-dn is up-to-date Creating l2sim-oai-gnb ... done ``` @@ -220,13 +216,12 @@ $ docker-compose ps -a ```bash Name Command State Ports ------------------------------------------------------------------------------------------------- -l2sim-mysql docker-entrypoint.sh mysqld Up (healthy) 3306/tcp, 33060/tcp +l2sim-mysql docker-entrypoint.sh mysqld Up (healthy) 3306/tcp, 33060/tcp l2sim-oai-amf /bin/bash /openair-amf/bin ... Up (healthy) 38412/sctp, 80/tcp, 9090/tcp -l2sim-oai-ext-dn /bin/bash -c apt update; ... Up (healthy) -l2sim-oai-gnb /opt/oai-gnb/bin/entrypoin ... Up (healthy) -l2sim-oai-nrf /bin/bash /openair-nrf/bin ... Up (healthy) 80/tcp, 9090/tcp -l2sim-oai-smf /bin/bash /openair-smf/bin ... Up (healthy) 80/tcp, 8805/udp, 9090/tcp -l2sim-oai-spgwu /openair-spgwu-tiny/bin/en ... Up (healthy) 2152/udp, 8805/udp +l2sim-oai-ext-dn /bin/bash -c apt update; ... Up (healthy) +l2sim-oai-gnb /opt/oai-gnb/bin/entrypoin ... Up (healthy) +l2sim-oai-smf /bin/bash /openair-smf/bin ... Up (healthy) 80/tcp, 8805/udp, 9090/tcp +l2sim-oai-upf /bin/bash /openair-upf/bin ... Up (healthy) 2152/udp, 8805/udp ``` You can verify that the `gNB` is connected with the `AMF`: @@ -250,10 +245,9 @@ docker-compose up -d proxy oai-nr-ue ``` ```bash l2sim-mysql is up-to-date -l2sim-oai-nrf is up-to-date l2sim-oai-amf is up-to-date l2sim-oai-smf is up-to-date -l2sim-oai-spgwu is up-to-date +l2sim-oai-upf is up-to-date l2sim-oai-ext-dn is up-to-date l2sim-oai-gnb is up-to-date Creating l2sim-oai-nr-ue ... done @@ -268,18 +262,17 @@ docker-compose ps -a ```bash Name Command State Ports ------------------------------------------------------------------------------------------------- -l2sim-mysql docker-entrypoint.sh mysqld Up (healthy) 3306/tcp, 33060/tcp +l2sim-mysql docker-entrypoint.sh mysqld Up (healthy) 3306/tcp, 33060/tcp l2sim-oai-amf /bin/bash /openair-amf/bin ... Up (healthy) 38412/sctp, 80/tcp, 9090/tcp -l2sim-oai-ext-dn /bin/bash -c apt update; ... Up (healthy) -l2sim-oai-gnb /opt/oai-gnb/bin/entrypoin ... Up (healthy) -l2sim-oai-nr-ue0 /opt/oai-nr-ue/bin/entrypo ... Up (healthy) -l2sim-oai-nrf /bin/bash /openair-nrf/bin ... Up (healthy) 80/tcp, 9090/tcp -l2sim-oai-smf /bin/bash /openair-smf/bin ... Up (healthy) 80/tcp, 8805/udp, 9090/tcp -l2sim-oai-spgwu /openair-spgwu-tiny/bin/en ... Up (healthy) 2152/udp, 8805/udp -l2sim-proxy /oai-lte-multi-ue-proxy/bi ... Up (healthy) +l2sim-oai-ext-dn /bin/bash -c apt update; ... Up (healthy) +l2sim-oai-gnb /opt/oai-gnb/bin/entrypoin ... Up (healthy) +l2sim-oai-nr-ue0 /opt/oai-nr-ue/bin/entrypo ... Up (healthy) +l2sim-oai-smf /bin/bash /openair-smf/bin ... Up (healthy) 80/tcp, 8805/udp, 9090/tcp +l2sim-oai-upf /bin/bash /openair-upf/bin ... Up (healthy) 2152/udp, 8805/udp +l2sim-proxy /oai-lte-multi-ue-proxy/bi ... Up (healthy) ``` ```bash -docker stats --no-stream --format "table {{.Container}}\t{{.CPUPerc}} {{.MemUsage}}\t{{.MemPerc}}" l2sim-mysql l2sim-oai-amf l2sim-oai-ext-dn l2sim-oai-gnb l2sim-oai-nr-ue0 l2sim-oai-nrf l2sim-oai-smf l2sim-oai-spgwu l2sim-proxy +docker stats --no-stream --format "table {{.Container}}\t{{.CPUPerc}} {{.MemUsage}}\t{{.MemPerc}}" l2sim-mysql l2sim-oai-amf l2sim-oai-ext-dn l2sim-oai-gnb l2sim-oai-nr-ue0 l2sim-oai-smf l2sim-oai-upf l2sim-proxy ``` ```bash CONTAINER CPU % MEM USAGE / LIMIT MEM % @@ -288,9 +281,8 @@ l2sim-oai-amf 4.05% 29.49MiB / 62.54GiB 0.05% l2sim-oai-ext-dn 0.00% 31.27MiB / 62.54GiB 0.05% l2sim-oai-gnb 1.29% 1.853GiB / 62.54GiB 2.96% l2sim-oai-nr-ue0 1.43% 350.8MiB / 62.54GiB 0.55% -l2sim-oai-nrf 0.21% 9.105MiB / 62.54GiB 0.01% l2sim-oai-smf 3.24% 30.23MiB / 62.54GiB 0.05% -l2sim-oai-spgwu 0.00% 11.78MiB / 62.54GiB 0.02% +l2sim-oai-upf 0.00% 11.78MiB / 62.54GiB 0.02% l2sim-proxy 6.97% 290.4MiB / 62.54GiB 0.45% ``` @@ -389,19 +381,17 @@ Stopping l2sim-oai-nr-ue2 ... done Stopping l2sim-oai-nr-ue ... done Stopping l2sim-oai-gnb ... done Stopping l2sim-oai-ext-dn ... done -Stopping l2sim-oai-spgwu ... done +Stopping l2sim-oai-upf ... done Stopping l2sim-oai-smf ... done Stopping l2sim-oai-amf ... done -Stopping l2sim-oai-nrf ... done Stopping l2sim-mysql ... done Removing l2sim-oai-nr-ue2 ... done Removing l2sim-oai-nr-ue ... done Removing l2sim-oai-gnb ... done Removing l2sim-oai-ext-dn ... done -Removing l2sim-oai-spgwu ... done +Removing l2sim-oai-upf ... done Removing l2sim-oai-smf ... done Removing l2sim-oai-amf ... done -Removing l2sim-oai-nrf ... done Removing l2sim-mysql ... done Removing network l2sim-oai-public-net Removing network l2sim-oai-traffic-net diff --git a/ci-scripts/yaml_files/5g_l2sim_tdd/docker-compose.yaml b/ci-scripts/yaml_files/5g_l2sim_tdd/docker-compose.yaml index 38b82988f9..28412dbfe4 100644 --- a/ci-scripts/yaml_files/5g_l2sim_tdd/docker-compose.yaml +++ b/ci-scripts/yaml_files/5g_l2sim_tdd/docker-compose.yaml @@ -1,14 +1,5 @@ version: '3.8' services: - oai-nrf: - container_name: "l2sim-oai-nrf" - image: oaisoftwarealliance/oai-nrf:v1.5.0 - environment: - - NRF_INTERFACE_NAME_FOR_SBI=eth0 - - TZ=Europe/Paris - networks: - public_net: - ipv4_address: 192.168.71.130 mysql: container_name: "l2sim-mysql" image: mysql:8.0 @@ -31,108 +22,36 @@ services: ipv4_address: 192.168.71.131 oai-amf: container_name: "l2sim-oai-amf" - image: oaisoftwarealliance/oai-amf:v1.5.0 + image: oaisoftwarealliance/oai-amf:v2.0.0 environment: - TZ=Europe/paris - - MCC=208 - - MNC=99 - - REGION_ID=128 - - AMF_SET_ID=1 - - SERVED_GUAMI_MCC_0=208 - - SERVED_GUAMI_MNC_0=99 - - SERVED_GUAMI_REGION_ID_0=128 - - SERVED_GUAMI_AMF_SET_ID_0=1 - - SERVED_GUAMI_MCC_1=460 - - SERVED_GUAMI_MNC_1=11 - - SERVED_GUAMI_REGION_ID_1=10 - - SERVED_GUAMI_AMF_SET_ID_1=1 - - PLMN_SUPPORT_MCC=208 - - PLMN_SUPPORT_MNC=99 - - PLMN_SUPPORT_TAC=0x0001 - # Only one slice is defined (1, 0xFFFFFF). - - SST_0=1 - - AMF_INTERFACE_NAME_FOR_NGAP=eth0 - - AMF_INTERFACE_NAME_FOR_N11=eth0 - # One single SMF instance - - SMF_INSTANCE_ID_0=1 - - SMF_FQDN_0=oai-smf - - SMF_IPV4_ADDR_0=192.168.71.133 - - SELECTED_0=true - # mysql definition in AMF is mandatory in mini deployment. - - MYSQL_SERVER=192.168.71.131 - - MYSQL_USER=root - - MYSQL_PASS=linux - - MYSQL_DB=oai_db - # NF registration - - NRF_IPV4_ADDRESS=192.168.71.130 - - NRF_FQDN=oai-nrf - - NF_REGISTRATION=yes - - SMF_SELECTION=yes - - USE_FQDN_DNS=yes - - USE_HTTP2=no + volumes: + - ../5g_rfsimulator/mini_nonrf_config.yaml:/openair-amf/etc/config.yaml depends_on: - - oai-nrf - mysql networks: public_net: ipv4_address: 192.168.71.132 oai-smf: container_name: "l2sim-oai-smf" - image: oaisoftwarealliance/oai-smf:v1.5.0 + image: oaisoftwarealliance/oai-smf:v2.0.0 environment: - TZ=Europe/Paris - - SMF_INTERFACE_NAME_FOR_N4=eth0 - - SMF_INTERFACE_NAME_FOR_SBI=eth0 - - DEFAULT_DNS_IPV4_ADDRESS=172.21.3.100 - - DEFAULT_DNS_SEC_IPV4_ADDRESS=4.4.4.4 - - AMF_IPV4_ADDRESS=192.168.71.132 - - AMF_FQDN=oai-amf - - UPF_IPV4_ADDRESS=192.168.71.134 - - UPF_FQDN_0=oai-spgwu - - NRF_IPV4_ADDRESS=192.168.71.130 - - NRF_FQDN=oai-nrf - - REGISTER_NRF=yes - - DISCOVER_UPF=yes - - USE_FQDN_DNS=yes - - USE_LOCAL_SUBSCRIPTION_INFO=yes - - UE_MTU=1500 - # Only one slice is defined (1, 0xFFFFFF) - - DNN_NI0=oai - - TYPE0=IPv4 - - DNN_RANGE0=12.1.1.2 - 12.1.1.127 - - NSSAI_SST0=1 - - SESSION_AMBR_UL0=200Mbps - - SESSION_AMBR_DL0=400Mbps - - DEFAULT_CSCF_IPV4_ADDRESS=127.0.0.1 - - ENABLE_USAGE_REPORTING=no + volumes: + - ../5g_rfsimulator/mini_nonrf_config.yaml:/openair-smf/etc/config.yaml depends_on: - - oai-nrf - oai-amf networks: public_net: ipv4_address: 192.168.71.133 - oai-spgwu: - container_name: "l2sim-oai-spgwu" - image: oaisoftwarealliance/oai-spgwu-tiny:v1.5.0 + oai-upf: + container_name: "l2sim-oai-upf" + image: oaisoftwarealliance/oai-upf:v2.0.0 environment: - TZ=Europe/Paris - - SGW_INTERFACE_NAME_FOR_S1U_S12_S4_UP=eth0 - - SGW_INTERFACE_NAME_FOR_SX=eth0 - - PGW_INTERFACE_NAME_FOR_SGI=eth0 - - NETWORK_UE_NAT_OPTION=yes - - NETWORK_UE_IP=12.1.1.0/24 - - ENABLE_5G_FEATURES=yes - - REGISTER_NRF=yes - - USE_FQDN_NRF=yes - - UPF_FQDN_5G=oai-spgwu - - NRF_IPV4_ADDRESS=192.168.71.130 - - NRF_FQDN=oai-nrf - # Only one slice is defined (1, 0xFFFFFF) - - NSSAI_SST_0=1 - - NSSAI_SD_0=0xffffff - - DNN_0=oai + volumes: + - ../5g_rfsimulator/mini_nonrf_config.yaml:/openair-upf/etc/config.yaml depends_on: - - oai-nrf - oai-smf cap_add: - NET_ADMIN @@ -153,7 +72,7 @@ services: "iptables -t nat -A POSTROUTING -o eth0 -j MASQUERADE;"\ "ip route add 12.1.1.0/24 via 192.168.72.134 dev eth0; sleep infinity" depends_on: - - oai-spgwu + - oai-upf networks: traffic_net: ipv4_address: 192.168.72.135 @@ -172,7 +91,7 @@ services: USE_ADDITIONAL_OPTIONS: --sa --nfapi VNF --emulate-l1 --log_config.global_log_options level,time,thread_id,nocolor ASAN_OPTIONS: detect_leaks=0 depends_on: - - oai-spgwu + - oai-upf - oai-amf volumes: - ../../conf_files/gnb.sa.band78.106prb.l2sim.conf:/opt/oai-gnb/etc/gnb.conf From 1d6457ee1903e4b71d68fca122f3c1b1310f32bd Mon Sep 17 00:00:00 2001 From: Jaroslava Fiedlerova Date: Fri, 19 Jan 2024 19:34:58 +0100 Subject: [PATCH 29/29] Fix T tracer dependency issue - patch from Cedric --- openair2/E2AP/CMakeLists.txt | 1 + 1 file changed, 1 insertion(+) diff --git a/openair2/E2AP/CMakeLists.txt b/openair2/E2AP/CMakeLists.txt index c7f79ae06f..d86dafb0b9 100644 --- a/openair2/E2AP/CMakeLists.txt +++ b/openair2/E2AP/CMakeLists.txt @@ -129,3 +129,4 @@ add_subdirectory(flexric/src/util) add_subdirectory(RAN_FUNCTION) add_library(e2_agent_arg STATIC e2_agent_arg.c) +add_dependencies(e2_agent_arg generate_T)