From a8405595000b191c08fb09f200848928e155ed74 Mon Sep 17 00:00:00 2001 From: Robert Schmidt Date: Thu, 10 Mar 2022 09:21:11 +0100 Subject: [PATCH 01/88] Implement PUSCH RBs according to PHR --- .../LAYER2/NR_MAC_gNB/gNB_scheduler_ulsch.c | 36 +++++++++++++++++++ 1 file changed, 36 insertions(+) diff --git a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_ulsch.c b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_ulsch.c index f654e8e1a6..d2e0a6ba35 100644 --- a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_ulsch.c +++ b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_ulsch.c @@ -881,6 +881,38 @@ static bool nr_UE_is_to_be_scheduled(const NR_ServingCellConfigCommon_t *scc, return has_data || sched_ctrl->SR || high_inactivity; } +int estimate_nr_ue_tx_power(int mu, uint32_t tbs, int rb) +{ + /* TODO: delta_mcs? */ + + const int bw_factor = 10 * log10(rb << mu); + return bw_factor; +} + +int nr_ue_max_rbSize_phr(int mu, const NR_UE_sched_ctrl_t *sched_ctrl, uint16_t minRb, uint16_t *maxRb, uint8_t *mcs) +{ + AssertFatal(*maxRb >= minRb, "illegal maxRb %d < minRb %d\n", *maxRb, minRb); + AssertFatal(*mcs >= 0 && *mcs <= 28, "illegal MCS %d\n", *mcs); + + const int ph = sched_ctrl->ph; + //const int pcmax = sched_ctrl->pcmax; + + int tx_power = estimate_nr_ue_tx_power(mu, /* unused tbs */ 0, *maxRb); + while (ph < tx_power && *maxRb >= minRb) { + (*maxRb)--; + tx_power = estimate_nr_ue_tx_power(mu, /* unused tbs */ 0, *maxRb); + } + + while (ph < tx_power && *mcs > 6) { + (*mcs)--; + tx_power = estimate_nr_ue_tx_power(mu, /* unused tbs */ 0, *maxRb); + } + + if (ph < tx_power) + LOG_W(NR_MAC, "PH %d < tx_power %d (RBs %d, MCS %d)\n", ph, tx_power, *maxRb, *mcs); + return tx_power; +} + static bool allocate_ul_retransmission(gNB_MAC_INST *nrmac, frame_t frame, sub_frame_t slot, @@ -1348,6 +1380,10 @@ void pf_ul(module_id_t module_id, else LOG_D(NR_MAC,"allocating UL data for RNTI %04x (rbStsart %d, min_rb %d, bwpSize %d)\n", iterator->UE->rnti,rbStart,min_rb,bwpSize); + /* reduce max_rbSize according to PHR */ + const int mu = scc->uplinkConfigCommon->initialUplinkBWP->genericParameters.subcarrierSpacing; + const int tx_power = nr_ue_max_rbSize_phr(mu, sched_ctrl, min_rbSize, &max_rbSize, &sched_pusch->mcs); + /* Calculate the current scheduling bytes and the necessary RBs */ const int B = cmax(sched_ctrl->estimated_ul_buffer - sched_ctrl->sched_ul_bytes, 0); uint16_t rbSize = 0; From 83149e5100ec91874f41539533b79c2e9e211aeb Mon Sep 17 00:00:00 2001 From: Robert Schmidt Date: Thu, 24 Mar 2022 18:46:22 +0100 Subject: [PATCH 02/88] Base graph selection: create function in nr_common.c --- common/utils/nr/nr_common.c | 7 +++++++ common/utils/nr/nr_common.h | 1 + openair1/PHY/NR_TRANSPORT/nr_dlsch_coding.c | 5 +---- 3 files changed, 9 insertions(+), 4 deletions(-) diff --git a/common/utils/nr/nr_common.c b/common/utils/nr/nr_common.c index 6add03c324..1f925d08f0 100644 --- a/common/utils/nr/nr_common.c +++ b/common/utils/nr/nr_common.c @@ -494,3 +494,10 @@ void SLIV2SL(int SLIV,int *S,int *L) { *S=13-SLIVmod14; } } + +int get_BG(uint32_t A, float code_rate) { + if ((A <=292) || ((A<=3824) && (code_rate <= 0.6667)) || code_rate <= 0.25) + return 2; + else + return 1; +} diff --git a/common/utils/nr/nr_common.h b/common/utils/nr/nr_common.h index 5f7f670ce9..c286c0ad6a 100644 --- a/common/utils/nr/nr_common.h +++ b/common/utils/nr/nr_common.h @@ -76,6 +76,7 @@ uint16_t SL_to_bitmap(int startSymbolIndex, int nrOfSymbols); int get_nb_periods_per_frame(uint8_t tdd_period); int get_supported_band_index(int scs, int band, int n_rbs); long rrc_get_max_nr_csrs(uint8_t max_rbs, long b_SRS); +int get_BG(uint32_t A, float code_rate); #define CEILIDIV(a,b) ((a+b-1)/b) #define ROUNDIDIV(a,b) (((a<<1)+b)/(b<<1)) diff --git a/openair1/PHY/NR_TRANSPORT/nr_dlsch_coding.c b/openair1/PHY/NR_TRANSPORT/nr_dlsch_coding.c index f0f9f4fe34..0e82de276d 100644 --- a/openair1/PHY/NR_TRANSPORT/nr_dlsch_coding.c +++ b/openair1/PHY/NR_TRANSPORT/nr_dlsch_coding.c @@ -380,10 +380,7 @@ int nr_dlsch_encoding(PHY_VARS_gNB *gNB, float Coderate = (float) rel15->targetCodeRate[0] / 10240.0f; LOG_D(PHY,"DLSCH Coderate %f\n",Coderate); - if ((A <=292) || ((A<=3824) && (Coderate <= 0.6667)) || Coderate <= 0.25) - impp.BG = 2; - else - impp.BG = 1; + impp.BG = get_BG(A, Coderate); start_meas(dlsch_segmentation_stats); impp.Kb = nr_segmentation(harq->b, harq->c, harq->B, &impp.n_segments, &impp.K, impp.Zc, &impp.F, impp.BG); From 04a09c999cef71da62e2846fd3cbabc6272dc9cc Mon Sep 17 00:00:00 2001 From: Robert Schmidt Date: Thu, 24 Mar 2022 20:37:04 +0100 Subject: [PATCH 03/88] Implement delta MCS in UL Power estimation --- .../LAYER2/NR_MAC_gNB/gNB_scheduler_ulsch.c | 81 ++++++++++++------- openair2/RRC/NR/MESSAGES/asn1_msg.c | 3 +- openair2/RRC/NR/rrc_gNB_reconfig.c | 6 +- 3 files changed, 59 insertions(+), 31 deletions(-) diff --git a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_ulsch.c b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_ulsch.c index d2e0a6ba35..fa31e0a92c 100644 --- a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_ulsch.c +++ b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_ulsch.c @@ -881,31 +881,65 @@ static bool nr_UE_is_to_be_scheduled(const NR_ServingCellConfigCommon_t *scc, return has_data || sched_ctrl->SR || high_inactivity; } -int estimate_nr_ue_tx_power(int mu, uint32_t tbs, int rb) +int estimate_nr_ue_tx_power(int mu, uint32_t tbs_bits, int code_rate, int rb, int n_symbols) { - /* TODO: delta_mcs? */ + /* see TS 38.213 Sec 7.1.1 */ + + const unsigned int CRC = (tbs_bits >> 3) > 3824 ? 24 : 16; /* from nr_dlsch_encoding(): 24 or 16 bits CRC */ + const unsigned int B = tbs_bits + CRC; + unsigned int C; /* number of code blocks */ + unsigned int K; /* total code block size */ + unsigned int Zout; /* unused */ + unsigned int F; /* unused */ + /* to scale MCS 20 and 26 in 214 Tab 5.1.3.1-2 (decimal and input 2* in * nr_target_code_rate_table2) */ + const float targetCodeRate = code_rate < 1000 ? (float) code_rate / 1024.0f : (float) code_rate / 2048.0f; + const unsigned int BG = get_BG(tbs_bits, targetCodeRate); + const int32_t Kb = nr_segmentation(NULL, NULL, B, &C, &K, &Zout, &F, BG); + AssertFatal(Kb >= 0, "problem with segmentation for B %d BG %d\n", B, BG); + + const unsigned int Nre = 12 * rb * n_symbols; + const unsigned int BPRE = C * K / Nre; + const float f = pow(2, (float) BPRE * 1.25); + const float beta = 1.0f; + const int delta_tf = 10 * log10((f - 1) * beta); const int bw_factor = 10 * log10(rb << mu); - return bw_factor; + LOG_D(NR_MAC, "estimated UE TX power %d (Nre %d C %d K %d Nre %d BPRE %d delta_tf %d rb %d bw_factor %d)\n", + bw_factor + delta_tf, Nre, C, K, Nre, BPRE, delta_tf, rb, bw_factor); + return bw_factor + delta_tf; } -int nr_ue_max_rbSize_phr(int mu, const NR_UE_sched_ctrl_t *sched_ctrl, uint16_t minRb, uint16_t *maxRb, uint8_t *mcs) +void update_ul_ue_R_Qm(int mcs, const NR_pusch_semi_static_t *ps, uint16_t *R, uint8_t *Qm) +{ + *R = nr_get_code_rate_ul(mcs, ps->mcs_table); + *Qm = nr_get_Qm_ul(mcs, ps->mcs_table); + + if (ps->pusch_Config && ps->pusch_Config->tp_pi2BPSK && ((ps->mcs_table == 3 && mcs < 2) || (ps->mcs_table == 4 && mcs < 6))) { + *R >>= 1; + *Qm <<= 1; + } +} + +int nr_ue_max_mcs_min_rb(int mu, int ph, NR_pusch_semi_static_t *ps, uint16_t minRb, int tbs, uint16_t *maxRb, uint8_t *mcs) { AssertFatal(*maxRb >= minRb, "illegal maxRb %d < minRb %d\n", *maxRb, minRb); AssertFatal(*mcs >= 0 && *mcs <= 28, "illegal MCS %d\n", *mcs); - const int ph = sched_ctrl->ph; - //const int pcmax = sched_ctrl->pcmax; + const int tbs_bits = tbs << 3; + uint16_t R; + uint8_t Qm; + update_ul_ue_R_Qm(*mcs, ps, &R, &Qm); - int tx_power = estimate_nr_ue_tx_power(mu, /* unused tbs */ 0, *maxRb); + int tx_power = estimate_nr_ue_tx_power(mu, tbs_bits, R, *maxRb, ps->nrOfSymbols); while (ph < tx_power && *maxRb >= minRb) { (*maxRb)--; - tx_power = estimate_nr_ue_tx_power(mu, /* unused tbs */ 0, *maxRb); + tx_power = estimate_nr_ue_tx_power(mu, tbs_bits, R, *maxRb, ps->nrOfSymbols); } while (ph < tx_power && *mcs > 6) { (*mcs)--; - tx_power = estimate_nr_ue_tx_power(mu, /* unused tbs */ 0, *maxRb); + update_ul_ue_R_Qm(*mcs, ps, &R, &Qm); + tx_power = estimate_nr_ue_tx_power(mu, tbs_bits, R, *maxRb, ps->nrOfSymbols); } if (ph < tx_power) @@ -1078,18 +1112,6 @@ static bool allocate_ul_retransmission(gNB_MAC_INST *nrmac, return true; } -void update_ul_ue_R_Qm(NR_sched_pusch_t *sched_pusch, const NR_pusch_semi_static_t *ps) -{ - const int mcs = sched_pusch->mcs; - sched_pusch->R = nr_get_code_rate_ul(mcs, ps->mcs_table); - sched_pusch->Qm = nr_get_Qm_ul(mcs, ps->mcs_table); - - if (ps->pusch_Config && ps->pusch_Config->tp_pi2BPSK && ((ps->mcs_table == 3 && mcs < 2) || (ps->mcs_table == 4 && mcs < 6))) { - sched_pusch->R >>= 1; - sched_pusch->Qm <<= 1; - } -} - uint32_t ul_pf_tbs[3][29]; // pre-computed, approximate TBS values for PF coefficient typedef struct UEsched_s { float coef; @@ -1260,7 +1282,7 @@ void pf_ul(module_id_t module_id, NR_sched_pusch_t *sched_pusch = &sched_ctrl->sched_pusch; sched_pusch->mcs = min(nrmac->min_grant_mcs, sched_pusch->mcs); - update_ul_ue_R_Qm(sched_pusch, ps); + update_ul_ue_R_Qm(sched_pusch->mcs, ps, &sched_pusch->R, &sched_pusch->Qm); sched_pusch->rbStart = rbStart; sched_pusch->rbSize = min_rb; sched_pusch->tb_size = nr_compute_tbs(sched_pusch->Qm, @@ -1362,7 +1384,7 @@ void pf_ul(module_id_t module_id, nrOfLayers, ps); } - update_ul_ue_R_Qm(sched_pusch, ps); + update_ul_ue_R_Qm(sched_pusch->mcs, ps, &sched_pusch->R, &sched_pusch->Qm); const uint16_t slbitmap = SL_to_bitmap(ps->startSymbolIndex, ps->nrOfSymbols); while (rbStart < bwpSize && (rballoc_mask[rbStart] & slbitmap) != slbitmap) @@ -1380,12 +1402,15 @@ void pf_ul(module_id_t module_id, else LOG_D(NR_MAC,"allocating UL data for RNTI %04x (rbStsart %d, min_rb %d, bwpSize %d)\n", iterator->UE->rnti,rbStart,min_rb,bwpSize); - /* reduce max_rbSize according to PHR */ - const int mu = scc->uplinkConfigCommon->initialUplinkBWP->genericParameters.subcarrierSpacing; - const int tx_power = nr_ue_max_rbSize_phr(mu, sched_ctrl, min_rbSize, &max_rbSize, &sched_pusch->mcs); - - /* Calculate the current scheduling bytes and the necessary RBs */ + /* Calculate the current scheduling bytes */ const int B = cmax(sched_ctrl->estimated_ul_buffer - sched_ctrl->sched_ul_bytes, 0); + + /* reduce max_rbSize according to PHR and BPRE */ + const int mu = scc->uplinkConfigCommon->initialUplinkBWP->genericParameters.subcarrierSpacing; + nr_ue_max_mcs_min_rb(mu, sched_ctrl->ph, ps, min_rbSize, B, &max_rbSize, &sched_pusch->mcs); + if (sched_pusch->mcs < sched_ctrl->ul_bler_stats.mcs) + sched_ctrl->ul_bler_stats.mcs = sched_pusch->mcs; /* force estimated MCS down */ + uint16_t rbSize = 0; uint32_t TBS = 0; diff --git a/openair2/RRC/NR/MESSAGES/asn1_msg.c b/openair2/RRC/NR/MESSAGES/asn1_msg.c index a93d2a8623..af7710cae0 100755 --- a/openair2/RRC/NR/MESSAGES/asn1_msg.c +++ b/openair2/RRC/NR/MESSAGES/asn1_msg.c @@ -1413,7 +1413,8 @@ void fill_initial_SpCellConfig(int uid, ASN_SEQUENCE_ADD(&pusch_Config->pusch_PowerControl->pathlossReferenceRSToAddModList->list,plrefRS); pusch_Config->pusch_PowerControl->pathlossReferenceRSToReleaseList = NULL; pusch_Config->pusch_PowerControl->twoPUSCH_PC_AdjustmentStates = NULL; - pusch_Config->pusch_PowerControl->deltaMCS = NULL; + pusch_Config->pusch_PowerControl->deltaMCS = calloc(1, sizeof(*pusch_Config->pusch_PowerControl->deltaMCS)); + *pusch_Config->pusch_PowerControl->deltaMCS = NR_PUSCH_PowerControl__deltaMCS_enabled; pusch_Config->pusch_PowerControl->sri_PUSCH_MappingToAddModList = calloc(1,sizeof(*pusch_Config->pusch_PowerControl->sri_PUSCH_MappingToAddModList)); NR_SRI_PUSCH_PowerControl_t *sriPUSCHPC=calloc(1,sizeof(*sriPUSCHPC)); sriPUSCHPC->sri_PUSCH_PowerControlId=0; diff --git a/openair2/RRC/NR/rrc_gNB_reconfig.c b/openair2/RRC/NR/rrc_gNB_reconfig.c index 2ee3a26c4b..57d8557ca1 100644 --- a/openair2/RRC/NR/rrc_gNB_reconfig.c +++ b/openair2/RRC/NR/rrc_gNB_reconfig.c @@ -401,7 +401,8 @@ void fill_default_nsa_uplinkBWP(NR_BWP_Uplink_t *ubwp, pusch_Config->pusch_PowerControl->pathlossReferenceRSToAddModList = NULL; pusch_Config->pusch_PowerControl->pathlossReferenceRSToReleaseList = NULL; pusch_Config->pusch_PowerControl->twoPUSCH_PC_AdjustmentStates = NULL; - pusch_Config->pusch_PowerControl->deltaMCS = NULL; + pusch_Config->pusch_PowerControl->deltaMCS = calloc(1, sizeof(*pusch_Config->pusch_PowerControl->deltaMCS)); + *pusch_Config->pusch_PowerControl->deltaMCS = NR_PUSCH_PowerControl__deltaMCS_enabled; pusch_Config->pusch_PowerControl->sri_PUSCH_MappingToAddModList = NULL; pusch_Config->pusch_PowerControl->sri_PUSCH_MappingToReleaseList = NULL; pusch_Config->frequencyHopping=NULL; @@ -858,7 +859,8 @@ void fill_default_secondaryCellGroup(NR_ServingCellConfigCommon_t *servingcellco pusch_Config->pusch_PowerControl->pathlossReferenceRSToAddModList = NULL; pusch_Config->pusch_PowerControl->pathlossReferenceRSToReleaseList = NULL; pusch_Config->pusch_PowerControl->twoPUSCH_PC_AdjustmentStates = NULL; - pusch_Config->pusch_PowerControl->deltaMCS = NULL; + pusch_Config->pusch_PowerControl->deltaMCS = calloc(1, sizeof(*pusch_Config->pusch_PowerControl->deltaMCS)); + *pusch_Config->pusch_PowerControl->deltaMCS = NR_PUSCH_PowerControl__deltaMCS_enabled; pusch_Config->pusch_PowerControl->sri_PUSCH_MappingToAddModList = NULL; pusch_Config->pusch_PowerControl->sri_PUSCH_MappingToReleaseList = NULL; pusch_Config->frequencyHopping=NULL; From 478ea7ab6c0a59471ad4cdf3ad902285ed03ac91 Mon Sep 17 00:00:00 2001 From: francescomani Date: Thu, 28 Jul 2022 15:10:03 +0200 Subject: [PATCH 04/88] BG at MAC as part of new FAPI version --- common/utils/nr/nr_common.c | 6 ------ common/utils/nr/nr_common.h | 1 - .../open-nFAPI/nfapi/public_inc/nfapi_nr_interface_scf.h | 2 ++ openair1/PHY/NR_TRANSPORT/nr_dlsch_coding.c | 6 +----- openair1/PHY/NR_TRANSPORT/nr_ulsch_decoding.c | 7 +++---- openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_RA.c | 4 ++++ openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_bch.c | 1 + openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_dlsch.c | 1 + openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_primitives.c | 9 +++++++++ openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_ulsch.c | 1 + openair2/LAYER2/NR_MAC_gNB/mac_proto.h | 2 +- 11 files changed, 23 insertions(+), 17 deletions(-) diff --git a/common/utils/nr/nr_common.c b/common/utils/nr/nr_common.c index 1f925d08f0..12ed9a8589 100644 --- a/common/utils/nr/nr_common.c +++ b/common/utils/nr/nr_common.c @@ -495,9 +495,3 @@ void SLIV2SL(int SLIV,int *S,int *L) { } } -int get_BG(uint32_t A, float code_rate) { - if ((A <=292) || ((A<=3824) && (code_rate <= 0.6667)) || code_rate <= 0.25) - return 2; - else - return 1; -} diff --git a/common/utils/nr/nr_common.h b/common/utils/nr/nr_common.h index c286c0ad6a..5f7f670ce9 100644 --- a/common/utils/nr/nr_common.h +++ b/common/utils/nr/nr_common.h @@ -76,7 +76,6 @@ uint16_t SL_to_bitmap(int startSymbolIndex, int nrOfSymbols); int get_nb_periods_per_frame(uint8_t tdd_period); int get_supported_band_index(int scs, int band, int n_rbs); long rrc_get_max_nr_csrs(uint8_t max_rbs, long b_SRS); -int get_BG(uint32_t A, float code_rate); #define CEILIDIV(a,b) ((a+b-1)/b) #define ROUNDIDIV(a,b) (((a<<1)+b)/(b<<1)) 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 488129ceec..a2e3c57f5d 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 @@ -777,6 +777,7 @@ typedef struct { } nfapi_nr_dl_tti_pdcch_pdu_rel15_t; typedef struct { + uint8_t ldpcBaseGraph; uint32_t tbSizeLbrmBytes; }nfapi_v3_pdsch_maintenance_parameters_t; @@ -1193,6 +1194,7 @@ typedef struct #define PUSCH_PDU_BITMAP_DFTS_OFDM 0x8 typedef struct { + uint8_t ldpcBaseGraph; uint32_t tbSizeLbrmBytes; }nfapi_v3_pusch_maintenance_parameters_t; diff --git a/openair1/PHY/NR_TRANSPORT/nr_dlsch_coding.c b/openair1/PHY/NR_TRANSPORT/nr_dlsch_coding.c index 0e82de276d..b36ad7822b 100644 --- a/openair1/PHY/NR_TRANSPORT/nr_dlsch_coding.c +++ b/openair1/PHY/NR_TRANSPORT/nr_dlsch_coding.c @@ -376,11 +376,7 @@ int nr_dlsch_encoding(PHY_VARS_gNB *gNB, memcpy(harq->b, a, (A / 8) + 3); // using 3 bytes to mimic the case of 24 bit crc } - // target_code_rate is in 0.1 units - float Coderate = (float) rel15->targetCodeRate[0] / 10240.0f; - LOG_D(PHY,"DLSCH Coderate %f\n",Coderate); - - impp.BG = get_BG(A, Coderate); + impp.BG = rel15->maintenance_parms_v3.ldpcBaseGraph; start_meas(dlsch_segmentation_stats); impp.Kb = nr_segmentation(harq->b, harq->c, harq->B, &impp.n_segments, &impp.K, impp.Zc, &impp.F, impp.BG); diff --git a/openair1/PHY/NR_TRANSPORT/nr_ulsch_decoding.c b/openair1/PHY/NR_TRANSPORT/nr_ulsch_decoding.c index b9a1430be6..813a3cc23a 100644 --- a/openair1/PHY/NR_TRANSPORT/nr_ulsch_decoding.c +++ b/openair1/PHY/NR_TRANSPORT/nr_ulsch_decoding.c @@ -382,7 +382,6 @@ uint32_t nr_ulsch_decoding(PHY_VARS_gNB *phy_vars_gNB, uint32_t r; uint32_t r_offset; uint32_t offset; - int kc; int E; #ifdef PRINT_CRC_CHECK @@ -445,8 +444,9 @@ uint32_t nr_ulsch_decoding(PHY_VARS_gNB *phy_vars_gNB, LOG_D(PHY,"ULSCH Decoding, harq_pid %d TBS %d G %d mcs %d Nl %d nb_rb %d, Qm %d, Coderate %f RV %d round %d\n", harq_pid, A, G, mcs, n_layers, nb_rb, Qm, Coderate, pusch_pdu->pusch_data.rv_index, harq_process->round); - if ((A <=292) || ((A<=3824) && (Coderate <= 0.6667)) || Coderate <= 0.25){ - p_decParams->BG = 2; + p_decParams->BG = pusch_pdu->maintenance_parms_v3.ldpcBaseGraph; + int kc; + if (p_decParams->BG == 2){ kc = 52; if (Coderate < 0.3333) { p_decParams->R = 15; @@ -458,7 +458,6 @@ uint32_t nr_ulsch_decoding(PHY_VARS_gNB *phy_vars_gNB, p_decParams->R = 23; } } else { - p_decParams->BG = 1; kc = 68; if (Coderate < 0.6667) { p_decParams->R = 13; diff --git a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_RA.c b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_RA.c index 6daa68afed..6f69391dab 100644 --- a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_RA.c +++ b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_RA.c @@ -1121,6 +1121,8 @@ void fill_msg3_pusch_pdu(nfapi_nr_pusch_pdu_t *pusch_pdu, pusch_pdu->mcs_index = mcsindex; pusch_pdu->pusch_data.tb_size = TBS; + pusch_pdu->maintenance_parms_v3.ldpcBaseGraph = get_BG(TBS<<3,R); + } } @@ -1425,6 +1427,7 @@ void nr_generate_Msg2(module_id_t module_idP, int CC_id, frame_t frameP, sub_fra pdsch_pdu_rel15->maintenance_parms_v3.tbSizeLbrmBytes = nr_compute_tbslbrm(mcsTableIdx, bw_tbslbrm, 1); + pdsch_pdu_rel15->maintenance_parms_v3.ldpcBaseGraph = get_BG(TBS<<3,R); // Fill PDCCH DL DCI PDU nfapi_nr_dl_dci_pdu_t *dci_pdu = &pdcch_pdu_rel15->dci_pdu[pdcch_pdu_rel15->numDlDci]; @@ -1829,6 +1832,7 @@ void nr_generate_Msg4(module_id_t module_idP, int CC_id, frame_t frameP, sub_fra pdsch_pdu_rel15->maintenance_parms_v3.tbSizeLbrmBytes = nr_compute_tbslbrm(mcsTableIdx, bw_tbslbrm, 1); + pdsch_pdu_rel15->maintenance_parms_v3.ldpcBaseGraph = get_BG(harq->tb_size<<3,R); pdsch_pdu_rel15->precodingAndBeamforming.num_prgs=1; pdsch_pdu_rel15->precodingAndBeamforming.prg_size=275; diff --git a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_bch.c b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_bch.c index 828cb2b880..0c98a900cc 100644 --- a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_bch.c +++ b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_bch.c @@ -465,6 +465,7 @@ void nr_fill_nfapi_dl_sib1_pdu(int Mod_idP, pdsch_pdu_rel15->maintenance_parms_v3.tbSizeLbrmBytes = nr_compute_tbslbrm(0, pdsch_pdu_rel15->BWPSize, 1); + pdsch_pdu_rel15->maintenance_parms_v3.ldpcBaseGraph = get_BG(TBS<<3,pdsch_pdu_rel15->targetCodeRate[0]); /* Fill PDCCH DL DCI PDU */ nfapi_nr_dl_dci_pdu_t *dci_pdu = &pdcch_pdu_rel15->dci_pdu[pdcch_pdu_rel15->numDlDci]; diff --git a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_dlsch.c b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_dlsch.c index d9a0a50b7e..2ea58a4a24 100644 --- a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_dlsch.c +++ b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_dlsch.c @@ -1128,6 +1128,7 @@ void nr_schedule_ue_spec(module_id_t module_id, pdsch_pdu->maintenance_parms_v3.tbSizeLbrmBytes = nr_compute_tbslbrm(ps->mcsTableIdx, bw_tbslbrm, nl_tbslbrm); + pdsch_pdu->maintenance_parms_v3.ldpcBaseGraph = get_BG(TBS<<3,R); NR_PDSCH_Config_t *pdsch_Config=NULL; diff --git a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_primitives.c b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_primitives.c index 9941437e13..d6959f0a87 100644 --- a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_primitives.c +++ b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_primitives.c @@ -245,6 +245,15 @@ void set_dl_dmrs_ports(NR_pdsch_semi_static_t *ps) { } } +uint8_t get_BG(uint32_t A, uint16_t R) { + + float code_rate = (float) R / 10240.0f; + if ((A <=292) || ((A<=3824) && (code_rate <= 0.6667)) || code_rate <= 0.25) + return 2; + else + return 1; +} + NR_BWP_t *get_dl_bwp_genericParameters(NR_BWP_Downlink_t *active_bwp, NR_ServingCellConfigCommon_t *ServingCellConfigCommon, const NR_SIB1_t *sib1) { diff --git a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_ulsch.c b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_ulsch.c index fa31e0a92c..fafe149cda 100644 --- a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_ulsch.c +++ b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_ulsch.c @@ -1837,6 +1837,7 @@ void nr_schedule_ulsch(module_id_t module_id, frame_t frame, sub_frame_t slot) pusch_pdu->pusch_data.num_cb = 0; //CBG not supported pusch_pdu->maintenance_parms_v3.tbSizeLbrmBytes = 0; + pusch_pdu->maintenance_parms_v3.ldpcBaseGraph = get_BG(sched_pusch->tb_size<<3,sched_pusch->R); LOG_D(NR_MAC,"PUSCH PDU : data_scrambling_identity %x, dmrs_scrambling_id %x\n",pusch_pdu->data_scrambling_id,pusch_pdu->ul_dmrs_scrambling_id); /* TRANSFORM PRECODING --------------------------------------------------------*/ diff --git a/openair2/LAYER2/NR_MAC_gNB/mac_proto.h b/openair2/LAYER2/NR_MAC_gNB/mac_proto.h index 83097ae260..8f69493148 100644 --- a/openair2/LAYER2/NR_MAC_gNB/mac_proto.h +++ b/openair2/LAYER2/NR_MAC_gNB/mac_proto.h @@ -498,7 +498,7 @@ uint16_t set_pm_index(NR_UE_sched_ctrl_t *sched_ctrl, int codebook_mode); uint8_t get_mcs_from_cqi(int mcs_table, int cqi_table, int cqi_idx); - +uint8_t get_BG(uint32_t A, uint16_t R); uint8_t set_dl_nrOfLayers(NR_UE_sched_ctrl_t *sched_ctrl); int get_dci_format(NR_UE_sched_ctrl_t *sched_ctrl); From f44dd6317b2c09dfe265a9e792239e47a0a1d13d Mon Sep 17 00:00:00 2001 From: francescomani Date: Thu, 28 Jul 2022 15:31:13 +0200 Subject: [PATCH 05/88] nr_process_mac_pdu formatting --- .../LAYER2/NR_MAC_gNB/gNB_scheduler_ulsch.c | 560 +++++++++--------- 1 file changed, 277 insertions(+), 283 deletions(-) diff --git a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_ulsch.c b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_ulsch.c index fafe149cda..6af6fa9544 100644 --- a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_ulsch.c +++ b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_ulsch.c @@ -87,318 +87,312 @@ const int get_ul_tda(const gNB_MAC_INST *nrmac, const NR_ServingCellConfigCommon // F: length of L is 0:8 or 1:16 bits wide // R: Reserved bit, set to zero. -int nr_process_mac_pdu( instance_t module_idP, - NR_UE_info_t* UE, - uint8_t CC_id, - frame_t frameP, - sub_frame_t slot, - uint8_t *pduP, - int pdu_len) +int nr_process_mac_pdu(instance_t module_idP, + NR_UE_info_t* UE, + uint8_t CC_id, + frame_t frameP, + sub_frame_t slot, + uint8_t *pduP, + int pdu_len) { + uint8_t done = 0; - uint8_t done = 0; + NR_UE_sched_ctrl_t *sched_ctrl = &UE->UE_sched_ctrl; - NR_UE_sched_ctrl_t *sched_ctrl = &UE->UE_sched_ctrl; + if ( pduP[0] != UL_SCH_LCID_PADDING ) + trace_NRpdu(DIRECTION_UPLINK, pduP, pdu_len, WS_C_RNTI, UE->rnti, frameP, 0, 0, 0); - if ( pduP[0] != UL_SCH_LCID_PADDING ) - trace_NRpdu(DIRECTION_UPLINK, pduP, pdu_len, WS_C_RNTI, UE->rnti, frameP, 0, 0, 0); +#ifdef ENABLE_MAC_PAYLOAD_DEBUG + LOG_I(NR_MAC, "In %s: dumping MAC PDU in %d.%d:\n", __func__, frameP, slot); + log_dump(NR_MAC, pduP, pdu_len, LOG_DUMP_CHAR, "\n"); +#endif - #ifdef ENABLE_MAC_PAYLOAD_DEBUG - LOG_I(NR_MAC, "In %s: dumping MAC PDU in %d.%d:\n", __func__, frameP, slot); - log_dump(NR_MAC, pduP, pdu_len, LOG_DUMP_CHAR, "\n"); - #endif + while (!done && pdu_len > 0){ + uint16_t mac_len=0; + uint16_t mac_subheader_len=sizeof(NR_MAC_SUBHEADER_FIXED); + uint8_t rx_lcid = ((NR_MAC_SUBHEADER_FIXED *)pduP)->LCID; - while (!done && pdu_len > 0){ - uint16_t mac_len=0; - uint16_t mac_subheader_len=sizeof(NR_MAC_SUBHEADER_FIXED); - uint8_t rx_lcid = ((NR_MAC_SUBHEADER_FIXED *)pduP)->LCID; + LOG_D(NR_MAC, "In %s: received UL-SCH sub-PDU with LCID 0x%x in %d.%d (remaining PDU length %d)\n", __func__, rx_lcid, frameP, slot, pdu_len); - LOG_D(NR_MAC, "In %s: received UL-SCH sub-PDU with LCID 0x%x in %d.%d (remaining PDU length %d)\n", __func__, rx_lcid, frameP, slot, pdu_len); + unsigned char *ce_ptr; + int n_Lcg = 0; - unsigned char *ce_ptr; - int n_Lcg = 0; + switch(rx_lcid){ + // MAC CE + /*#ifdef DEBUG_HEADER_PARSING + LOG_D(NR_MAC, "[UE] LCID %d, PDU length %d\n", ((NR_MAC_SUBHEADER_FIXED *)pduP)->LCID, pdu_len); + #endif*/ + case UL_SCH_LCID_RECOMMENDED_BITRATE_QUERY: + // 38.321 Ch6.1.3.20 + mac_len = 2; + break; + case UL_SCH_LCID_CONFIGURED_GRANT_CONFIRMATION: + // 38.321 Ch6.1.3.7 + break; + case UL_SCH_LCID_S_BSR: + case UL_SCH_LCID_S_TRUNCATED_BSR: + //38.321 section 6.1.3.1 + //fixed length + mac_len =1; + /* Extract short BSR value */ + ce_ptr = &pduP[mac_subheader_len]; + NR_BSR_SHORT *bsr_s = (NR_BSR_SHORT *) ce_ptr; + sched_ctrl->estimated_ul_buffer = 0; + sched_ctrl->estimated_ul_buffer = NR_SHORT_BSR_TABLE[bsr_s->Buffer_size]; + LOG_D(NR_MAC, + "SHORT BSR at %4d.%2d, LCG ID %d, BS Index %d, BS value < %d, est buf %d\n", + frameP, + slot, + bsr_s->LcgID, + bsr_s->Buffer_size, + NR_SHORT_BSR_TABLE[bsr_s->Buffer_size], + sched_ctrl->estimated_ul_buffer); + break; + case UL_SCH_LCID_L_BSR: + case UL_SCH_LCID_L_TRUNCATED_BSR: + //38.321 section 6.1.3.1 + //variable length + /* Several checks have been added to this function to + ensure that the casting of the pduP is possible. There seems + to be a partial PDU at the end of this buffer, so here + we gracefully ignore that by returning 0. See: + https://gitlab.eurecom.fr/oai/openairinterface5g/-/issues/534 */ + if (!get_mac_len(pduP, pdu_len, &mac_len, &mac_subheader_len)) + return 0; + /* Extract long BSR value */ + ce_ptr = &pduP[mac_subheader_len]; + NR_BSR_LONG *bsr_l = (NR_BSR_LONG *) ce_ptr; + sched_ctrl->estimated_ul_buffer = 0; - switch(rx_lcid){ - // MAC CE + n_Lcg = bsr_l->LcgID7 + bsr_l->LcgID6 + bsr_l->LcgID5 + bsr_l->LcgID4 + + bsr_l->LcgID3 + bsr_l->LcgID2 + bsr_l->LcgID1 + bsr_l->LcgID0; - /*#ifdef DEBUG_HEADER_PARSING - LOG_D(NR_MAC, "[UE] LCID %d, PDU length %d\n", ((NR_MAC_SUBHEADER_FIXED *)pduP)->LCID, pdu_len); - #endif*/ - case UL_SCH_LCID_RECOMMENDED_BITRATE_QUERY: - // 38.321 Ch6.1.3.20 - mac_len = 2; - break; - case UL_SCH_LCID_CONFIGURED_GRANT_CONFIRMATION: - // 38.321 Ch6.1.3.7 - break; + LOG_D(NR_MAC, "LONG BSR, LCG ID(7-0) %d/%d/%d/%d/%d/%d/%d/%d\n", + bsr_l->LcgID7, bsr_l->LcgID6, bsr_l->LcgID5, bsr_l->LcgID4, + bsr_l->LcgID3, bsr_l->LcgID2, bsr_l->LcgID1, bsr_l->LcgID0); - case UL_SCH_LCID_S_BSR: - case UL_SCH_LCID_S_TRUNCATED_BSR: - //38.321 section 6.1.3.1 - //fixed length - mac_len =1; - /* Extract short BSR value */ - ce_ptr = &pduP[mac_subheader_len]; - NR_BSR_SHORT *bsr_s = (NR_BSR_SHORT *) ce_ptr; - sched_ctrl->estimated_ul_buffer = 0; - sched_ctrl->estimated_ul_buffer = NR_SHORT_BSR_TABLE[bsr_s->Buffer_size]; - LOG_D(NR_MAC, - "SHORT BSR at %4d.%2d, LCG ID %d, BS Index %d, BS value < %d, est buf %d\n", - frameP, - slot, - bsr_s->LcgID, - bsr_s->Buffer_size, - NR_SHORT_BSR_TABLE[bsr_s->Buffer_size], - sched_ctrl->estimated_ul_buffer); - break; - - case UL_SCH_LCID_L_BSR: - case UL_SCH_LCID_L_TRUNCATED_BSR: - //38.321 section 6.1.3.1 - //variable length - /* Several checks have been added to this function to - ensure that the casting of the pduP is possible. There seems - to be a partial PDU at the end of this buffer, so here - we gracefully ignore that by returning 0. See: - https://gitlab.eurecom.fr/oai/openairinterface5g/-/issues/534 */ - if (!get_mac_len(pduP, pdu_len, &mac_len, &mac_subheader_len)) - return 0; - /* Extract long BSR value */ - ce_ptr = &pduP[mac_subheader_len]; - NR_BSR_LONG *bsr_l = (NR_BSR_LONG *) ce_ptr; - sched_ctrl->estimated_ul_buffer = 0; - - n_Lcg = bsr_l->LcgID7 + bsr_l->LcgID6 + bsr_l->LcgID5 + bsr_l->LcgID4 + - bsr_l->LcgID3 + bsr_l->LcgID2 + bsr_l->LcgID1 + bsr_l->LcgID0; - - LOG_D(NR_MAC, "LONG BSR, LCG ID(7-0) %d/%d/%d/%d/%d/%d/%d/%d\n", - bsr_l->LcgID7, bsr_l->LcgID6, bsr_l->LcgID5, bsr_l->LcgID4, - bsr_l->LcgID3, bsr_l->LcgID2, bsr_l->LcgID1, bsr_l->LcgID0); - - for (int n = 0; n < n_Lcg; n++){ - LOG_D(NR_MAC, "LONG BSR, %d/%d (n/n_Lcg), BS Index %d, BS value < %d", - n, n_Lcg, pduP[mac_subheader_len + 1 + n], - NR_LONG_BSR_TABLE[pduP[mac_subheader_len + 1 + n]]); - sched_ctrl->estimated_ul_buffer += - NR_LONG_BSR_TABLE[pduP[mac_subheader_len + 1 + n]]; - LOG_D(NR_MAC, - "LONG BSR at %4d.%2d, %d/%d (n/n_Lcg), BS Index %d, BS value < %d, total %d\n", - frameP, - slot, - n, - n_Lcg, - pduP[mac_subheader_len + 1 + n], - NR_LONG_BSR_TABLE[pduP[mac_subheader_len + 1 + n]], - sched_ctrl->estimated_ul_buffer); - } - - break; - - case UL_SCH_LCID_C_RNTI: - - for (int i = 0; i < NR_NB_RA_PROC_MAX; i++) { - NR_RA_t *ra = &RC.nrmac[module_idP]->common_channels[CC_id].ra[i]; - if (ra->state >= WAIT_Msg3 && ra->rnti == UE->rnti) { - ra->crnti = ((pduP[1]&0xFF)<<8)|(pduP[2]&0xFF); - ra->msg3_dcch_dtch = true; - LOG_I(NR_MAC, "Received UL_SCH_LCID_C_RNTI with C-RNTI 0x%04x\n", ra->crnti); - break; - } - } - - //38.321 section 6.1.3.2 - //fixed length - mac_len = 2; - /* Extract CRNTI value */ - break; - - case UL_SCH_LCID_SINGLE_ENTRY_PHR: - //38.321 section 6.1.3.8 - //fixed length - mac_len = 2; - /* Extract SINGLE ENTRY PHR elements for PHR calculation */ - ce_ptr = &pduP[mac_subheader_len]; - NR_SINGLE_ENTRY_PHR_MAC_CE *phr = (NR_SINGLE_ENTRY_PHR_MAC_CE *) ce_ptr; - /* Save the phr info */ - const int PH = phr->PH; - const int PCMAX = phr->PCMAX; - /* 38.133 Table10.1.17.1-1 */ - if (PH < 55) - sched_ctrl->ph = PH - 32; - else - sched_ctrl->ph = PH - 32 + (PH - 54); - /* 38.133 Table10.1.18.1-1 */ - sched_ctrl->pcmax = PCMAX - 29; - LOG_D(NR_MAC, "SINGLE ENTRY PHR R1 %d PH %d (%d dB) R2 %d PCMAX %d (%d dBm)\n", - phr->R1, PH, sched_ctrl->ph, phr->R2, PCMAX, sched_ctrl->pcmax); - break; - - case UL_SCH_LCID_MULTI_ENTRY_PHR_1_OCT: - //38.321 section 6.1.3.9 - // varialbe length - if (!get_mac_len(pduP, pdu_len, &mac_len, &mac_subheader_len)) - return 0; - /* Extract MULTI ENTRY PHR elements from single octet bitmap for PHR calculation */ - break; - - case UL_SCH_LCID_MULTI_ENTRY_PHR_4_OCT: - //38.321 section 6.1.3.9 - // varialbe length - if (!get_mac_len(pduP, pdu_len, &mac_len, &mac_subheader_len)) - return 0; - /* Extract MULTI ENTRY PHR elements from four octets bitmap for PHR calculation */ - break; - - case UL_SCH_LCID_PADDING: - done = 1; - // end of MAC PDU, can ignore the rest. - break; - - case UL_SCH_LCID_SRB1: - case UL_SCH_LCID_SRB2: - if (!get_mac_len(pduP, pdu_len, &mac_len, &mac_subheader_len)) - return 0; - - rnti_t crnti = UE->rnti; - NR_UE_info_t* UE_idx = UE; - for (int i = 0; i < NR_NB_RA_PROC_MAX; i++) { - NR_RA_t *ra = &RC.nrmac[module_idP]->common_channels[CC_id].ra[i]; - if (ra->state >= WAIT_Msg3 && ra->rnti == UE->rnti) { - uint8_t *next_subpduP = pduP + mac_subheader_len + mac_len; - if ((pduP[mac_subheader_len+mac_len] & 0x3F) == UL_SCH_LCID_C_RNTI) { - crnti = ((next_subpduP[1]&0xFF)<<8)|(next_subpduP[2]&0xFF); - LOG_W(NR_MAC, " UL_SCH_LCID_SRB for rnti %04x\n", crnti); - UE_idx = find_nr_UE(&RC.nrmac[module_idP]->UE_info, crnti); - break; - } - } - } - - if (UE_idx->CellGroup) { - LOG_D(NR_MAC, "Frame %d : ULSCH -> UL-DCCH %d (gNB %ld, %d bytes), rnti: 0x%04x \n", frameP, rx_lcid, module_idP, mac_len, crnti); - mac_rlc_data_ind(module_idP, - crnti, - module_idP, - frameP, - ENB_FLAG_YES, - MBMS_FLAG_NO, - rx_lcid, - (char *) (pduP + mac_subheader_len), - mac_len, - 1, - NULL); - } else { - AssertFatal(1==0,"[UE %04x] Frame/Slot %d.%d : Received LCID %d which is not configured, dropping packet\n",UE->rnti,frameP,slot,rx_lcid); - } - break; - case UL_SCH_LCID_SRB3: - // todo - break; - - case UL_SCH_LCID_CCCH: - case UL_SCH_LCID_CCCH1: - // fixed length - mac_subheader_len = 1; - - if ( rx_lcid == UL_SCH_LCID_CCCH1 ) { - // RRCResumeRequest1 message includes the full I-RNTI and has a size of 8 bytes - mac_len = 8; - - // Check if it is a valid CCCH1 message, we get all 00's messages very often - int i = 0; - for(i=0; i<(mac_subheader_len+mac_len); i++) { - if(pduP[i] != 0) { - break; - } - } - if (i == (mac_subheader_len+mac_len)) { - LOG_D(NR_MAC, "%s() Invalid CCCH1 message!, pdu_len: %d\n", __func__, pdu_len); - done = 1; - break; - } - } else { - // fixed length of 6 bytes - mac_len = 6; - } - - nr_mac_rrc_data_ind(module_idP, - CC_id, - frameP, - 0, - 0, - UE->rnti, - CCCH, - pduP + mac_subheader_len, - mac_len, - 0); - break; - - case UL_SCH_LCID_DTCH ... (UL_SCH_LCID_DTCH + 28): - // check if LCID is valid at current time. - if (!get_mac_len(pduP, pdu_len, &mac_len, &mac_subheader_len)) - return 0; - - - LOG_D(NR_MAC, "[UE %04x] %d.%d : ULSCH -> UL-%s %d (gNB %ld, %d bytes)\n", - UE->rnti, + for (int n = 0; n < n_Lcg; n++){ + LOG_D(NR_MAC, "LONG BSR, %d/%d (n/n_Lcg), BS Index %d, BS value < %d", + n, n_Lcg, pduP[mac_subheader_len + 1 + n], + NR_LONG_BSR_TABLE[pduP[mac_subheader_len + 1 + n]]); + sched_ctrl->estimated_ul_buffer += NR_LONG_BSR_TABLE[pduP[mac_subheader_len + 1 + n]]; + LOG_D(NR_MAC, + "LONG BSR at %4d.%2d, %d/%d (n/n_Lcg), BS Index %d, BS value < %d, total %d\n", frameP, slot, - rx_lcid<4?"DCCH":"DTCH", - rx_lcid, - module_idP, - mac_len); - UE->mac_stats.ul.lc_bytes[rx_lcid] += mac_len; + n, + n_Lcg, + pduP[mac_subheader_len + 1 + n], + NR_LONG_BSR_TABLE[pduP[mac_subheader_len + 1 + n]], + sched_ctrl->estimated_ul_buffer); + } + break; + + case UL_SCH_LCID_C_RNTI: + + for (int i = 0; i < NR_NB_RA_PROC_MAX; i++) { + NR_RA_t *ra = &RC.nrmac[module_idP]->common_channels[CC_id].ra[i]; + if (ra->state >= WAIT_Msg3 && ra->rnti == UE->rnti) { + ra->crnti = ((pduP[1]&0xFF)<<8)|(pduP[2]&0xFF); + ra->msg3_dcch_dtch = true; + LOG_I(NR_MAC, "Received UL_SCH_LCID_C_RNTI with C-RNTI 0x%04x\n", ra->crnti); + break; + } + } + + //38.321 section 6.1.3.2 + //fixed length + mac_len = 2; + /* Extract CRNTI value */ + break; + + case UL_SCH_LCID_SINGLE_ENTRY_PHR: + //38.321 section 6.1.3.8 + //fixed length + mac_len = 2; + /* Extract SINGLE ENTRY PHR elements for PHR calculation */ + ce_ptr = &pduP[mac_subheader_len]; + NR_SINGLE_ENTRY_PHR_MAC_CE *phr = (NR_SINGLE_ENTRY_PHR_MAC_CE *) ce_ptr; + /* Save the phr info */ + const int PH = phr->PH; + const int PCMAX = phr->PCMAX; + /* 38.133 Table10.1.17.1-1 */ + if (PH < 55) + sched_ctrl->ph = PH - 32; + else + sched_ctrl->ph = PH - 32 + (PH - 54); + /* 38.133 Table10.1.18.1-1 */ + sched_ctrl->pcmax = PCMAX - 29; + LOG_D(NR_MAC, "SINGLE ENTRY PHR R1 %d PH %d (%d dB) R2 %d PCMAX %d (%d dBm)\n", + phr->R1, PH, sched_ctrl->ph, phr->R2, PCMAX, sched_ctrl->pcmax); + break; + + case UL_SCH_LCID_MULTI_ENTRY_PHR_1_OCT: + //38.321 section 6.1.3.9 + // varialbe length + if (!get_mac_len(pduP, pdu_len, &mac_len, &mac_subheader_len)) + return 0; + /* Extract MULTI ENTRY PHR elements from single octet bitmap for PHR calculation */ + break; + + case UL_SCH_LCID_MULTI_ENTRY_PHR_4_OCT: + //38.321 section 6.1.3.9 + // varialbe length + if (!get_mac_len(pduP, pdu_len, &mac_len, &mac_subheader_len)) + return 0; + /* Extract MULTI ENTRY PHR elements from four octets bitmap for PHR calculation */ + break; + + case UL_SCH_LCID_PADDING: + done = 1; + // end of MAC PDU, can ignore the rest. + break; + + case UL_SCH_LCID_SRB1: + case UL_SCH_LCID_SRB2: + if (!get_mac_len(pduP, pdu_len, &mac_len, &mac_subheader_len)) + return 0; + + rnti_t crnti = UE->rnti; + NR_UE_info_t* UE_idx = UE; + for (int i = 0; i < NR_NB_RA_PROC_MAX; i++) { + NR_RA_t *ra = &RC.nrmac[module_idP]->common_channels[CC_id].ra[i]; + if (ra->state >= WAIT_Msg3 && ra->rnti == UE->rnti) { + uint8_t *next_subpduP = pduP + mac_subheader_len + mac_len; + if ((pduP[mac_subheader_len+mac_len] & 0x3F) == UL_SCH_LCID_C_RNTI) { + crnti = ((next_subpduP[1]&0xFF)<<8)|(next_subpduP[2]&0xFF); + LOG_W(NR_MAC, " UL_SCH_LCID_SRB for rnti %04x\n", crnti); + UE_idx = find_nr_UE(&RC.nrmac[module_idP]->UE_info, crnti); + break; + } + } + } + + if (UE_idx->CellGroup) { + LOG_D(NR_MAC, "Frame %d : ULSCH -> UL-DCCH %d (gNB %ld, %d bytes), rnti: 0x%04x \n", frameP, rx_lcid, module_idP, mac_len, crnti); mac_rlc_data_ind(module_idP, - UE->rnti, + crnti, module_idP, frameP, ENB_FLAG_YES, MBMS_FLAG_NO, rx_lcid, - (char *)(pduP + mac_subheader_len), + (char *) (pduP + mac_subheader_len), mac_len, 1, NULL); - - /* Updated estimated buffer when receiving data */ - if (sched_ctrl->estimated_ul_buffer >= mac_len) - sched_ctrl->estimated_ul_buffer -= mac_len; - else - sched_ctrl->estimated_ul_buffer = 0; - break; - - default: - LOG_E(NR_MAC, "Received unknown MAC header (LCID = 0x%02x)\n", rx_lcid); - return -1; - break; - } - - #ifdef ENABLE_MAC_PAYLOAD_DEBUG - if (rx_lcid < 45 || rx_lcid == 52 || rx_lcid == 63) { - LOG_I(NR_MAC, "In %s: dumping UL MAC SDU sub-header with length %d (LCID = 0x%02x):\n", __func__, mac_subheader_len, rx_lcid); - log_dump(NR_MAC, pduP, mac_subheader_len, LOG_DUMP_CHAR, "\n"); - LOG_I(NR_MAC, "In %s: dumping UL MAC SDU with length %d (LCID = 0x%02x):\n", __func__, mac_len, rx_lcid); - log_dump(NR_MAC, pduP + mac_subheader_len, mac_len, LOG_DUMP_CHAR, "\n"); } else { - LOG_I(NR_MAC, "In %s: dumping UL MAC CE with length %d (LCID = 0x%02x):\n", __func__, mac_len, rx_lcid); - log_dump(NR_MAC, pduP + mac_subheader_len + mac_len, mac_len, LOG_DUMP_CHAR, "\n"); + AssertFatal(1==0,"[UE %04x] Frame/Slot %d.%d : Received LCID %d which is not configured, dropping packet\n",UE->rnti,frameP,slot,rx_lcid); } - #endif + break; + case UL_SCH_LCID_SRB3: + // todo + break; - pduP += ( mac_subheader_len + mac_len ); - pdu_len -= ( mac_subheader_len + mac_len ); + case UL_SCH_LCID_CCCH: + case UL_SCH_LCID_CCCH1: + // fixed length + mac_subheader_len = 1; - if (pdu_len < 0) { - LOG_E(NR_MAC, "In %s: residual UL MAC PDU in %d.%d with length < 0!, pdu_len %d \n", __func__, frameP, slot, pdu_len); - LOG_E(NR_MAC, "MAC PDU "); - for (int i = 0; i < 20; i++) // Only printf 1st - 20nd bytes - printf("%02x ", pduP[i]); - printf("\n"); + if ( rx_lcid == UL_SCH_LCID_CCCH1 ) { + // RRCResumeRequest1 message includes the full I-RNTI and has a size of 8 bytes + mac_len = 8; + + // Check if it is a valid CCCH1 message, we get all 00's messages very often + int i = 0; + for(i=0; i<(mac_subheader_len+mac_len); i++) { + if(pduP[i] != 0) { + break; + } + } + if (i == (mac_subheader_len+mac_len)) { + LOG_D(NR_MAC, "%s() Invalid CCCH1 message!, pdu_len: %d\n", __func__, pdu_len); + done = 1; + break; + } + } else { + // fixed length of 6 bytes + mac_len = 6; + } + + nr_mac_rrc_data_ind(module_idP, + CC_id, + frameP, + 0, + 0, + UE->rnti, + CCCH, + pduP + mac_subheader_len, + mac_len, + 0); + break; + + case UL_SCH_LCID_DTCH ... (UL_SCH_LCID_DTCH + 28): + // check if LCID is valid at current time. + if (!get_mac_len(pduP, pdu_len, &mac_len, &mac_subheader_len)) return 0; - } - } + + LOG_D(NR_MAC, "[UE %04x] %d.%d : ULSCH -> UL-%s %d (gNB %ld, %d bytes)\n", + UE->rnti, + frameP, + slot, + rx_lcid<4?"DCCH":"DTCH", + rx_lcid, + module_idP, + mac_len); + UE->mac_stats.ul.lc_bytes[rx_lcid] += mac_len; + + mac_rlc_data_ind(module_idP, + UE->rnti, + module_idP, + frameP, + ENB_FLAG_YES, + MBMS_FLAG_NO, + rx_lcid, + (char *)(pduP + mac_subheader_len), + mac_len, + 1, + NULL); + + /* Updated estimated buffer when receiving data */ + if (sched_ctrl->estimated_ul_buffer >= mac_len) + sched_ctrl->estimated_ul_buffer -= mac_len; + else + sched_ctrl->estimated_ul_buffer = 0; + break; + + default: + LOG_E(NR_MAC, "Received unknown MAC header (LCID = 0x%02x)\n", rx_lcid); + return -1; + break; + } + +#ifdef ENABLE_MAC_PAYLOAD_DEBUG + if (rx_lcid < 45 || rx_lcid == 52 || rx_lcid == 63) { + LOG_I(NR_MAC, "In %s: dumping UL MAC SDU sub-header with length %d (LCID = 0x%02x):\n", __func__, mac_subheader_len, rx_lcid); + log_dump(NR_MAC, pduP, mac_subheader_len, LOG_DUMP_CHAR, "\n"); + LOG_I(NR_MAC, "In %s: dumping UL MAC SDU with length %d (LCID = 0x%02x):\n", __func__, mac_len, rx_lcid); + log_dump(NR_MAC, pduP + mac_subheader_len, mac_len, LOG_DUMP_CHAR, "\n"); + } else { + LOG_I(NR_MAC, "In %s: dumping UL MAC CE with length %d (LCID = 0x%02x):\n", __func__, mac_len, rx_lcid); + log_dump(NR_MAC, pduP + mac_subheader_len + mac_len, mac_len, LOG_DUMP_CHAR, "\n"); + } +#endif + + pduP += ( mac_subheader_len + mac_len ); + pdu_len -= ( mac_subheader_len + mac_len ); + + if (pdu_len < 0) { + LOG_E(NR_MAC, "In %s: residual UL MAC PDU in %d.%d with length < 0!, pdu_len %d \n", __func__, frameP, slot, pdu_len); + LOG_E(NR_MAC, "MAC PDU "); + for (int i = 0; i < 20; i++) // Only printf 1st - 20nd bytes + printf("%02x ", pduP[i]); + printf("\n"); + return 0; + } + } return 0; } From d0e68a2c88b22f037ae5ff658092788490b1082d Mon Sep 17 00:00:00 2001 From: francescomani Date: Fri, 29 Jul 2022 18:02:13 +0200 Subject: [PATCH 06/88] reworking phr adding assertion --- common/utils/nr/nr_common.h | 3 +- .../LAYER2/NR_MAC_gNB/gNB_scheduler_ulsch.c | 128 +++++++++++------- openair2/LAYER2/NR_MAC_gNB/nr_mac_gNB.h | 1 + openair2/RRC/NR/MESSAGES/asn1_msg.c | 3 +- openair2/RRC/NR/rrc_gNB_reconfig.c | 6 +- 5 files changed, 84 insertions(+), 57 deletions(-) diff --git a/common/utils/nr/nr_common.h b/common/utils/nr/nr_common.h index 5f7f670ce9..9ccb743ee5 100644 --- a/common/utils/nr/nr_common.h +++ b/common/utils/nr/nr_common.h @@ -49,10 +49,9 @@ typedef struct nr_bandentry_s { } nr_bandentry_t; extern const nr_bandentry_t nr_bandtable[]; + static inline int get_num_dmrs(uint16_t dmrs_mask ) { - int num_dmrs=0; - for (int i=0;i<16;i++) num_dmrs+=((dmrs_mask>>i)&1); return(num_dmrs); } diff --git a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_ulsch.c b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_ulsch.c index 6af6fa9544..0279c46f83 100644 --- a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_ulsch.c +++ b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_ulsch.c @@ -63,6 +63,32 @@ const int get_ul_tda(const gNB_MAC_INST *nrmac, const NR_ServingCellConfigCommon return 0; // if FDD or not mixed slot in TDD, for now use default TDA (TODO handle CSI-RS slots) } +int compute_bw_factor(int mu, int rb) { + // 38.213 7.1.1 + return (10 * log10(rb << mu)); +} + +int compute_delta_tf(int tbs_bits, + int rb, + int n_layers, + int n_symbols, + int n_dmrs, + long *deltaMCS) { + + // 38.213 7.1.1 + // if the PUSCH transmission is over more than one layer delta_tf = 0 + if(deltaMCS == NULL || n_layers>1) + return 0; + else + AssertFatal(1==0,"Compute DeltaTF not yet fully supported\n"); + + const int n_re = (NR_NB_SC_PER_RB * n_symbols - n_dmrs) * rb; + const int BPRE = tbs_bits/n_re; //TODO change for PUSCH with CSI + const float f = pow(2, (float) BPRE * 1.25); + const float beta = 1.0f; //TODO change for PUSCH with CSI + return(10 * log10((f - 1) * beta)); +} + // For both UL-SCH except: // - UL-SCH: fixed-size MAC CE(known by LCID) // - UL-SCH: padding @@ -93,14 +119,15 @@ int nr_process_mac_pdu(instance_t module_idP, frame_t frameP, sub_frame_t slot, uint8_t *pduP, - int pdu_len) + int pdu_len, + const int8_t harq_pid) { uint8_t done = 0; NR_UE_sched_ctrl_t *sched_ctrl = &UE->UE_sched_ctrl; - if ( pduP[0] != UL_SCH_LCID_PADDING ) + if (pduP[0] != UL_SCH_LCID_PADDING) trace_NRpdu(DIRECTION_UPLINK, pduP, pdu_len, WS_C_RNTI, UE->rnti, frameP, 0, 0, 0); #ifdef ENABLE_MAC_PAYLOAD_DEBUG @@ -209,6 +236,8 @@ int nr_process_mac_pdu(instance_t module_idP, break; case UL_SCH_LCID_SINGLE_ENTRY_PHR: + AssertFatal(harq_pid>-1,"Invalid HARQ PID %d\n",harq_pid); + NR_sched_pusch_t *sched_pusch = &sched_ctrl->ul_harq_processes[harq_pid].sched_pusch;; //38.321 section 6.1.3.8 //fixed length mac_len = 2; @@ -216,13 +245,23 @@ int nr_process_mac_pdu(instance_t module_idP, ce_ptr = &pduP[mac_subheader_len]; NR_SINGLE_ENTRY_PHR_MAC_CE *phr = (NR_SINGLE_ENTRY_PHR_MAC_CE *) ce_ptr; /* Save the phr info */ - const int PH = phr->PH; + int PH; const int PCMAX = phr->PCMAX; /* 38.133 Table10.1.17.1-1 */ - if (PH < 55) - sched_ctrl->ph = PH - 32; + if (phr->PH < 55) + PH = phr->PH - 32; else - sched_ctrl->ph = PH - 32 + (PH - 54); + PH = phr->PH - 32 + (phr->PH - 54); + // in sched_ctrl we set normalized PH wrt MCS and PRBs + long* deltaMCS = sched_ctrl->pusch_semi_static.pusch_Config->pusch_PowerControl->deltaMCS; + sched_ctrl->ph = PH + + compute_bw_factor(sched_pusch->mu, sched_pusch->rbSize) + + compute_delta_tf(sched_pusch->tb_size<<3, + sched_pusch->rbSize, + 0, //n_layers + 0, //n_symbols + 0, //n_dmrs + deltaMCS); /* 38.133 Table10.1.18.1-1 */ sched_ctrl->pcmax = PCMAX - 29; LOG_D(NR_MAC, "SINGLE ENTRY PHR R1 %d PH %d (%d dB) R2 %d PCMAX %d (%d dBm)\n", @@ -564,7 +603,7 @@ void nr_rx_sdu(const module_id_t gnb_mod_idP, if (UE_scheduling_control->sched_ul_bytes < 0) UE_scheduling_control->sched_ul_bytes = 0; - nr_process_mac_pdu(gnb_mod_idP, UE, CC_idP, frameP, slotP, sduP, sdu_lenP); + nr_process_mac_pdu(gnb_mod_idP, UE, CC_idP, frameP, slotP, sduP, sdu_lenP, harq_pid); } else { NR_UE_ul_harq_t *cur_harq = &UE_scheduling_control->ul_harq_processes[harq_pid]; @@ -691,7 +730,7 @@ void nr_rx_sdu(const module_id_t gnb_mod_idP, // First byte corresponds to R/LCID MAC sub-header memcpy(ra->cont_res_id, &sduP[1], sizeof(uint8_t) * 6); - if (nr_process_mac_pdu(gnb_mod_idP, UE, CC_idP, frameP, slotP, sduP, sdu_lenP) == 0) { + if (nr_process_mac_pdu(gnb_mod_idP, UE, CC_idP, frameP, slotP, sduP, sdu_lenP, -1) == 0) { ra->state = Msg4; ra->Msg4_frame = (frameP + 2) % 1024; ra->Msg4_slot = 1; @@ -875,34 +914,6 @@ static bool nr_UE_is_to_be_scheduled(const NR_ServingCellConfigCommon_t *scc, return has_data || sched_ctrl->SR || high_inactivity; } -int estimate_nr_ue_tx_power(int mu, uint32_t tbs_bits, int code_rate, int rb, int n_symbols) -{ - /* see TS 38.213 Sec 7.1.1 */ - - const unsigned int CRC = (tbs_bits >> 3) > 3824 ? 24 : 16; /* from nr_dlsch_encoding(): 24 or 16 bits CRC */ - const unsigned int B = tbs_bits + CRC; - unsigned int C; /* number of code blocks */ - unsigned int K; /* total code block size */ - unsigned int Zout; /* unused */ - unsigned int F; /* unused */ - /* to scale MCS 20 and 26 in 214 Tab 5.1.3.1-2 (decimal and input 2* in * nr_target_code_rate_table2) */ - const float targetCodeRate = code_rate < 1000 ? (float) code_rate / 1024.0f : (float) code_rate / 2048.0f; - const unsigned int BG = get_BG(tbs_bits, targetCodeRate); - const int32_t Kb = nr_segmentation(NULL, NULL, B, &C, &K, &Zout, &F, BG); - AssertFatal(Kb >= 0, "problem with segmentation for B %d BG %d\n", B, BG); - - const unsigned int Nre = 12 * rb * n_symbols; - const unsigned int BPRE = C * K / Nre; - const float f = pow(2, (float) BPRE * 1.25); - const float beta = 1.0f; - const int delta_tf = 10 * log10((f - 1) * beta); - - const int bw_factor = 10 * log10(rb << mu); - LOG_D(NR_MAC, "estimated UE TX power %d (Nre %d C %d K %d Nre %d BPRE %d delta_tf %d rb %d bw_factor %d)\n", - bw_factor + delta_tf, Nre, C, K, Nre, BPRE, delta_tf, rb, bw_factor); - return bw_factor + delta_tf; -} - void update_ul_ue_R_Qm(int mcs, const NR_pusch_semi_static_t *ps, uint16_t *R, uint8_t *Qm) { *R = nr_get_code_rate_ul(mcs, ps->mcs_table); @@ -914,31 +925,49 @@ void update_ul_ue_R_Qm(int mcs, const NR_pusch_semi_static_t *ps, uint16_t *R, u } } -int nr_ue_max_mcs_min_rb(int mu, int ph, NR_pusch_semi_static_t *ps, uint16_t minRb, int tbs, uint16_t *maxRb, uint8_t *mcs) +void nr_ue_max_mcs_min_rb(int mu, int ph, NR_pusch_semi_static_t *ps, long* deltaMCS, uint16_t minRb, uint32_t tbs, uint16_t *Rb, uint8_t *mcs) { - AssertFatal(*maxRb >= minRb, "illegal maxRb %d < minRb %d\n", *maxRb, minRb); + AssertFatal(*Rb >= minRb, "illegal Rb %d < minRb %d\n", *Rb, minRb); AssertFatal(*mcs >= 0 && *mcs <= 28, "illegal MCS %d\n", *mcs); - const int tbs_bits = tbs << 3; + int tbs_bits = tbs << 3; uint16_t R; uint8_t Qm; update_ul_ue_R_Qm(*mcs, ps, &R, &Qm); - int tx_power = estimate_nr_ue_tx_power(mu, tbs_bits, R, *maxRb, ps->nrOfSymbols); - while (ph < tx_power && *maxRb >= minRb) { - (*maxRb)--; - tx_power = estimate_nr_ue_tx_power(mu, tbs_bits, R, *maxRb, ps->nrOfSymbols); + int tx_power = compute_bw_factor(mu, *Rb) + + compute_delta_tf(tbs_bits, + *Rb, + ps->nrOfLayers, + ps->nrOfSymbols, + ps->N_PRB_DMRS*ps->num_dmrs_symb, + deltaMCS); + + while (ph < tx_power && *Rb >= minRb) { + (*Rb)--; + tx_power = compute_bw_factor(mu, *Rb) + + compute_delta_tf(tbs_bits, + *Rb, + ps->nrOfLayers, + ps->nrOfSymbols, + ps->N_PRB_DMRS*ps->num_dmrs_symb, + deltaMCS); } while (ph < tx_power && *mcs > 6) { (*mcs)--; update_ul_ue_R_Qm(*mcs, ps, &R, &Qm); - tx_power = estimate_nr_ue_tx_power(mu, tbs_bits, R, *maxRb, ps->nrOfSymbols); + tx_power = compute_bw_factor(mu, *Rb) + + compute_delta_tf(tbs_bits, + *Rb, + ps->nrOfLayers, + ps->nrOfSymbols, + ps->N_PRB_DMRS*ps->num_dmrs_symb, + deltaMCS); } if (ph < tx_power) - LOG_W(NR_MAC, "PH %d < tx_power %d (RBs %d, MCS %d)\n", ph, tx_power, *maxRb, *mcs); - return tx_power; + LOG_W(NR_MAC, "PH %d < tx_power %d (RBs %d, MCS %d)\n", ph, tx_power, *Rb, *mcs); } static bool allocate_ul_retransmission(gNB_MAC_INST *nrmac, @@ -1398,10 +1427,10 @@ void pf_ul(module_id_t module_id, /* Calculate the current scheduling bytes */ const int B = cmax(sched_ctrl->estimated_ul_buffer - sched_ctrl->sched_ul_bytes, 0); + /* adjust rbSize and MCS according to PHR and BPRE */ + sched_pusch->mu = scc->uplinkConfigCommon->initialUplinkBWP->genericParameters.subcarrierSpacing; + nr_ue_max_mcs_min_rb(sched_pusch->mu, sched_ctrl->ph, ps, ps->pusch_Config->pusch_PowerControl->deltaMCS, min_rbSize, B, &max_rbSize, &sched_pusch->mcs); - /* reduce max_rbSize according to PHR and BPRE */ - const int mu = scc->uplinkConfigCommon->initialUplinkBWP->genericParameters.subcarrierSpacing; - nr_ue_max_mcs_min_rb(mu, sched_ctrl->ph, ps, min_rbSize, B, &max_rbSize, &sched_pusch->mcs); if (sched_pusch->mcs < sched_ctrl->ul_bler_stats.mcs) sched_ctrl->ul_bler_stats.mcs = sched_pusch->mcs; /* force estimated MCS down */ @@ -1418,6 +1447,7 @@ void pf_ul(module_id_t module_id, max_rbSize, &TBS, &rbSize); + sched_pusch->rbSize = rbSize; sched_pusch->tb_size = TBS; LOG_D(NR_MAC,"rbSize %d (max_rbSize %d), TBS %d, est buf %d, sched_ul %d, B %d, CCE %d, num_dmrs_symb %d, N_PRB_DMRS %d\n", diff --git a/openair2/LAYER2/NR_MAC_gNB/nr_mac_gNB.h b/openair2/LAYER2/NR_MAC_gNB/nr_mac_gNB.h index 1ae8767d10..67cdf4240b 100644 --- a/openair2/LAYER2/NR_MAC_gNB/nr_mac_gNB.h +++ b/openair2/LAYER2/NR_MAC_gNB/nr_mac_gNB.h @@ -369,6 +369,7 @@ typedef struct NR_pusch_semi_static_t { typedef struct NR_sched_pusch { int frame; int slot; + int mu; /// RB allocation within active uBWP uint16_t rbSize; diff --git a/openair2/RRC/NR/MESSAGES/asn1_msg.c b/openair2/RRC/NR/MESSAGES/asn1_msg.c index af7710cae0..a93d2a8623 100755 --- a/openair2/RRC/NR/MESSAGES/asn1_msg.c +++ b/openair2/RRC/NR/MESSAGES/asn1_msg.c @@ -1413,8 +1413,7 @@ void fill_initial_SpCellConfig(int uid, ASN_SEQUENCE_ADD(&pusch_Config->pusch_PowerControl->pathlossReferenceRSToAddModList->list,plrefRS); pusch_Config->pusch_PowerControl->pathlossReferenceRSToReleaseList = NULL; pusch_Config->pusch_PowerControl->twoPUSCH_PC_AdjustmentStates = NULL; - pusch_Config->pusch_PowerControl->deltaMCS = calloc(1, sizeof(*pusch_Config->pusch_PowerControl->deltaMCS)); - *pusch_Config->pusch_PowerControl->deltaMCS = NR_PUSCH_PowerControl__deltaMCS_enabled; + pusch_Config->pusch_PowerControl->deltaMCS = NULL; pusch_Config->pusch_PowerControl->sri_PUSCH_MappingToAddModList = calloc(1,sizeof(*pusch_Config->pusch_PowerControl->sri_PUSCH_MappingToAddModList)); NR_SRI_PUSCH_PowerControl_t *sriPUSCHPC=calloc(1,sizeof(*sriPUSCHPC)); sriPUSCHPC->sri_PUSCH_PowerControlId=0; diff --git a/openair2/RRC/NR/rrc_gNB_reconfig.c b/openair2/RRC/NR/rrc_gNB_reconfig.c index 57d8557ca1..2ee3a26c4b 100644 --- a/openair2/RRC/NR/rrc_gNB_reconfig.c +++ b/openair2/RRC/NR/rrc_gNB_reconfig.c @@ -401,8 +401,7 @@ void fill_default_nsa_uplinkBWP(NR_BWP_Uplink_t *ubwp, pusch_Config->pusch_PowerControl->pathlossReferenceRSToAddModList = NULL; pusch_Config->pusch_PowerControl->pathlossReferenceRSToReleaseList = NULL; pusch_Config->pusch_PowerControl->twoPUSCH_PC_AdjustmentStates = NULL; - pusch_Config->pusch_PowerControl->deltaMCS = calloc(1, sizeof(*pusch_Config->pusch_PowerControl->deltaMCS)); - *pusch_Config->pusch_PowerControl->deltaMCS = NR_PUSCH_PowerControl__deltaMCS_enabled; + pusch_Config->pusch_PowerControl->deltaMCS = NULL; pusch_Config->pusch_PowerControl->sri_PUSCH_MappingToAddModList = NULL; pusch_Config->pusch_PowerControl->sri_PUSCH_MappingToReleaseList = NULL; pusch_Config->frequencyHopping=NULL; @@ -859,8 +858,7 @@ void fill_default_secondaryCellGroup(NR_ServingCellConfigCommon_t *servingcellco pusch_Config->pusch_PowerControl->pathlossReferenceRSToAddModList = NULL; pusch_Config->pusch_PowerControl->pathlossReferenceRSToReleaseList = NULL; pusch_Config->pusch_PowerControl->twoPUSCH_PC_AdjustmentStates = NULL; - pusch_Config->pusch_PowerControl->deltaMCS = calloc(1, sizeof(*pusch_Config->pusch_PowerControl->deltaMCS)); - *pusch_Config->pusch_PowerControl->deltaMCS = NR_PUSCH_PowerControl__deltaMCS_enabled; + pusch_Config->pusch_PowerControl->deltaMCS = NULL; pusch_Config->pusch_PowerControl->sri_PUSCH_MappingToAddModList = NULL; pusch_Config->pusch_PowerControl->sri_PUSCH_MappingToReleaseList = NULL; pusch_Config->frequencyHopping=NULL; From 3d804db4b3cad9be94d91136bac7b5c3931e7a2a Mon Sep 17 00:00:00 2001 From: francescomani Date: Thu, 4 Aug 2022 09:35:45 +0200 Subject: [PATCH 07/88] minor code refactoring --- .../LAYER2/NR_MAC_gNB/gNB_scheduler_ulsch.c | 33 ++++++++++--------- 1 file changed, 17 insertions(+), 16 deletions(-) diff --git a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_ulsch.c b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_ulsch.c index e590078b64..46de8b0be6 100644 --- a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_ulsch.c +++ b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_ulsch.c @@ -585,9 +585,9 @@ void nr_rx_sdu(const module_id_t gnb_mod_idP, LOG_I(NR_MAC, "Printing received UL MAC payload at gNB side: %d \n"); for (int i = 0; i < sdu_lenP ; i++) { - //harq_process_ul_ue->a[i] = (unsigned char) rand(); - //printf("a[%d]=0x%02x\n",i,harq_process_ul_ue->a[i]); - printf("%02x ",(unsigned char)sduP[i]); + //harq_process_ul_ue->a[i] = (unsigned char) rand(); + //printf("a[%d]=0x%02x\n",i,harq_process_ul_ue->a[i]); + printf("%02x ",(unsigned char)sduP[i]); } printf("\n"); @@ -701,14 +701,14 @@ void nr_rx_sdu(const module_id_t gnb_mod_idP, current_rnti, ra->rnti); - NR_UE_sched_ctrl_t *UE_scheduling_control = &UE->UE_sched_ctrl; + NR_UE_sched_ctrl_t *UE_scheduling_control = &UE->UE_sched_ctrl; - UE_scheduling_control->tpc0 = nr_get_tpc(target_snrx10,ul_cqi,30); - if (timing_advance != 0xffff) - UE_scheduling_control->ta_update = timing_advance; - UE_scheduling_control->raw_rssi = rssi; - UE_scheduling_control->pusch_snrx10 = ul_cqi * 5 - 640; - LOG_D(NR_MAC, "[UE %04x] PUSCH TPC %d and TA %d\n",UE->rnti,UE_scheduling_control->tpc0,UE_scheduling_control->ta_update); + UE_scheduling_control->tpc0 = nr_get_tpc(target_snrx10,ul_cqi,30); + if (timing_advance != 0xffff) + UE_scheduling_control->ta_update = timing_advance; + UE_scheduling_control->raw_rssi = rssi; + UE_scheduling_control->pusch_snrx10 = ul_cqi * 5 - 640; + LOG_D(NR_MAC, "[UE %04x] PUSCH TPC %d and TA %d\n",UE->rnti,UE_scheduling_control->tpc0,UE_scheduling_control->ta_update); if(ra->cfra) { LOG_A(NR_MAC, "(rnti 0x%04x) CFRA procedure succeeded!\n", ra->rnti); @@ -921,12 +921,12 @@ void update_ul_ue_R_Qm(int mcs, const NR_pusch_semi_static_t *ps, uint16_t *R, u } } -void nr_ue_max_mcs_min_rb(int mu, int ph, NR_pusch_semi_static_t *ps, long* deltaMCS, uint16_t minRb, uint32_t tbs, uint16_t *Rb, uint8_t *mcs) +void nr_ue_max_mcs_min_rb(int mu, int ph_limit, NR_pusch_semi_static_t *ps, long* deltaMCS, uint16_t minRb, uint32_t tbs, uint16_t *Rb, uint8_t *mcs) { AssertFatal(*Rb >= minRb, "illegal Rb %d < minRb %d\n", *Rb, minRb); AssertFatal(*mcs >= 0 && *mcs <= 28, "illegal MCS %d\n", *mcs); - int tbs_bits = tbs << 3; + const int tbs_bits = tbs << 3; uint16_t R; uint8_t Qm; update_ul_ue_R_Qm(*mcs, ps, &R, &Qm); @@ -939,7 +939,7 @@ void nr_ue_max_mcs_min_rb(int mu, int ph, NR_pusch_semi_static_t *ps, long* delt ps->N_PRB_DMRS*ps->num_dmrs_symb, deltaMCS); - while (ph < tx_power && *Rb >= minRb) { + while (ph_limit < tx_power && *Rb >= minRb) { (*Rb)--; tx_power = compute_bw_factor(mu, *Rb) + compute_delta_tf(tbs_bits, @@ -950,7 +950,7 @@ void nr_ue_max_mcs_min_rb(int mu, int ph, NR_pusch_semi_static_t *ps, long* delt deltaMCS); } - while (ph < tx_power && *mcs > 6) { + while (ph_limit < tx_power && *mcs > 6) { (*mcs)--; update_ul_ue_R_Qm(*mcs, ps, &R, &Qm); tx_power = compute_bw_factor(mu, *Rb) + @@ -962,8 +962,9 @@ void nr_ue_max_mcs_min_rb(int mu, int ph, NR_pusch_semi_static_t *ps, long* delt deltaMCS); } - if (ph < tx_power) - LOG_W(NR_MAC, "PH %d < tx_power %d (RBs %d, MCS %d)\n", ph, tx_power, *Rb, *mcs); + if (ph_limit < tx_power) + LOG_W(NR_MAC, "Normalized power %d based on current resources (RBs %d, MCS %d) exceed reported PHR %d (normalized value)\n", + tx_power, *Rb, *mcs, ph_limit); } static bool allocate_ul_retransmission(gNB_MAC_INST *nrmac, From 40442d14cf6f65ef08893de01d4dc04cd5abdd48 Mon Sep 17 00:00:00 2001 From: francescomani Date: Thu, 4 Aug 2022 18:17:15 +0200 Subject: [PATCH 08/88] adding a comment --- openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_ulsch.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_ulsch.c b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_ulsch.c index 46de8b0be6..360e926af1 100644 --- a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_ulsch.c +++ b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_ulsch.c @@ -728,7 +728,8 @@ void nr_rx_sdu(const module_id_t gnb_mod_idP, // Store the first 48 bits belonging to the uplink CCCH SDU within Msg3 to fill in Msg4 // First byte corresponds to R/LCID MAC sub-header memcpy(ra->cont_res_id, &sduP[1], sizeof(uint8_t) * 6); - + // harq_pid set a non valid value because it is not used in this call + // the function is only called to decode the contention resolution sub-header if (nr_process_mac_pdu(gnb_mod_idP, UE, CC_idP, frameP, slotP, sduP, sdu_lenP, -1) == 0) { ra->state = Msg4; ra->Msg4_frame = (frameP + 2) % 1024; From bcbf2b38ee58e4c74a9450cb82bb1c247fe52f60 Mon Sep 17 00:00:00 2001 From: Robert Schmidt Date: Wed, 29 Jun 2022 11:46:24 +0200 Subject: [PATCH 09/88] Add more MAC stats --- openair2/LAYER2/NR_MAC_gNB/gNB_scheduler.c | 3 +++ openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_dlsch.c | 9 +++++++++ openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_ulsch.c | 11 +++++++++++ openair2/LAYER2/NR_MAC_gNB/nr_mac_gNB.h | 8 ++++++++ 4 files changed, 31 insertions(+) diff --git a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler.c b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler.c index c87aa68f75..46ffb0b210 100644 --- a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler.c +++ b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler.c @@ -133,6 +133,9 @@ void gNB_dlsch_ulsch_scheduler(module_id_t module_idP, gNB->tdd_beam_association[i] = -1; } + gNB->frame = frame; + gNB->slot = slot; + start_meas(&RC.nrmac[module_idP]->eNB_scheduler); VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_gNB_DLSCH_ULSCH_SCHEDULER,VCD_FUNCTION_IN); diff --git a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_dlsch.c b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_dlsch.c index 6aee81fa67..617327d750 100644 --- a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_dlsch.c +++ b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_dlsch.c @@ -888,6 +888,7 @@ void nr_schedule_ue_spec(module_id_t module_id, NR_sched_pdsch_t *sched_pdsch = &sched_ctrl->sched_pdsch; UE->mac_stats.dl.current_bytes = 0; + UE->mac_stats.dl.current_rbs = 0; NR_CellGroupConfig_t *cg = UE->CellGroup; /* update TA and set ta_apply every 10 frames. @@ -1185,6 +1186,7 @@ void nr_schedule_ue_spec(module_id_t module_id, current_harq_pid); T(T_GNB_MAC_RETRANSMISSION_DL_PDU_WITH_DATA, T_INT(module_id), T_INT(CC_id), T_INT(rnti), T_INT(frame), T_INT(slot), T_INT(current_harq_pid), T_INT(harq->round), T_BUFFER(harq->transportBlock, TBS)); + UE->mac_stats.dl.total_rbs_retx += sched_pdsch->rbSize; } else { /* initial transmission */ LOG_D(NR_MAC, "[%s] Initial HARQ transmission in %d.%d\n", __FUNCTION__, frame, slot); uint8_t *buf = (uint8_t *) harq->transportBlock; @@ -1200,6 +1202,7 @@ void nr_schedule_ue_spec(module_id_t module_id, int dlsch_total_bytes = 0; /* next, get RLC data */ start_meas(&gNB_mac->rlc_data_req); + int sdus = 0; if (sched_ctrl->num_total_bytes > 0) { /* loop over all activated logical channels */ @@ -1251,6 +1254,7 @@ void nr_schedule_ue_spec(module_id_t module_id, buf += len+sizeof(NR_MAC_SUBHEADER_LONG); dlsch_total_bytes += len; lcid_bytes += len; + sdus += 1; } UE->mac_stats.dl.lc_bytes[lcid] += lcid_bytes; @@ -1278,6 +1282,7 @@ void nr_schedule_ue_spec(module_id_t module_id, } for (; buf < bufEnd; buf++) *buf = lrand48() & 0xff; + sdus +=1; } } @@ -1295,6 +1300,10 @@ void nr_schedule_ue_spec(module_id_t module_id, UE->mac_stats.dl.total_bytes += TBS; UE->mac_stats.dl.current_bytes = TBS; + UE->mac_stats.dl.total_rbs += sched_pdsch->rbSize; + UE->mac_stats.dl.num_mac_sdu += sdus; + UE->mac_stats.dl.current_rbs = sched_pdsch->rbSize; + /* save retransmission information */ harq->sched_pdsch = *sched_pdsch; /* save which time allocation has been used, to be used on diff --git a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_ulsch.c b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_ulsch.c index 43e88eb9a9..7b80303ba9 100644 --- a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_ulsch.c +++ b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_ulsch.c @@ -88,6 +88,7 @@ int nr_process_mac_pdu( instance_t module_idP, uint8_t done = 0; + int sdus = 0; NR_UE_sched_ctrl_t *sched_ctrl = &UE->UE_sched_ctrl; @@ -349,6 +350,7 @@ int nr_process_mac_pdu( instance_t module_idP, 1, NULL); + sdus += 1; /* Updated estimated buffer when receiving data */ if (sched_ctrl->estimated_ul_buffer >= mac_len) { sched_ctrl->estimated_ul_buffer -= mac_len; @@ -357,6 +359,7 @@ int nr_process_mac_pdu( instance_t module_idP, } break; + sdus += 1; default: LOG_E(NR_MAC, "Received unknown MAC header (LCID = 0x%02x)\n", rx_lcid); @@ -388,6 +391,9 @@ int nr_process_mac_pdu( instance_t module_idP, return 0; } } + + UE->mac_stats.ul.num_mac_sdu += sdus; + return 0; } @@ -1494,6 +1500,7 @@ void nr_schedule_ulsch(module_id_t module_id, frame_t frame, sub_frame_t slot) NR_UE_UL_BWP_t *current_BWP = &UE->current_UL_BWP; UE->mac_stats.ul.current_bytes = 0; + UE->mac_stats.ul.current_rbs = 0; /* dynamic PUSCH values (RB alloc, MCS, hence R, Qm, TBS) that change in * every TTI are pre-populated by the preprocessor and used below */ @@ -1548,6 +1555,8 @@ void nr_schedule_ulsch(module_id_t module_id, frame_t frame, sub_frame_t slot) * retransmissions */ cur_harq->sched_pusch.time_domain_allocation = ps->time_domain_allocation; sched_ctrl->sched_ul_bytes += sched_pusch->tb_size; + UE->mac_stats.ul.total_rbs += sched_pusch->rbSize; + } else { LOG_D(NR_MAC, "%d.%2d UL retransmission RNTI %04x sched %d.%2d HARQ PID %d round %d NDI %d\n", @@ -1559,8 +1568,10 @@ void nr_schedule_ulsch(module_id_t module_id, frame_t frame, sub_frame_t slot) harq_id, cur_harq->round, cur_harq->ndi); + UE->mac_stats.ul.total_rbs_retx += sched_pusch->rbSize; } UE->mac_stats.ul.current_bytes = sched_pusch->tb_size; + UE->mac_stats.ul.current_rbs = sched_pusch->rbSize; sched_ctrl->last_ul_frame = sched_pusch->frame; sched_ctrl->last_ul_slot = sched_pusch->slot; diff --git a/openair2/LAYER2/NR_MAC_gNB/nr_mac_gNB.h b/openair2/LAYER2/NR_MAC_gNB/nr_mac_gNB.h index 09f3193790..8cf3b75801 100644 --- a/openair2/LAYER2/NR_MAC_gNB/nr_mac_gNB.h +++ b/openair2/LAYER2/NR_MAC_gNB/nr_mac_gNB.h @@ -667,6 +667,10 @@ typedef struct NR_mac_dir_stats { uint64_t errors; uint64_t total_bytes; uint32_t current_bytes; + uint32_t total_rbs; + uint32_t total_rbs_retx; + uint32_t num_mac_sdu; + uint32_t current_rbs; } NR_mac_dir_stats_t; typedef struct NR_mac_stats { @@ -849,6 +853,10 @@ typedef struct gNB_MAC_INST_s { uint8_t min_grant_mcs; nr_mac_rrc_ul_if_t mac_rrc; + + int16_t frame; + int16_t slot; + } gNB_MAC_INST; #endif /*__LAYER2_NR_MAC_GNB_H__ */ From ec4df27a75254cbba6a8a9f796e699dfcf90a42f Mon Sep 17 00:00:00 2001 From: Robert Schmidt Date: Wed, 29 Jun 2022 11:17:43 +0200 Subject: [PATCH 10/88] Add RLC stats --- openair2/LAYER2/nr_rlc/nr_rlc_entity.c | 17 +++++++ openair2/LAYER2/nr_rlc/nr_rlc_entity.h | 57 +++++++++++++++++++++++ openair2/LAYER2/nr_rlc/nr_rlc_entity_am.c | 45 +++++++++++++++++- openair2/LAYER2/nr_rlc/nr_rlc_entity_tm.c | 17 +++++++ openair2/LAYER2/nr_rlc/nr_rlc_entity_um.c | 43 +++++++++++++++++ openair2/LAYER2/nr_rlc/nr_rlc_oai_api.c | 36 ++++++++++++++ 6 files changed, 213 insertions(+), 2 deletions(-) diff --git a/openair2/LAYER2/nr_rlc/nr_rlc_entity.c b/openair2/LAYER2/nr_rlc/nr_rlc_entity.c index 1883bbdd6c..311d31bfde 100644 --- a/openair2/LAYER2/nr_rlc/nr_rlc_entity.c +++ b/openair2/LAYER2/nr_rlc/nr_rlc_entity.c @@ -29,6 +29,14 @@ #include "LOG/log.h" +static void nr_rlc_entity_get_stats( + nr_rlc_entity_t *entity, + nr_rlc_statistics_t *out) +{ +// printf("Stats from the RLC entity asked\n"); + *out = entity->stats; +} + nr_rlc_entity_t *new_nr_rlc_entity_am( int rx_maxsize, int tx_maxsize, @@ -86,6 +94,7 @@ nr_rlc_entity_t *new_nr_rlc_entity_am( ret->common.reestablishment = nr_rlc_entity_am_reestablishment; ret->common.delete = nr_rlc_entity_am_delete; ret->common.available_tx_space = nr_rlc_entity_am_available_tx_space; + ret->common.get_stats = nr_rlc_entity_get_stats; ret->common.deliver_sdu = deliver_sdu; ret->common.deliver_sdu_data = deliver_sdu_data; @@ -94,6 +103,8 @@ nr_rlc_entity_t *new_nr_rlc_entity_am( ret->common.max_retx_reached = max_retx_reached; ret->common.max_retx_reached_data = max_retx_reached_data; + ret->common.stats.mode = 0; /* 0 for AM */ + return (nr_rlc_entity_t *)ret; } @@ -137,10 +148,13 @@ nr_rlc_entity_t *new_nr_rlc_entity_um( ret->common.reestablishment = nr_rlc_entity_um_reestablishment; ret->common.delete = nr_rlc_entity_um_delete; ret->common.available_tx_space = nr_rlc_entity_um_available_tx_space; + ret->common.get_stats = nr_rlc_entity_get_stats; ret->common.deliver_sdu = deliver_sdu; ret->common.deliver_sdu_data = deliver_sdu_data; + ret->common.stats.mode = 1; /* 1 for UM */ + return (nr_rlc_entity_t *)ret; } @@ -169,9 +183,12 @@ nr_rlc_entity_t *new_nr_rlc_entity_tm( ret->common.reestablishment = nr_rlc_entity_tm_reestablishment; ret->common.delete = nr_rlc_entity_tm_delete; ret->common.available_tx_space = nr_rlc_entity_tm_available_tx_space; + ret->common.get_stats = nr_rlc_entity_get_stats; ret->common.deliver_sdu = deliver_sdu; ret->common.deliver_sdu_data = deliver_sdu_data; + ret->common.stats.mode = 2; /* 2 for TM */ + return (nr_rlc_entity_t *)ret; } diff --git a/openair2/LAYER2/nr_rlc/nr_rlc_entity.h b/openair2/LAYER2/nr_rlc/nr_rlc_entity.h index 5cd3bee650..fcb92a8a11 100644 --- a/openair2/LAYER2/nr_rlc/nr_rlc_entity.h +++ b/openair2/LAYER2/nr_rlc/nr_rlc_entity.h @@ -26,6 +26,59 @@ #define NR_SDU_MAX 16000 /* max NR PDCP SDU size is 9000, let's take more */ +typedef struct { + uint32_t mode; /* 0: RLC AM, 1: RLC UM, 2: RLC TM */ + + /* PDU stats */ + /* TX */ + uint32_t txpdu_pkts; /* aggregated number of transmitted RLC PDUs */ + uint32_t txpdu_bytes; /* aggregated amount of transmitted bytes in RLC PDUs */ + /* TODO? */ + uint32_t txpdu_wt_ms; /* aggregated head-of-line tx packet waiting time to be transmitted (i.e. send to the MAC layer) */ + uint32_t txpdu_dd_pkts; /* aggregated number of dropped or discarded tx packets by RLC */ + uint32_t txpdu_dd_bytes; /* aggregated amount of bytes dropped or discarded tx packets by RLC */ + uint32_t txpdu_retx_pkts; /* aggregated number of tx pdus/pkts to be re-transmitted (only applicable to RLC AM) */ + uint32_t txpdu_retx_bytes; /* aggregated amount of bytes to be re-transmitted (only applicable to RLC AM) */ + uint32_t txpdu_segmented; /* aggregated number of segmentations */ + uint32_t txpdu_status_pkts; /* aggregated number of tx status pdus/pkts (only applicable to RLC AM) */ + uint32_t txpdu_status_bytes; /* aggregated amount of tx status bytes (only applicable to RLC AM) */ + /* TODO? */ + uint32_t txbuf_occ_bytes; /* current tx buffer occupancy in terms of amount of bytes (average: NOT IMPLEMENTED) */ + /* TODO? */ + uint32_t txbuf_occ_pkts; /* current tx buffer occupancy in terms of number of packets (average: NOT IMPLEMENTED) */ + /* txbuf_wd_ms: the time window for which the txbuf occupancy value is obtained - NOT IMPLEMENTED */ + + /* RX */ + uint32_t rxpdu_pkts; /* aggregated number of received RLC PDUs */ + uint32_t rxpdu_bytes; /* amount of bytes received by the RLC */ + uint32_t rxpdu_dup_pkts; /* aggregated number of duplicate packets */ + uint32_t rxpdu_dup_bytes; /* aggregated amount of duplicated bytes */ + uint32_t rxpdu_dd_pkts; /* aggregated number of rx packets dropped or discarded by RLC */ + uint32_t rxpdu_dd_bytes; /* aggregated amount of rx bytes dropped or discarded by RLC */ + uint32_t rxpdu_ow_pkts; /* aggregated number of out of window received RLC pdu */ + uint32_t rxpdu_ow_bytes; /* aggregated number of out of window bytes received RLC pdu */ + uint32_t rxpdu_status_pkts; /* aggregated number of rx status pdus/pkts (only applicable to RLC AM) */ + uint32_t rxpdu_status_bytes; /* aggregated amount of rx status bytes (only applicable to RLC AM) */ + /* rxpdu_rotout_ms: flag indicating rx reordering timeout in ms - NOT IMPLEMENTED */ + /* rxpdu_potout_ms: flag indicating the poll retransmit time out in ms - NOT IMPLEMENTED */ + /* rxpdu_sptout_ms: flag indicating status prohibit timeout in ms - NOT IMPLEMENTED */ + /* TODO? */ + uint32_t rxbuf_occ_bytes; /* current rx buffer occupancy in terms of amount of bytes (average: NOT IMPLEMENTED) */ + /* TODO? */ + uint32_t rxbuf_occ_pkts; /* current rx buffer occupancy in terms of number of packets (average: NOT IMPLEMENTED) */ + + /* SDU stats */ + /* TX */ + uint32_t txsdu_pkts; /* number of SDUs delivered */ + uint32_t txsdu_bytes; /* number of bytes of SDUs delivered */ + + /* RX */ + uint32_t rxsdu_pkts; /* number of SDUs received */ + uint32_t rxsdu_bytes; /* number of bytes of SDUs received */ + uint32_t rxsdu_dd_pkts; /* number of dropped or discarded SDUs */ + uint32_t rxsdu_dd_bytes; /* number of bytes of SDUs dropped or discarded */ +} nr_rlc_statistics_t; + typedef struct { int status_size; int tx_size; @@ -52,6 +105,8 @@ typedef struct nr_rlc_entity_t { int (*available_tx_space)(struct nr_rlc_entity_t *entity); + void (*get_stats)(struct nr_rlc_entity_t *entity, nr_rlc_statistics_t *out); + /* callbacks provided to the RLC module */ void (*deliver_sdu)(void *deliver_sdu_data, struct nr_rlc_entity_t *entity, char *buf, int size); @@ -67,6 +122,8 @@ typedef struct nr_rlc_entity_t { void *max_retx_reached_data; /* buffer status computation */ nr_rlc_entity_buffer_status_t bstatus; + + nr_rlc_statistics_t stats; } nr_rlc_entity_t; nr_rlc_entity_t *new_nr_rlc_entity_am( diff --git a/openair2/LAYER2/nr_rlc/nr_rlc_entity_am.c b/openair2/LAYER2/nr_rlc/nr_rlc_entity_am.c index 91e2bed11a..c81ae16335 100644 --- a/openair2/LAYER2/nr_rlc/nr_rlc_entity_am.c +++ b/openair2/LAYER2/nr_rlc/nr_rlc_entity_am.c @@ -221,6 +221,9 @@ static void reassemble_and_deliver(nr_rlc_entity_am_t *entity, int sn) entity->common.deliver_sdu(entity->common.deliver_sdu_data, (nr_rlc_entity_t *)entity, sdu, so); + + entity->common.stats.txsdu_pkts++; + entity->common.stats.txsdu_bytes += so; } static void reception_actions(nr_rlc_entity_am_t *entity, nr_rlc_pdu_t *pdu) @@ -684,6 +687,9 @@ void nr_rlc_entity_am_recv_pdu(nr_rlc_entity_t *_entity, int is_first; int is_last; + entity->common.stats.rxpdu_pkts++; + entity->common.stats.rxpdu_bytes += size; + nr_rlc_pdu_decoder_init(&decoder, buffer, size); dc = nr_rlc_pdu_decoder_get_bits(&decoder, 1); R(decoder); @@ -733,6 +739,10 @@ void nr_rlc_entity_am_recv_pdu(nr_rlc_entity_t *_entity, LOG_D(RLC, "%s:%d:%s: warning: discard PDU, sn out of window (sn %d rx_next %d)\n", __FILE__, __LINE__, __FUNCTION__, sn, entity->rx_next); + + entity->common.stats.rxpdu_ow_pkts++; + entity->common.stats.rxpdu_ow_bytes += size; + goto discard; } @@ -740,6 +750,10 @@ void nr_rlc_entity_am_recv_pdu(nr_rlc_entity_t *_entity, if (segment_already_received(entity, sn, so, data_size)) { LOG_D(RLC, "%s:%d:%s: warning: discard PDU, already received\n", __FILE__, __LINE__, __FUNCTION__); + + entity->common.stats.rxpdu_dup_pkts++; + entity->common.stats.rxpdu_dup_bytes += size; + goto discard; } @@ -779,6 +793,9 @@ discard: if (p) entity->status_triggered = 1; + entity->common.stats.rxpdu_dd_pkts++; + entity->common.stats.rxpdu_dd_bytes += size; + #undef R } @@ -1309,6 +1326,11 @@ static int generate_status(nr_rlc_entity_am_t *entity, char *buffer, int size) /* start t_status_prohibit */ entity->t_status_prohibit_start = entity->t_current; + entity->common.stats.txpdu_pkts++; + entity->common.stats.txpdu_bytes += encoder.byte; + entity->common.stats.txpdu_status_pkts++; + entity->common.stats.txpdu_status_bytes += encoder.byte; + return encoder.byte; } @@ -1473,6 +1495,8 @@ static int generate_retx_pdu(nr_rlc_entity_am_t *entity, char *buffer, /* update buffer status */ entity->common.bstatus.retx_size += compute_pdu_header_size(entity, next_sdu) + next_sdu->size; + + entity->common.stats.txpdu_segmented++; } /* put SDU/SDU segment in the wait list */ @@ -1496,7 +1520,14 @@ static int generate_retx_pdu(nr_rlc_entity_am_t *entity, char *buffer, entity->force_poll = 0; } - return serialize_sdu(entity, sdu, buffer, size, p); + int ret_size = serialize_sdu(entity, sdu, buffer, size, p); + entity->common.stats.txpdu_pkts++; + entity->common.stats.txpdu_bytes += ret_size; + entity->common.stats.txpdu_retx_pkts++; + entity->common.stats.txpdu_retx_bytes += ret_size; + + return ret_size; +// return serialize_sdu(entity, sdu, buffer, size, p); } static int generate_tx_pdu(nr_rlc_entity_am_t *entity, char *buffer, int size) @@ -1544,6 +1575,8 @@ static int generate_tx_pdu(nr_rlc_entity_am_t *entity, char *buffer, int size) entity->tx_list = next_sdu; if (entity->tx_end == NULL) entity->tx_end = entity->tx_list; + + entity->common.stats.txpdu_segmented++; /* update buffer status */ entity->common.bstatus.tx_size += compute_pdu_header_size(entity, next_sdu) + next_sdu->size; @@ -1582,8 +1615,13 @@ static int generate_tx_pdu(nr_rlc_entity_am_t *entity, char *buffer, int size) p = 1; entity->force_poll = 0; } + int ret_size = serialize_sdu(entity, sdu, buffer, size, p); - return serialize_sdu(entity, sdu, buffer, size, p); + entity->common.stats.txpdu_pkts++; + entity->common.stats.txpdu_bytes += ret_size; + + return ret_size; +// return serialize_sdu(entity, sdu, buffer, size, p); } nr_rlc_entity_buffer_status_t nr_rlc_entity_am_buffer_status( @@ -1635,6 +1673,9 @@ void nr_rlc_entity_am_recv_sdu(nr_rlc_entity_t *_entity, nr_rlc_entity_am_t *entity = (nr_rlc_entity_am_t *)_entity; nr_rlc_sdu_segment_t *sdu; + entity->common.stats.rxsdu_pkts++; + entity->common.stats.rxsdu_bytes += size; + if (size > NR_SDU_MAX) { LOG_E(RLC, "%s:%d:%s: fatal: SDU size too big (%d bytes)\n", __FILE__, __LINE__, __FUNCTION__, size); diff --git a/openair2/LAYER2/nr_rlc/nr_rlc_entity_tm.c b/openair2/LAYER2/nr_rlc/nr_rlc_entity_tm.c index f85edbba0f..14cf8cad25 100644 --- a/openair2/LAYER2/nr_rlc/nr_rlc_entity_tm.c +++ b/openair2/LAYER2/nr_rlc/nr_rlc_entity_tm.c @@ -36,9 +36,16 @@ void nr_rlc_entity_tm_recv_pdu(nr_rlc_entity_t *_entity, char *buffer, int size) { nr_rlc_entity_tm_t *entity = (nr_rlc_entity_tm_t *)_entity; + + entity->common.stats.rxpdu_pkts++; + entity->common.stats.rxpdu_bytes += size; + entity->common.deliver_sdu(entity->common.deliver_sdu_data, (nr_rlc_entity_t *)entity, buffer, size); + + entity->common.stats.txsdu_pkts++; + entity->common.stats.txsdu_bytes += size; } /*************************************************************************/ @@ -68,6 +75,9 @@ static int generate_tx_pdu(nr_rlc_entity_tm_t *entity, char *buffer, int size) memcpy(buffer, sdu->sdu->data, sdu->size); entity->tx_size -= sdu->size; + entity->common.stats.txpdu_pkts++; + entity->common.stats.txpdu_bytes += size; + /* update buffer status */ entity->common.bstatus.tx_size -= sdu->size; @@ -109,6 +119,9 @@ void nr_rlc_entity_tm_recv_sdu(nr_rlc_entity_t *_entity, nr_rlc_entity_tm_t *entity = (nr_rlc_entity_tm_t *)_entity; nr_rlc_sdu_segment_t *sdu; + entity->common.stats.rxsdu_pkts++; + entity->common.stats.rxsdu_bytes += size; + if (size > NR_SDU_MAX) { LOG_E(RLC, "%s:%d:%s: fatal: SDU size too big (%d bytes)\n", __FILE__, __LINE__, __FUNCTION__, size); @@ -118,6 +131,10 @@ void nr_rlc_entity_tm_recv_sdu(nr_rlc_entity_t *_entity, if (entity->tx_size + size > entity->tx_maxsize) { LOG_D(RLC, "%s:%d:%s: warning: SDU rejected, SDU buffer full\n", __FILE__, __LINE__, __FUNCTION__); + + entity->common.stats.rxsdu_dd_pkts++; + entity->common.stats.rxsdu_dd_bytes += size; + return; } diff --git a/openair2/LAYER2/nr_rlc/nr_rlc_entity_um.c b/openair2/LAYER2/nr_rlc/nr_rlc_entity_um.c index 5f2fd592a0..5a8c18a29b 100644 --- a/openair2/LAYER2/nr_rlc/nr_rlc_entity_um.c +++ b/openair2/LAYER2/nr_rlc/nr_rlc_entity_um.c @@ -179,6 +179,9 @@ static void reassemble_and_deliver(nr_rlc_entity_um_t *entity, int sn) entity->common.deliver_sdu(entity->common.deliver_sdu_data, (nr_rlc_entity_t *)entity, sdu, so); + + entity->common.stats.txsdu_pkts++; + entity->common.stats.txsdu_bytes += so; } static void reception_actions(nr_rlc_entity_um_t *entity, nr_rlc_pdu_t *pdu) @@ -208,6 +211,15 @@ static void reception_actions(nr_rlc_entity_um_t *entity, nr_rlc_pdu_t *pdu) nr_rlc_pdu_t *p = entity->rx_list; entity->rx_size -= p->size; entity->rx_list = p->next; + + entity->common.stats.rxpdu_dd_pkts++; + /* we don't count PDU header bytes here, so be it */ + entity->common.stats.rxpdu_dd_bytes += p->size; + + entity->common.stats.rxpdu_ow_pkts++; + /* we don't count PDU header bytes here, so be it */ + entity->common.stats.rxpdu_ow_bytes += p->size; + nr_rlc_free_pdu(p); } @@ -272,6 +284,9 @@ void nr_rlc_entity_um_recv_pdu(nr_rlc_entity_t *_entity, int is_first; int is_last; + entity->common.stats.rxpdu_pkts++; + entity->common.stats.rxpdu_bytes += size; + nr_rlc_pdu_decoder_init(&decoder, buffer, size); si = nr_rlc_pdu_decoder_get_bits(&decoder, 2); R(decoder); @@ -290,6 +305,10 @@ void nr_rlc_entity_um_recv_pdu(nr_rlc_entity_t *_entity, entity->common.deliver_sdu(entity->common.deliver_sdu_data, (nr_rlc_entity_t *)entity, buffer + 1, size - 1); + + entity->common.stats.txsdu_pkts++; + entity->common.stats.txsdu_bytes += size - 1; + return; } @@ -350,6 +369,9 @@ err: goto discard; discard: + entity->common.stats.rxpdu_dd_pkts++; + entity->common.stats.rxpdu_dd_bytes += size; + return; #undef R @@ -434,6 +456,8 @@ static nr_rlc_sdu_segment_t *resegment(nr_rlc_sdu_segment_t *sdu, next->so = sdu->so + sdu->size; next->is_first = 0; + entity->common.stats.txpdu_segmented++; + return next; } @@ -478,6 +502,8 @@ static int generate_tx_pdu(nr_rlc_entity_um_t *entity, char *buffer, int size) entity->tx_list = next_sdu; if (entity->tx_end == NULL) entity->tx_end = entity->tx_list; + + entity->common.stats.txpdu_segmented++; /* update buffer status */ entity->common.bstatus.tx_size += compute_pdu_header_size(entity, next_sdu) + next_sdu->size; @@ -492,6 +518,11 @@ static int generate_tx_pdu(nr_rlc_entity_um_t *entity, char *buffer, int size) entity->tx_size -= sdu->size; nr_rlc_free_sdu_segment(sdu); + entity->common.stats.txpdu_pkts++; + entity->common.stats.txpdu_bytes += size; + + + return ret; } @@ -527,6 +558,9 @@ void nr_rlc_entity_um_recv_sdu(nr_rlc_entity_t *_entity, nr_rlc_entity_um_t *entity = (nr_rlc_entity_um_t *)_entity; nr_rlc_sdu_segment_t *sdu; + entity->common.stats.rxsdu_pkts++; + entity->common.stats.rxsdu_bytes += size; + if (size > NR_SDU_MAX) { LOG_E(RLC, "%s:%d:%s: fatal: SDU size too big (%d bytes)\n", __FILE__, __LINE__, __FUNCTION__, size); @@ -536,6 +570,10 @@ void nr_rlc_entity_um_recv_sdu(nr_rlc_entity_t *_entity, if (entity->tx_size + size > entity->tx_maxsize) { LOG_W(RLC, "%s:%d:%s: warning: SDU rejected, SDU buffer full\n", __FILE__, __LINE__, __FUNCTION__); + + entity->common.stats.rxsdu_dd_pkts++; + entity->common.stats.rxsdu_dd_bytes += size; + return; } @@ -584,6 +622,11 @@ static void check_t_reassembly(nr_rlc_entity_um_t *entity) nr_rlc_pdu_t *p = cur; cur = cur->next; entity->rx_list = cur; + + entity->common.stats.rxpdu_dd_pkts++; + /* we don't count PDU header bytes here, so be it */ + entity->common.stats.rxpdu_dd_bytes += p->size; + nr_rlc_free_pdu(p); } diff --git a/openair2/LAYER2/nr_rlc/nr_rlc_oai_api.c b/openair2/LAYER2/nr_rlc/nr_rlc_oai_api.c index 4bd4ea75fd..94bb8bf141 100644 --- a/openair2/LAYER2/nr_rlc/nr_rlc_oai_api.c +++ b/openair2/LAYER2/nr_rlc/nr_rlc_oai_api.c @@ -1110,3 +1110,39 @@ void rlc_tick(int a, int b) __FILE__, __LINE__, __FUNCTION__); exit(1); } + +/* returns 0 in case of error, 1 if everything ok */ +int const nr_rlc_get_statistics( + int rnti, + int srb_flag, + int rb_id, + nr_rlc_statistics_t *out) +{ + nr_rlc_ue_t *ue; + nr_rlc_entity_t *rb; + int ret; + + nr_rlc_manager_lock(nr_rlc_ue_manager); + ue = nr_rlc_manager_get_ue(nr_rlc_ue_manager, rnti); + + rb = NULL; + + if (srb_flag) { + if (rb_id >= 1 && rb_id <= 2) + rb = ue->srb[rb_id - 1]; + } else { + if (rb_id >= 1 && rb_id <= 5) + rb = ue->drb[rb_id - 1]; + } + + if (rb != NULL) { + rb->get_stats(rb, out); + ret = 1; + } else { + ret = 0; + } + + nr_rlc_manager_unlock(nr_rlc_ue_manager); + + return ret; +} From 6a23bcfb4258dcbe30dda72c86a123cab6cb1869 Mon Sep 17 00:00:00 2001 From: Robert Schmidt Date: Wed, 29 Jun 2022 11:18:10 +0200 Subject: [PATCH 11/88] Add PDCP stats --- openair2/LAYER2/nr_pdcp/nr_pdcp_entity.c | 37 ++++++++++++++++++++ openair2/LAYER2/nr_pdcp/nr_pdcp_entity.h | 35 +++++++++++++++++++ openair2/LAYER2/nr_pdcp/nr_pdcp_oai_api.c | 42 +++++++++++++++++++++-- 3 files changed, 112 insertions(+), 2 deletions(-) diff --git a/openair2/LAYER2/nr_pdcp/nr_pdcp_entity.c b/openair2/LAYER2/nr_pdcp/nr_pdcp_entity.c index 480b651593..d1107bb82f 100644 --- a/openair2/LAYER2/nr_pdcp/nr_pdcp_entity.c +++ b/openair2/LAYER2/nr_pdcp/nr_pdcp_entity.c @@ -59,6 +59,9 @@ static void nr_pdcp_entity_recv_pdu(nr_pdcp_entity_t *entity, We need to investigate why this hack is neccessary. */ buffer[0] |= 128; } + entity->stats.rxpdu_pkts++; + entity->stats.rxpdu_bytes += size; + if (entity->sn_size == 12) { rcvd_sn = ((buffer[0] & 0xf) << 8) | @@ -70,6 +73,7 @@ static void nr_pdcp_entity_recv_pdu(nr_pdcp_entity_t *entity, buffer[2]; header_size = 3; } + entity->stats.rxpdu_sn = rcvd_sn; /* SRBs always have MAC-I, even if integrity is not active */ if (entity->has_integrity || entity->type == NR_PDCP_SRB) { @@ -80,6 +84,11 @@ static void nr_pdcp_entity_recv_pdu(nr_pdcp_entity_t *entity, if (size < header_size + integrity_size + 1) { LOG_E(PDCP, "bad PDU received (size = %d)\n", size); + + entity->stats.rxpdu_dd_pkts++; + entity->stats.rxpdu_dd_bytes += size; + + return; } @@ -109,12 +118,20 @@ static void nr_pdcp_entity_recv_pdu(nr_pdcp_entity_t *entity, if (memcmp(integrity, buffer + size - integrity_size, 4) != 0) { LOG_E(PDCP, "discard NR PDU, integrity failed\n"); // return; + entity->stats.rxpdu_dd_pkts++; + entity->stats.rxpdu_dd_bytes += size; + + } } if (rcvd_count < entity->rx_deliv || nr_pdcp_sdu_in_list(entity->rx_list, rcvd_count)) { LOG_W(PDCP, "discard NR PDU rcvd_count=%d, entity->rx_deliv %d,sdu_in_list %d\n", rcvd_count,entity->rx_deliv,nr_pdcp_sdu_in_list(entity->rx_list,rcvd_count)); + entity->stats.rxpdu_dd_pkts++; + entity->stats.rxpdu_dd_bytes += size; + + return; } @@ -139,6 +156,10 @@ static void nr_pdcp_entity_recv_pdu(nr_pdcp_entity_t *entity, cur->buffer, cur->size); entity->rx_list = cur->next; entity->rx_size -= cur->size; + entity->stats.txsdu_pkts++; + entity->stats.txsdu_bytes += cur->size; + + nr_pdcp_free_sdu(cur); count++; } @@ -165,6 +186,9 @@ static void nr_pdcp_entity_recv_sdu(nr_pdcp_entity_t *entity, int integrity_size; char buf[size + 3 + 4]; int dc_bit; + entity->stats.rxsdu_pkts++; + entity->stats.rxsdu_bytes += size; + count = entity->tx_next; sn = entity->tx_next & entity->sn_max; @@ -215,6 +239,11 @@ static void nr_pdcp_entity_recv_sdu(nr_pdcp_entity_t *entity, entity->deliver_pdu(entity->deliver_pdu_data, entity, buf, header_size + size + integrity_size, sdu_id); + entity->stats.txpdu_pkts++; + entity->stats.txpdu_bytes += header_size + size + integrity_size; + entity->stats.txpdu_sn = sn; + + } /* may be called several times, take care to clean previous settings */ @@ -346,6 +375,13 @@ void nr_pdcp_entity_delete(nr_pdcp_entity_t *entity) free(entity); } +static void nr_pdcp_entity_get_stats(nr_pdcp_entity_t *entity, + nr_pdcp_statistics_t *out) +{ + *out = entity->stats; +} + + nr_pdcp_entity_t *new_nr_pdcp_entity( nr_pdcp_entity_type_t type, int is_gnb, int rb_id, int pdusession_id,int has_sdap, @@ -381,6 +417,7 @@ nr_pdcp_entity_t *new_nr_pdcp_entity( ret->delete_entity = nr_pdcp_entity_delete; + ret->get_stats = nr_pdcp_entity_get_stats; ret->deliver_sdu = deliver_sdu; ret->deliver_sdu_data = deliver_sdu_data; diff --git a/openair2/LAYER2/nr_pdcp/nr_pdcp_entity.h b/openair2/LAYER2/nr_pdcp/nr_pdcp_entity.h index 49e9c4142b..19445887f4 100644 --- a/openair2/LAYER2/nr_pdcp/nr_pdcp_entity.h +++ b/openair2/LAYER2/nr_pdcp/nr_pdcp_entity.h @@ -32,6 +32,39 @@ typedef enum { NR_PDCP_SRB } nr_pdcp_entity_type_t; +typedef struct { + //nr_pdcp_entity_type_t mode; + /* PDU stats */ + /* TX */ + uint32_t txpdu_pkts; /* aggregated number of tx packets */ + uint32_t txpdu_bytes; /* aggregated bytes of tx packets */ + uint32_t txpdu_sn; /* current sequence number of last tx packet (or TX_NEXT) */ + /* RX */ + uint32_t rxpdu_pkts; /* aggregated number of rx packets */ + uint32_t rxpdu_bytes; /* aggregated bytes of rx packets */ + uint32_t rxpdu_sn; /* current sequence number of last rx packet (or RX_NEXT) */ + /* TODO? */ + uint32_t rxpdu_oo_pkts; /* aggregated number of out-of-order rx pkts (or RX_REORD) */ + /* TODO? */ + uint32_t rxpdu_oo_bytes; /* aggregated amount of out-of-order rx bytes */ + uint32_t rxpdu_dd_pkts; /* aggregated number of duplicated discarded packets (or dropped packets because of other reasons such as integrity failure) (or RX_DELIV) */ + uint32_t rxpdu_dd_bytes; /* aggregated amount of discarded packets' bytes */ + /* TODO? */ + uint32_t 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) */ + + /* SDU stats */ + /* TX */ + uint32_t txsdu_pkts; /* number of SDUs delivered */ + uint32_t txsdu_bytes; /* number of bytes of SDUs delivered */ + + /* RX */ + uint32_t rxsdu_pkts; /* number of SDUs received */ + uint32_t rxsdu_bytes; /* number of bytes of SDUs received */ + + uint8_t mode; /* 0: PDCP AM, 1: PDCP UM, 2: PDCP TM */ +} nr_pdcp_statistics_t; + + typedef struct nr_pdcp_entity_t { nr_pdcp_entity_type_t type; @@ -40,6 +73,7 @@ typedef struct nr_pdcp_entity_t { void (*recv_sdu)(struct nr_pdcp_entity_t *entity, char *buffer, int size, int sdu_id); void (*delete_entity)(struct nr_pdcp_entity_t *entity); + void (*get_stats)(struct nr_pdcp_entity_t *entity, nr_pdcp_statistics_t *out); /* set_security: pass -1 to integrity_algorithm / ciphering_algorithm * to keep the current algorithm @@ -114,6 +148,7 @@ typedef struct nr_pdcp_entity_t { nr_pdcp_sdu_t *rx_list; int rx_size; int rx_maxsize; + nr_pdcp_statistics_t stats; } nr_pdcp_entity_t; nr_pdcp_entity_t *new_nr_pdcp_entity( diff --git a/openair2/LAYER2/nr_pdcp/nr_pdcp_oai_api.c b/openair2/LAYER2/nr_pdcp/nr_pdcp_oai_api.c index 47c630e0c9..3f9c980710 100644 --- a/openair2/LAYER2/nr_pdcp/nr_pdcp_oai_api.c +++ b/openair2/LAYER2/nr_pdcp/nr_pdcp_oai_api.c @@ -1441,6 +1441,44 @@ void nr_pdcp_tick(int frame, int subframe) /* * For the SDAP API */ -nr_pdcp_ue_manager_t *nr_pdcp_sdap_get_ue_manager(){ - return nr_pdcp_ue_manager; +nr_pdcp_ue_manager_t *nr_pdcp_sdap_get_ue_manager() { + return nr_pdcp_ue_manager; +} + +/* returns 0 in case of error, 1 if everything ok */ +int const nr_pdcp_get_statistics( + int rnti, + int srb_flag, + int rb_id, + nr_pdcp_statistics_t *out) +{ + nr_pdcp_ue_t *ue; + nr_pdcp_entity_t *rb; + int ret; + + nr_pdcp_manager_lock(nr_pdcp_ue_manager); + ue = nr_pdcp_manager_get_ue(nr_pdcp_ue_manager, rnti); + + if (srb_flag == 1) { + if (rb_id < 1 || rb_id > 2) + rb = NULL; + else + rb = ue->srb[rb_id - 1]; + } else { + if (rb_id < 1 || rb_id > 5) + rb = NULL; + else + rb = ue->drb[rb_id - 1]; + } + + if (rb != NULL) { + rb->get_stats(rb, out); + ret = 1; + } else { + ret = 0; + } + + nr_pdcp_manager_unlock(nr_pdcp_ue_manager); + + return ret; } From fad3f231640d4696fd20be20c42e75ff72ac9e0e Mon Sep 17 00:00:00 2001 From: Cedric Roux Date: Mon, 27 Jun 2022 11:23:14 +0200 Subject: [PATCH 12/88] Add RLC stats: avg time to tx for an RLC SDU --- cmake_targets/CMakeLists.txt | 1 + common/utils/time_stat.c | 125 ++++++++++++++++++++++ common/utils/time_stat.h | 63 +++++++++++ openair2/LAYER2/nr_rlc/nr_rlc_entity.c | 19 ++++ openair2/LAYER2/nr_rlc/nr_rlc_entity.h | 13 +++ openair2/LAYER2/nr_rlc/nr_rlc_entity_am.c | 12 +++ openair2/LAYER2/nr_rlc/nr_rlc_entity_tm.c | 9 ++ openair2/LAYER2/nr_rlc/nr_rlc_entity_um.c | 11 +- openair2/LAYER2/nr_rlc/nr_rlc_sdu.h | 8 ++ openair2/LAYER2/nr_rlc/tests/Makefile | 4 +- openair2/LAYER2/nr_rlc/tests/time_stat.c | 25 +++++ 11 files changed, 287 insertions(+), 3 deletions(-) create mode 100644 common/utils/time_stat.c create mode 100644 common/utils/time_stat.h create mode 100644 openair2/LAYER2/nr_rlc/tests/time_stat.c diff --git a/cmake_targets/CMakeLists.txt b/cmake_targets/CMakeLists.txt index f199ee0ca8..081e78d176 100644 --- a/cmake_targets/CMakeLists.txt +++ b/cmake_targets/CMakeLists.txt @@ -1216,6 +1216,7 @@ add_library(UTIL ${OPENAIR_DIR}/common/utils/system.c ${OPENAIR_DIR}/common/utils/backtrace.c ${OPENAIR_DIR}/common/utils/time_meas.c + ${OPENAIR_DIR}/common/utils/time_stat.c ) set(SECU_OSA_SRC diff --git a/common/utils/time_stat.c b/common/utils/time_stat.c new file mode 100644 index 0000000000..637cfdc4b5 --- /dev/null +++ b/common/utils/time_stat.c @@ -0,0 +1,125 @@ +/* + * 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 "time_stat.h" + +#include +#include +#include + +#include "common/utils/LOG/log.h" + +time_average_t *time_average_new(int duration, int initial_size) +{ + time_average_t *ret; + + /* let's only accept power of two initial_size */ + if (initial_size & (initial_size - 1)) { + LOG_E(UTIL, "time_average_new: illegal initial_size %d, use power of two\n", initial_size); + exit(1); + } + + ret = calloc(1, sizeof(time_average_t)); + if (ret == NULL) { + LOG_E(UTIL, "out of memory\n"); + exit(1); + } + + ret->duration = duration; + ret->r.head = initial_size - 1; + ret->r.maxsize = initial_size; + ret->r.buffer = calloc(initial_size, sizeof(time_value_t)); + if (ret->r.buffer == NULL) { + LOG_E(UTIL, "out of memory\n"); + exit(1); + } + + return ret; +} + +void time_average_free(time_average_t *t) +{ + free(t->r.buffer); + free(t); +} + +static void remove_old(time_average_t *t, uint64_t time) +{ + /* remove old events */ + while (t->r.size && t->r.buffer[t->r.tail].time < time - t->duration) { + t->accumulated_value -= t->r.buffer[t->r.tail].value; + t->r.size--; + t->r.tail++; + t->r.tail %= t->r.maxsize; + } +} + +void time_average_add(time_average_t *t, uint64_t time, uint64_t value) +{ + remove_old(t, time); + + if (t->r.size == t->r.maxsize) { + t->r.maxsize *= 2; + t->r.buffer = realloc(t->r.buffer, t->r.maxsize * sizeof(time_value_t)); + if (t->r.buffer == NULL) { + LOG_E(UTIL, "out of memory\n"); + exit(1); + } + if (t->r.head < t->r.tail) { + memcpy(&t->r.buffer[t->r.size], &t->r.buffer[0], (t->r.head + 1) * sizeof(time_value_t)); + t->r.head += t->r.size; + } + } + + t->r.head++; + t->r.head %= t->r.maxsize; + t->r.buffer[t->r.head].time = time; + t->r.buffer[t->r.head].value = value; + + t->r.size++; + + t->accumulated_value += value; +} + +double time_average_get_average(time_average_t *t, uint64_t time) +{ + remove_old(t, time); + + return (double)t->accumulated_value / t->r.size; +} + +uint64_t time_average_now(void) +{ + struct timespec t; + uint64_t ret; + + if (clock_gettime(CLOCK_REALTIME, &t)) { + LOG_E(UTIL, "clock_gettime failed\n"); + exit(1); + } + + ret = (uint64_t)t.tv_sec * (uint64_t)1000000 + t.tv_nsec / 1000; + /* round up if necessary */ + if (t.tv_nsec % 1000 >= 500) + ret++; + + return ret; +} diff --git a/common/utils/time_stat.h b/common/utils/time_stat.h new file mode 100644 index 0000000000..d038fc1bfa --- /dev/null +++ b/common/utils/time_stat.h @@ -0,0 +1,63 @@ +/* + * 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 _COMMON_UTIL_TIME_STAT_H_ +#define _COMMON_UTIL_TIME_STAT_H_ + +#include + +typedef struct { + uint64_t time; /* unit: microsecond */ + uint64_t value; /* unit: microsecond */ +} time_value_t; + +typedef struct { + int head; + int tail; + time_value_t *buffer; + int maxsize; + int size; +} time_ring_t; + +typedef struct { + int duration; /* unit: microsecond */ + time_ring_t r; + uint64_t accumulated_value; +} time_average_t; + +/* 'duration' is in unit microsecond */ +time_average_t *time_average_new(int duration, int initial_size); +void time_average_free(time_average_t *t); + +/* add a value tagged with time 'time' unit microsecond (it also modifies 't', + * removing all data with time < 'time' - t->duration) + */ +void time_average_add(time_average_t *t, uint64_t time, uint64_t value); + +/* get the average for time 'time' (it also modifies 't', removing all + * data with time < 'time' - t->duration) + */ +double time_average_get_average(time_average_t *t, uint64_t time); + +/* unit microsecond */ +uint64_t time_average_now(void); + +#endif /* _COMMON_UTIL_TIME_STAT_H_ */ diff --git a/openair2/LAYER2/nr_rlc/nr_rlc_entity.c b/openair2/LAYER2/nr_rlc/nr_rlc_entity.c index 311d31bfde..2db397db5d 100644 --- a/openair2/LAYER2/nr_rlc/nr_rlc_entity.c +++ b/openair2/LAYER2/nr_rlc/nr_rlc_entity.c @@ -29,12 +29,16 @@ #include "LOG/log.h" +#include "common/utils/time_stat.h" + static void nr_rlc_entity_get_stats( nr_rlc_entity_t *entity, nr_rlc_statistics_t *out) { // printf("Stats from the RLC entity asked\n"); *out = entity->stats; + out->txsdu_avg_time_to_tx = time_average_get_average(entity->txsdu_avg_time_to_tx, + time_average_now()); } nr_rlc_entity_t *new_nr_rlc_entity_am( @@ -105,6 +109,11 @@ nr_rlc_entity_t *new_nr_rlc_entity_am( ret->common.stats.mode = 0; /* 0 for AM */ + /* let's take average over the last 100 milliseconds + * initial_size of 1024 is arbitrary + */ + ret->common.txsdu_avg_time_to_tx = time_average_new(100 * 1000, 1024); + return (nr_rlc_entity_t *)ret; } @@ -155,6 +164,11 @@ nr_rlc_entity_t *new_nr_rlc_entity_um( ret->common.stats.mode = 1; /* 1 for UM */ + /* let's take average over the last 100 milliseconds + * initial_size of 1024 is arbitrary + */ + ret->common.txsdu_avg_time_to_tx = time_average_new(100 * 1000, 1024); + return (nr_rlc_entity_t *)ret; } @@ -190,5 +204,10 @@ nr_rlc_entity_t *new_nr_rlc_entity_tm( ret->common.stats.mode = 2; /* 2 for TM */ + /* let's take average over the last 100 milliseconds + * initial_size of 1024 is arbitrary + */ + ret->common.txsdu_avg_time_to_tx = time_average_new(100 * 1000, 1024); + return (nr_rlc_entity_t *)ret; } diff --git a/openair2/LAYER2/nr_rlc/nr_rlc_entity.h b/openair2/LAYER2/nr_rlc/nr_rlc_entity.h index fcb92a8a11..567cd57154 100644 --- a/openair2/LAYER2/nr_rlc/nr_rlc_entity.h +++ b/openair2/LAYER2/nr_rlc/nr_rlc_entity.h @@ -24,6 +24,8 @@ #include +#include "common/utils/time_stat.h" + #define NR_SDU_MAX 16000 /* max NR PDCP SDU size is 9000, let's take more */ typedef struct { @@ -77,6 +79,16 @@ typedef struct { uint32_t rxsdu_bytes; /* number of bytes of SDUs received */ uint32_t rxsdu_dd_pkts; /* number of dropped or discarded SDUs */ uint32_t rxsdu_dd_bytes; /* number of bytes of SDUs dropped or discarded */ + + /* Average time for an SDU to be passed to MAC. + * Actually measures the time it takes for any part of an SDU to be + * passed to MAC for the first time, that is: the first TX of (part of) the + * SDU. + * Since the MAC schedules in advance, it does not measure the time of + * transmission over the air, just the time to reach the MAC layer. + */ + double txsdu_avg_time_to_tx; + } nr_rlc_statistics_t; typedef struct { @@ -124,6 +136,7 @@ typedef struct nr_rlc_entity_t { nr_rlc_entity_buffer_status_t bstatus; nr_rlc_statistics_t stats; + time_average_t *txsdu_avg_time_to_tx; } nr_rlc_entity_t; nr_rlc_entity_t *new_nr_rlc_entity_am( diff --git a/openair2/LAYER2/nr_rlc/nr_rlc_entity_am.c b/openair2/LAYER2/nr_rlc/nr_rlc_entity_am.c index c81ae16335..fd37f030a4 100644 --- a/openair2/LAYER2/nr_rlc/nr_rlc_entity_am.c +++ b/openair2/LAYER2/nr_rlc/nr_rlc_entity_am.c @@ -27,6 +27,7 @@ #include "nr_rlc_pdu.h" #include "LOG/log.h" +#include "common/utils/time_stat.h" /* for a given SDU/SDU segment, computes the corresponding PDU header size */ static int compute_pdu_header_size(nr_rlc_entity_am_t *entity, @@ -1620,6 +1621,14 @@ static int generate_tx_pdu(nr_rlc_entity_am_t *entity, char *buffer, int size) entity->common.stats.txpdu_pkts++; entity->common.stats.txpdu_bytes += ret_size; + if (sdu->sdu->time_of_arrival) { + uint64_t time_now = time_average_now(); + uint64_t waited_time = time_now - sdu->sdu->time_of_arrival; + /* set time_of_arrival to 0 so as to update stats only once */ + sdu->sdu->time_of_arrival = 0; + time_average_add(entity->common.txsdu_avg_time_to_tx, time_now, waited_time); + } + return ret_size; // return serialize_sdu(entity, sdu, buffer, size, p); } @@ -1708,6 +1717,8 @@ void nr_rlc_entity_am_recv_sdu(nr_rlc_entity_t *_entity, /* update buffer status */ entity->common.bstatus.tx_size += compute_pdu_header_size(entity, sdu) + sdu->size; + + sdu->sdu->time_of_arrival = time_average_now(); } /*************************************************************************/ @@ -1949,6 +1960,7 @@ void nr_rlc_entity_am_delete(nr_rlc_entity_t *_entity) { nr_rlc_entity_am_t *entity = (nr_rlc_entity_am_t *)_entity; clear_entity(entity); + time_average_free(entity->common.txsdu_avg_time_to_tx); free(entity); } diff --git a/openair2/LAYER2/nr_rlc/nr_rlc_entity_tm.c b/openair2/LAYER2/nr_rlc/nr_rlc_entity_tm.c index 14cf8cad25..962dddc80b 100644 --- a/openair2/LAYER2/nr_rlc/nr_rlc_entity_tm.c +++ b/openair2/LAYER2/nr_rlc/nr_rlc_entity_tm.c @@ -25,6 +25,7 @@ #include #include "nr_rlc_pdu.h" +#include "common/utils/time_stat.h" #include "LOG/log.h" @@ -78,6 +79,13 @@ static int generate_tx_pdu(nr_rlc_entity_tm_t *entity, char *buffer, int size) entity->common.stats.txpdu_pkts++; entity->common.stats.txpdu_bytes += size; + if (sdu->sdu->time_of_arrival) { + uint64_t time_now = time_average_now(); + uint64_t waited_time = time_now - sdu->sdu->time_of_arrival; + /* set time_of_arrival to 0 so as to update stats only once */ + sdu->sdu->time_of_arrival = 0; + time_average_add(entity->common.txsdu_avg_time_to_tx, time_now, waited_time); + } /* update buffer status */ entity->common.bstatus.tx_size -= sdu->size; @@ -189,6 +197,7 @@ void nr_rlc_entity_tm_delete(nr_rlc_entity_t *_entity) { nr_rlc_entity_tm_t *entity = (nr_rlc_entity_tm_t *)_entity; clear_entity(entity); + time_average_free(entity->common.txsdu_avg_time_to_tx); free(entity); } diff --git a/openair2/LAYER2/nr_rlc/nr_rlc_entity_um.c b/openair2/LAYER2/nr_rlc/nr_rlc_entity_um.c index 5a8c18a29b..5ae1ca1fdd 100644 --- a/openair2/LAYER2/nr_rlc/nr_rlc_entity_um.c +++ b/openair2/LAYER2/nr_rlc/nr_rlc_entity_um.c @@ -27,6 +27,7 @@ #include "nr_rlc_pdu.h" #include "LOG/log.h" +#include "common/utils/time_stat.h" /* for a given SDU/SDU segment, computes the corresponding PDU header size */ static int compute_pdu_header_size(nr_rlc_entity_um_t *entity, @@ -516,12 +517,19 @@ static int generate_tx_pdu(nr_rlc_entity_um_t *entity, char *buffer, int size) ret = serialize_sdu(entity, sdu, buffer, size); entity->tx_size -= sdu->size; - nr_rlc_free_sdu_segment(sdu); entity->common.stats.txpdu_pkts++; entity->common.stats.txpdu_bytes += size; + if (sdu->sdu->time_of_arrival) { + uint64_t time_now = time_average_now(); + uint64_t waited_time = time_now - sdu->sdu->time_of_arrival; + /* set time_of_arrival to 0 so as to update stats only once */ + sdu->sdu->time_of_arrival = 0; + time_average_add(entity->common.txsdu_avg_time_to_tx, time_now, waited_time); + } + nr_rlc_free_sdu_segment(sdu); return ret; } @@ -736,6 +744,7 @@ void nr_rlc_entity_um_delete(nr_rlc_entity_t *_entity) { nr_rlc_entity_um_t *entity = (nr_rlc_entity_um_t *)_entity; clear_entity(entity); + time_average_free(entity->common.txsdu_avg_time_to_tx); free(entity); } diff --git a/openair2/LAYER2/nr_rlc/nr_rlc_sdu.h b/openair2/LAYER2/nr_rlc/nr_rlc_sdu.h index 20cc90f185..333b8742c3 100644 --- a/openair2/LAYER2/nr_rlc/nr_rlc_sdu.h +++ b/openair2/LAYER2/nr_rlc/nr_rlc_sdu.h @@ -22,6 +22,8 @@ #ifndef _NR_RLC_SDU_H_ #define _NR_RLC_SDU_H_ +#include + typedef struct nr_rlc_sdu_t { int sn; int upper_layer_id; @@ -34,6 +36,12 @@ typedef struct nr_rlc_sdu_t { * when it equals ref_count we can free the SDU * completely */ + + /* for statistics, will be set to 0 after SDU (or first part of it) has + * been serialized for MAC for the first time so that only the first + * transmission is used for statistics + */ + uint64_t time_of_arrival; /* unit microsecond */ } nr_rlc_sdu_t; typedef struct nr_rlc_sdu_segment_t { diff --git a/openair2/LAYER2/nr_rlc/tests/Makefile b/openair2/LAYER2/nr_rlc/tests/Makefile index 746d61483b..c23726444d 100644 --- a/openair2/LAYER2/nr_rlc/tests/Makefile +++ b/openair2/LAYER2/nr_rlc/tests/Makefile @@ -1,8 +1,8 @@ CC=gcc -CFLAGS=-Wall -g --coverage -I. +CFLAGS=-Wall -g --coverage -I. -I../../../.. LIB=nr_rlc_entity.o nr_rlc_entity_am.o nr_rlc_entity_um.o nr_rlc_entity_tm.o \ - nr_rlc_pdu.o nr_rlc_sdu.o + nr_rlc_pdu.o nr_rlc_sdu.o time_stat.o tests: @./run_tests.sh diff --git a/openair2/LAYER2/nr_rlc/tests/time_stat.c b/openair2/LAYER2/nr_rlc/tests/time_stat.c new file mode 100644 index 0000000000..dfc8a0d014 --- /dev/null +++ b/openair2/LAYER2/nr_rlc/tests/time_stat.c @@ -0,0 +1,25 @@ +#include "../../../../common/utils/time_stat.h" + +time_average_t *time_average_new(int duration, int initial_size) +{ + return (void *)0; +} + +void time_average_free(time_average_t *t) +{ +} + +void time_average_add(time_average_t *t, uint64_t time, uint64_t value) +{ +} + +double time_average_get_average(time_average_t *t, uint64_t time) +{ + return 0; +} + +uint64_t time_average_now(void) +{ + return 0; +} + From c0394bc09cb06d5d05b52165e3494ac42874a6ad Mon Sep 17 00:00:00 2001 From: Chieh-Chun Chen Date: Mon, 25 Jul 2022 16:54:58 +0200 Subject: [PATCH 13/88] Add avg time to tx an sdu for RLC UM & TM mode --- openair2/LAYER2/nr_rlc/nr_rlc_entity_tm.c | 2 ++ openair2/LAYER2/nr_rlc/nr_rlc_entity_um.c | 2 ++ 2 files changed, 4 insertions(+) diff --git a/openair2/LAYER2/nr_rlc/nr_rlc_entity_tm.c b/openair2/LAYER2/nr_rlc/nr_rlc_entity_tm.c index 962dddc80b..5903cd9c86 100644 --- a/openair2/LAYER2/nr_rlc/nr_rlc_entity_tm.c +++ b/openair2/LAYER2/nr_rlc/nr_rlc_entity_tm.c @@ -154,6 +154,8 @@ void nr_rlc_entity_tm_recv_sdu(nr_rlc_entity_t *_entity, /* update buffer status */ entity->common.bstatus.tx_size += sdu->size; + + sdu->sdu->time_of_arrival = time_average_now(); } /*************************************************************************/ diff --git a/openair2/LAYER2/nr_rlc/nr_rlc_entity_um.c b/openair2/LAYER2/nr_rlc/nr_rlc_entity_um.c index 5ae1ca1fdd..d8356419bc 100644 --- a/openair2/LAYER2/nr_rlc/nr_rlc_entity_um.c +++ b/openair2/LAYER2/nr_rlc/nr_rlc_entity_um.c @@ -594,6 +594,8 @@ void nr_rlc_entity_um_recv_sdu(nr_rlc_entity_t *_entity, /* update buffer status */ entity->common.bstatus.tx_size += compute_pdu_header_size(entity, sdu) + sdu->size; + + sdu->sdu->time_of_arrival = time_average_now(); } /*************************************************************************/ From 1b029be0585b3053158ba20d9c8c11b01196616b Mon Sep 17 00:00:00 2001 From: Cedric Roux Date: Thu, 4 Aug 2022 10:41:20 +0200 Subject: [PATCH 14/88] nr rlc stats: make avg time to tx optional Introduce the function nr_rlc_activate_avg_time_to_tx() to activate/deactivate collection of avg time to tx stats (which may have an impact on realtime processing, so better not compute them when not needed). Fix a little bug in time_average_get_average() for when there is not stat. --- common/utils/time_stat.c | 11 +++++++++ common/utils/time_stat.h | 1 + openair2/LAYER2/nr_rlc/nr_rlc_entity.c | 7 ++++-- openair2/LAYER2/nr_rlc/nr_rlc_entity.h | 1 + openair2/LAYER2/nr_rlc/nr_rlc_entity_am.c | 3 ++- openair2/LAYER2/nr_rlc/nr_rlc_entity_tm.c | 3 ++- openair2/LAYER2/nr_rlc/nr_rlc_entity_um.c | 3 ++- openair2/LAYER2/nr_rlc/nr_rlc_oai_api.c | 27 +++++++++++++++++++++++ openair2/LAYER2/nr_rlc/nr_rlc_oai_api.h | 5 +++++ 9 files changed, 56 insertions(+), 5 deletions(-) diff --git a/common/utils/time_stat.c b/common/utils/time_stat.c index 637cfdc4b5..dd648e1639 100644 --- a/common/utils/time_stat.c +++ b/common/utils/time_stat.c @@ -61,6 +61,14 @@ void time_average_free(time_average_t *t) free(t); } +void time_average_reset(time_average_t *t) +{ + t->r.head = t->r.maxsize - 1; + t->r.tail = 0; + t->r.size = 0; + t->accumulated_value = 0; +} + static void remove_old(time_average_t *t, uint64_t time) { /* remove old events */ @@ -103,6 +111,9 @@ double time_average_get_average(time_average_t *t, uint64_t time) { remove_old(t, time); + if (t->r.size == 0) + return 0; + return (double)t->accumulated_value / t->r.size; } diff --git a/common/utils/time_stat.h b/common/utils/time_stat.h index d038fc1bfa..d7508f5df0 100644 --- a/common/utils/time_stat.h +++ b/common/utils/time_stat.h @@ -46,6 +46,7 @@ typedef struct { /* 'duration' is in unit microsecond */ time_average_t *time_average_new(int duration, int initial_size); void time_average_free(time_average_t *t); +void time_average_reset(time_average_t *t); /* add a value tagged with time 'time' unit microsecond (it also modifies 't', * removing all data with time < 'time' - t->duration) diff --git a/openair2/LAYER2/nr_rlc/nr_rlc_entity.c b/openair2/LAYER2/nr_rlc/nr_rlc_entity.c index 2db397db5d..559ccd3c1c 100644 --- a/openair2/LAYER2/nr_rlc/nr_rlc_entity.c +++ b/openair2/LAYER2/nr_rlc/nr_rlc_entity.c @@ -37,8 +37,11 @@ static void nr_rlc_entity_get_stats( { // printf("Stats from the RLC entity asked\n"); *out = entity->stats; - out->txsdu_avg_time_to_tx = time_average_get_average(entity->txsdu_avg_time_to_tx, - time_average_now()); + if (entity->avg_time_is_on) + out->txsdu_avg_time_to_tx = time_average_get_average(entity->txsdu_avg_time_to_tx, + time_average_now()); + else + out->txsdu_avg_time_to_tx = 0; } nr_rlc_entity_t *new_nr_rlc_entity_am( diff --git a/openair2/LAYER2/nr_rlc/nr_rlc_entity.h b/openair2/LAYER2/nr_rlc/nr_rlc_entity.h index 567cd57154..dc0f2601db 100644 --- a/openair2/LAYER2/nr_rlc/nr_rlc_entity.h +++ b/openair2/LAYER2/nr_rlc/nr_rlc_entity.h @@ -137,6 +137,7 @@ typedef struct nr_rlc_entity_t { nr_rlc_statistics_t stats; time_average_t *txsdu_avg_time_to_tx; + int avg_time_is_on; } nr_rlc_entity_t; nr_rlc_entity_t *new_nr_rlc_entity_am( diff --git a/openair2/LAYER2/nr_rlc/nr_rlc_entity_am.c b/openair2/LAYER2/nr_rlc/nr_rlc_entity_am.c index fd37f030a4..15ad86c045 100644 --- a/openair2/LAYER2/nr_rlc/nr_rlc_entity_am.c +++ b/openair2/LAYER2/nr_rlc/nr_rlc_entity_am.c @@ -1718,7 +1718,8 @@ void nr_rlc_entity_am_recv_sdu(nr_rlc_entity_t *_entity, entity->common.bstatus.tx_size += compute_pdu_header_size(entity, sdu) + sdu->size; - sdu->sdu->time_of_arrival = time_average_now(); + if (entity->common.avg_time_is_on) + sdu->sdu->time_of_arrival = time_average_now(); } /*************************************************************************/ diff --git a/openair2/LAYER2/nr_rlc/nr_rlc_entity_tm.c b/openair2/LAYER2/nr_rlc/nr_rlc_entity_tm.c index 5903cd9c86..cfadf43d99 100644 --- a/openair2/LAYER2/nr_rlc/nr_rlc_entity_tm.c +++ b/openair2/LAYER2/nr_rlc/nr_rlc_entity_tm.c @@ -155,7 +155,8 @@ void nr_rlc_entity_tm_recv_sdu(nr_rlc_entity_t *_entity, /* update buffer status */ entity->common.bstatus.tx_size += sdu->size; - sdu->sdu->time_of_arrival = time_average_now(); + if (entity->common.avg_time_is_on) + sdu->sdu->time_of_arrival = time_average_now(); } /*************************************************************************/ diff --git a/openair2/LAYER2/nr_rlc/nr_rlc_entity_um.c b/openair2/LAYER2/nr_rlc/nr_rlc_entity_um.c index d8356419bc..43a2189c51 100644 --- a/openair2/LAYER2/nr_rlc/nr_rlc_entity_um.c +++ b/openair2/LAYER2/nr_rlc/nr_rlc_entity_um.c @@ -595,7 +595,8 @@ void nr_rlc_entity_um_recv_sdu(nr_rlc_entity_t *_entity, entity->common.bstatus.tx_size += compute_pdu_header_size(entity, sdu) + sdu->size; - sdu->sdu->time_of_arrival = time_average_now(); + if (entity->common.avg_time_is_on) + sdu->sdu->time_of_arrival = time_average_now(); } /*************************************************************************/ diff --git a/openair2/LAYER2/nr_rlc/nr_rlc_oai_api.c b/openair2/LAYER2/nr_rlc/nr_rlc_oai_api.c index 94bb8bf141..95ada37dbe 100644 --- a/openair2/LAYER2/nr_rlc/nr_rlc_oai_api.c +++ b/openair2/LAYER2/nr_rlc/nr_rlc_oai_api.c @@ -1111,6 +1111,33 @@ void rlc_tick(int a, int b) exit(1); } +void nr_rlc_activate_avg_time_to_tx( + const rnti_t rnti, + const logical_chan_id_t channel_id, + const bool is_on) +{ + nr_rlc_ue_t *ue; + nr_rlc_entity_t *rb; + + nr_rlc_manager_lock(nr_rlc_ue_manager); + ue = nr_rlc_manager_get_ue(nr_rlc_ue_manager, rnti); + + switch (channel_id) { + case 1 ... 3: rb = ue->srb[channel_id - 1]; break; + case 4 ... 8: rb = ue->drb[channel_id - 4]; break; + default: rb = NULL; break; + } + + if (rb != NULL) { + rb->avg_time_is_on = is_on; + time_average_reset(rb->txsdu_avg_time_to_tx); + } else { + LOG_E(RLC, "[%s] Radio Bearer (channel ID %d) is NULL for UE with rnti %x\n", __FUNCTION__, channel_id, rnti); + } + + nr_rlc_manager_unlock(nr_rlc_ue_manager); +} + /* returns 0 in case of error, 1 if everything ok */ int const nr_rlc_get_statistics( int rnti, diff --git a/openair2/LAYER2/nr_rlc/nr_rlc_oai_api.h b/openair2/LAYER2/nr_rlc/nr_rlc_oai_api.h index 92fbba9bec..83396f71e8 100644 --- a/openair2/LAYER2/nr_rlc/nr_rlc_oai_api.h +++ b/openair2/LAYER2/nr_rlc/nr_rlc_oai_api.h @@ -51,3 +51,8 @@ void nr_rlc_bearer_init_ul_spec(struct NR_LogicalChannelConfig *mac_LogicalChann int nr_rlc_get_available_tx_space( const rnti_t rntiP, const logical_chan_id_t channel_idP); + +void nr_rlc_activate_avg_time_to_tx( + const rnti_t rnti, + const logical_chan_id_t channel_id, + const bool is_on); From 3e2d88907be8881671603fe8a77bea3a767987aa Mon Sep 17 00:00:00 2001 From: Cedric Roux Date: Thu, 18 Aug 2022 17:07:04 +0200 Subject: [PATCH 15/88] use bool, not int --- openair2/LAYER2/nr_pdcp/nr_pdcp_oai_api.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/openair2/LAYER2/nr_pdcp/nr_pdcp_oai_api.c b/openair2/LAYER2/nr_pdcp/nr_pdcp_oai_api.c index 3f9c980710..ece0b0274d 100644 --- a/openair2/LAYER2/nr_pdcp/nr_pdcp_oai_api.c +++ b/openair2/LAYER2/nr_pdcp/nr_pdcp_oai_api.c @@ -1445,8 +1445,8 @@ nr_pdcp_ue_manager_t *nr_pdcp_sdap_get_ue_manager() { return nr_pdcp_ue_manager; } -/* returns 0 in case of error, 1 if everything ok */ -int const nr_pdcp_get_statistics( +/* returns false in case of error, true if everything ok */ +const bool nr_pdcp_get_statistics( int rnti, int srb_flag, int rb_id, @@ -1454,7 +1454,7 @@ int const nr_pdcp_get_statistics( { nr_pdcp_ue_t *ue; nr_pdcp_entity_t *rb; - int ret; + bool ret; nr_pdcp_manager_lock(nr_pdcp_ue_manager); ue = nr_pdcp_manager_get_ue(nr_pdcp_ue_manager, rnti); @@ -1473,9 +1473,9 @@ int const nr_pdcp_get_statistics( if (rb != NULL) { rb->get_stats(rb, out); - ret = 1; + ret = true; } else { - ret = 0; + ret = false; } nr_pdcp_manager_unlock(nr_pdcp_ue_manager); From 4e4a0b7ba3535c8a7e1f90706ab1c7cec97f21b1 Mon Sep 17 00:00:00 2001 From: Chieh-Chun Chen Date: Tue, 23 Aug 2022 15:54:03 +0200 Subject: [PATCH 16/88] use bool and fix indentation --- openair2/LAYER2/nr_pdcp/nr_pdcp_entity.c | 4 ++-- openair2/LAYER2/nr_rlc/nr_rlc_oai_api.c | 10 +++++----- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/openair2/LAYER2/nr_pdcp/nr_pdcp_entity.c b/openair2/LAYER2/nr_pdcp/nr_pdcp_entity.c index d1107bb82f..2c853d8eb6 100644 --- a/openair2/LAYER2/nr_pdcp/nr_pdcp_entity.c +++ b/openair2/LAYER2/nr_pdcp/nr_pdcp_entity.c @@ -118,7 +118,7 @@ static void nr_pdcp_entity_recv_pdu(nr_pdcp_entity_t *entity, if (memcmp(integrity, buffer + size - integrity_size, 4) != 0) { LOG_E(PDCP, "discard NR PDU, integrity failed\n"); // return; - entity->stats.rxpdu_dd_pkts++; + entity->stats.rxpdu_dd_pkts++; entity->stats.rxpdu_dd_bytes += size; @@ -128,7 +128,7 @@ static void nr_pdcp_entity_recv_pdu(nr_pdcp_entity_t *entity, if (rcvd_count < entity->rx_deliv || nr_pdcp_sdu_in_list(entity->rx_list, rcvd_count)) { LOG_W(PDCP, "discard NR PDU rcvd_count=%d, entity->rx_deliv %d,sdu_in_list %d\n", rcvd_count,entity->rx_deliv,nr_pdcp_sdu_in_list(entity->rx_list,rcvd_count)); - entity->stats.rxpdu_dd_pkts++; + entity->stats.rxpdu_dd_pkts++; entity->stats.rxpdu_dd_bytes += size; diff --git a/openair2/LAYER2/nr_rlc/nr_rlc_oai_api.c b/openair2/LAYER2/nr_rlc/nr_rlc_oai_api.c index 95ada37dbe..30d1d13baa 100644 --- a/openair2/LAYER2/nr_rlc/nr_rlc_oai_api.c +++ b/openair2/LAYER2/nr_rlc/nr_rlc_oai_api.c @@ -1138,8 +1138,8 @@ void nr_rlc_activate_avg_time_to_tx( nr_rlc_manager_unlock(nr_rlc_ue_manager); } -/* returns 0 in case of error, 1 if everything ok */ -int const nr_rlc_get_statistics( +/* returns false in case of error, true if everything ok */ +const bool nr_rlc_get_statistics( int rnti, int srb_flag, int rb_id, @@ -1147,7 +1147,7 @@ int const nr_rlc_get_statistics( { nr_rlc_ue_t *ue; nr_rlc_entity_t *rb; - int ret; + bool ret; nr_rlc_manager_lock(nr_rlc_ue_manager); ue = nr_rlc_manager_get_ue(nr_rlc_ue_manager, rnti); @@ -1164,9 +1164,9 @@ int const nr_rlc_get_statistics( if (rb != NULL) { rb->get_stats(rb, out); - ret = 1; + ret = true; } else { - ret = 0; + ret = false; } nr_rlc_manager_unlock(nr_rlc_ue_manager); From 1e36c48cf2697dc4da56257a1a3313d8e88f434b Mon Sep 17 00:00:00 2001 From: Thomas Schlichter Date: Thu, 14 Jul 2022 10:49:26 +0000 Subject: [PATCH 17/88] fix application of measured SSS fine frequency offset --- openair1/PHY/NR_UE_TRANSPORT/nr_initial_sync.c | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) diff --git a/openair1/PHY/NR_UE_TRANSPORT/nr_initial_sync.c b/openair1/PHY/NR_UE_TRANSPORT/nr_initial_sync.c index 064d4db1af..aa2d617112 100644 --- a/openair1/PHY/NR_UE_TRANSPORT/nr_initial_sync.c +++ b/openair1/PHY/NR_UE_TRANSPORT/nr_initial_sync.c @@ -207,7 +207,6 @@ int nr_initial_sync(UE_nr_rxtx_proc_t *proc, { int32_t sync_pos, sync_pos_frame; // k_ssb, N_ssb_crb, sync_pos2, - int32_t accumulated_freq_offset = 0; int32_t metric_tdd_ncp=0; uint8_t phase_tdd_ncp; double im, re; @@ -258,8 +257,6 @@ int nr_initial_sync(UE_nr_rxtx_proc_t *proc, LOG_I(PHY,"sync_pos %d ssb_offset %d \n",sync_pos,ue->ssb_offset); #endif - accumulated_freq_offset += ue->common_vars.freq_offset; - // digital compensation of FFO for SSB symbols if (ue->UE_fo_compensation){ double s_time = 1/(1.0e3*fp->samples_per_subframe); // sampling time @@ -310,8 +307,6 @@ int nr_initial_sync(UE_nr_rxtx_proc_t *proc, int freq_offset_sss = 0; ret = rx_sss_nr(ue, proc, &metric_tdd_ncp, &phase_tdd_ncp, &freq_offset_sss); - accumulated_freq_offset += freq_offset_sss; - // digital compensation of FFO for SSB symbols if (ue->UE_fo_compensation){ double s_time = 1/(1.0e3*fp->samples_per_subframe); // sampling time @@ -334,6 +329,8 @@ int nr_initial_sync(UE_nr_rxtx_proc_t *proc, ((short *)ue->common_vars.rxdata[ar])[2*n+1] = (short)(round(re*sin(n*off_angle) + im*cos(n*off_angle))); } } + + ue->common_vars.freq_offset += freq_offset_sss; } if (ret==0) { //we got sss channel @@ -603,8 +600,6 @@ int nr_initial_sync(UE_nr_rxtx_proc_t *proc, } if (dec == false) // sib1 not decoded ret = -1; - - ue->common_vars.freq_offset = accumulated_freq_offset; } // exit_fun("debug exit"); VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_NR_INITIAL_UE_SYNC, VCD_FUNCTION_OUT); From ea085b5fc146b244f0f5cd75beff870638f51d31 Mon Sep 17 00:00:00 2001 From: Thomas Schlichter Date: Mon, 25 Jul 2022 11:50:43 +0200 Subject: [PATCH 18/88] harmonize initialization of symbol- and timeshift-rotation --- executables/nr-uesoftmodem.c | 2 -- openair1/PHY/INIT/nr_init.c | 4 ++++ openair1/PHY/INIT/nr_init_ue.c | 2 ++ 3 files changed, 6 insertions(+), 2 deletions(-) diff --git a/executables/nr-uesoftmodem.c b/executables/nr-uesoftmodem.c index 92dab90014..8d689f7c00 100644 --- a/executables/nr-uesoftmodem.c +++ b/executables/nr-uesoftmodem.c @@ -518,8 +518,6 @@ int main( int argc, char **argv ) { *mac->scc->downlinkConfigCommon->frequencyInfoDL->frequencyBandList.list.array[0]); } - init_symbol_rotation(&UE[CC_id]->frame_parms); - init_timeshift_rotation(&UE[CC_id]->frame_parms); init_nr_ue_vars(UE[CC_id], 0, abstraction_flag); } diff --git a/openair1/PHY/INIT/nr_init.c b/openair1/PHY/INIT/nr_init.c index 6b984f53db..3088dbee5c 100644 --- a/openair1/PHY/INIT/nr_init.c +++ b/openair1/PHY/INIT/nr_init.c @@ -905,7 +905,11 @@ void nr_phy_config_request_sim(PHY_VARS_gNB *gNB, gNB_config->carrier_config.dl_bandwidth.value = config_bandwidth(mu, N_RB_DL, fp->nr_band); nr_init_frame_parms(gNB_config, fp); + fp->ofdm_offset_divisor = UINT_MAX; + init_symbol_rotation(fp); + init_timeshift_rotation(fp); + gNB->configured = 1; LOG_I(PHY,"gNB configured\n"); } diff --git a/openair1/PHY/INIT/nr_init_ue.c b/openair1/PHY/INIT/nr_init_ue.c index e396651133..64bbed571c 100644 --- a/openair1/PHY/INIT/nr_init_ue.c +++ b/openair1/PHY/INIT/nr_init_ue.c @@ -376,6 +376,8 @@ int init_nr_ue_signal(PHY_VARS_NR_UE *ue, int nb_connected_gNB) init_nr_prach_tables(839); init_symbol_rotation(fp); + init_timeshift_rotation(fp); + return 0; } From 9e1edf29573a8022bea80599aa131895e18e914c Mon Sep 17 00:00:00 2001 From: Thomas Schlichter Date: Mon, 25 Jul 2022 11:53:11 +0200 Subject: [PATCH 19/88] nr_phy_scope: improve x-axis scaling of channel impulse response and PUSCH LLR --- openair1/PHY/TOOLS/nr_phy_scope.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/openair1/PHY/TOOLS/nr_phy_scope.c b/openair1/PHY/TOOLS/nr_phy_scope.c index d4b28361d2..73f9324570 100644 --- a/openair1/PHY/TOOLS/nr_phy_scope.c +++ b/openair1/PHY/TOOLS/nr_phy_scope.c @@ -323,7 +323,7 @@ static void timeSignal (OAIgraph_t *graph, PHY_VARS_gNB *phy_vars_gnb, RU_t *phy */ static void timeResponse (OAIgraph_t *graph, scopeData_t *p, int nb_UEs) { - const int len=2*p->gNB->frame_parms.ofdm_symbol_size; + const int len=p->gNB->frame_parms.ofdm_symbol_size; float *values, *time; oai_xygraph_getbuff(graph, &time, &values, len, 0); const int ant=0; // display antenna 0 for each UE @@ -363,8 +363,10 @@ static void frequencyResponse (OAIgraph_t *graph, PHY_VARS_gNB *phy_vars_gnb, RU */ static void puschLLR (OAIgraph_t *graph, scopeData_t *p, int nb_UEs) { - //int Qm = 2; - int coded_bits_per_codeword =3*8*6144+12; // (8*((3*8*6144)+12)); // frame_parms->N_RB_UL*12*Qm*frame_parms->symbols_per_tti; + NR_DL_FRAME_PARMS *frame_parms=&p->gNB->frame_parms; + int num_re = frame_parms->N_RB_UL*12*frame_parms->symbols_per_slot; + int Qm = 2; + int coded_bits_per_codeword = num_re*Qm; for (int ue=0; uegNB->pusch_vars && From ae2e8060ea8980e146d453e70e38c078009355ba Mon Sep 17 00:00:00 2001 From: Thomas Schlichter Date: Mon, 25 Jul 2022 11:55:53 +0200 Subject: [PATCH 20/88] update band 66 configuration files for USRP X300 and N300 --- .../CONF/gnb.band66.tm1.106PRB.usrpx300.conf | 20 +- .../CONF/gnb.band66.tm1.25PRB.usrpn300.conf | 14 - .../CONF/gnb.band66.tm1.25PRB.usrpx300.conf | 249 ++++++++++++++++++ 3 files changed, 253 insertions(+), 30 deletions(-) create mode 100644 targets/PROJECTS/GENERIC-LTE-EPC/CONF/gnb.band66.tm1.25PRB.usrpx300.conf diff --git a/targets/PROJECTS/GENERIC-LTE-EPC/CONF/gnb.band66.tm1.106PRB.usrpx300.conf b/targets/PROJECTS/GENERIC-LTE-EPC/CONF/gnb.band66.tm1.106PRB.usrpx300.conf index 0818fe11d7..15620ef448 100644 --- a/targets/PROJECTS/GENERIC-LTE-EPC/CONF/gnb.band66.tm1.106PRB.usrpx300.conf +++ b/targets/PROJECTS/GENERIC-LTE-EPC/CONF/gnb.band66.tm1.106PRB.usrpx300.conf @@ -17,10 +17,12 @@ gNBs = plmn_list = ({mcc = 208; mnc = 93; mnc_length = 2;}); - tr_s_preference = "local_mac" + tr_s_preference = "local_mac"; ////////// Physical parameters: + min_rxtxtime = 6; + servingCellConfigCommon = ( { #spCellConfigCommon @@ -132,20 +134,6 @@ gNBs = # 0=kHz15, 1=kHz30, 2=kHz60, 3=kHz120 subcarrierSpacing = 1; - - #tdd-UL-DL-ConfigurationCommon -# subcarrierSpacing -# 0=kHz15, 1=kHz30, 2=kHz60, 3=kHz120 - referenceSubcarrierSpacing = 1; - # pattern1 - # dl_UL_TransmissionPeriodicity - # 0=ms0p5, 1=ms0p625, 2=ms1, 3=ms1p25, 4=ms2, 5=ms2p5, 6=ms5, 7=ms10 - dl_UL_TransmissionPeriodicity = 6; - nrofDownlinkSlots = 7; - nrofDownlinkSymbols = 6; - nrofUplinkSlots = 2; - nrofUplinkSymbols = 4; - ssPBCH_BlockPower = -25; } @@ -200,7 +188,7 @@ L1s = ( RUs = ( { - local_rf = "yes" + local_rf = "yes"; nb_tx = 1; nb_rx = 1; att_tx = 0; diff --git a/targets/PROJECTS/GENERIC-LTE-EPC/CONF/gnb.band66.tm1.25PRB.usrpn300.conf b/targets/PROJECTS/GENERIC-LTE-EPC/CONF/gnb.band66.tm1.25PRB.usrpn300.conf index 022f17e490..fe0525f760 100644 --- a/targets/PROJECTS/GENERIC-LTE-EPC/CONF/gnb.band66.tm1.25PRB.usrpn300.conf +++ b/targets/PROJECTS/GENERIC-LTE-EPC/CONF/gnb.band66.tm1.25PRB.usrpn300.conf @@ -132,20 +132,6 @@ gNBs = # 0=kHz15, 1=kHz30, 2=kHz60, 3=kHz120 subcarrierSpacing = 0; - - #tdd-UL-DL-ConfigurationCommon -# subcarrierSpacing -# 0=kHz15, 1=kHz30, 2=kHz60, 3=kHz120 - referenceSubcarrierSpacing = 0; - # pattern1 - # dl_UL_TransmissionPeriodicity - # 0=ms0p5, 1=ms0p625, 2=ms1, 3=ms1p25, 4=ms2, 5=ms2p5, 6=ms5, 7=ms10 - dl_UL_TransmissionPeriodicity = 6; - nrofDownlinkSlots = 7; - nrofDownlinkSymbols = 6; - nrofUplinkSlots = 2; - nrofUplinkSymbols = 4; - ssPBCH_BlockPower = -25; } diff --git a/targets/PROJECTS/GENERIC-LTE-EPC/CONF/gnb.band66.tm1.25PRB.usrpx300.conf b/targets/PROJECTS/GENERIC-LTE-EPC/CONF/gnb.band66.tm1.25PRB.usrpx300.conf new file mode 100644 index 0000000000..01f7bbb71a --- /dev/null +++ b/targets/PROJECTS/GENERIC-LTE-EPC/CONF/gnb.band66.tm1.25PRB.usrpx300.conf @@ -0,0 +1,249 @@ +Active_gNBs = ( "gNB-Eurecom-5GNRBox"); +# Asn1_verbosity, choice in: none, info, annoying +Asn1_verbosity = "none"; + +gNBs = +( + { + ////////// Identification parameters: + gNB_ID = 0xe00; + + cell_type = "CELL_MACRO_GNB"; + + gNB_name = "gNB-Eurecom-5GNRBox"; + + // Tracking area code, 0x0000 and 0xfffe are reserved values + tracking_area_code = 1; + + plmn_list = ({mcc = 208; mnc = 93; mnc_length = 2;}); + + tr_s_preference = "local_mac"; + + ////////// Physical parameters: + + min_rxtxtime = 6; + + servingCellConfigCommon = ( + { + #spCellConfigCommon + + physCellId = 0; + +# downlinkConfigCommon + #frequencyInfoDL + # this is 2150 MHz + 12 PRBs@15kHz SCS (same as initial BWP), points to Subcarrier 0 of RB#10 of SSB block + absoluteFrequencySSB = 430432; + dl_frequencyBand = 66; + # this is 2150 MHz + dl_absoluteFrequencyPointA = 430000; + #scs-SpecificCarrierList + dl_offstToCarrier = 0; +# subcarrierSpacing +# 0=kHz15, 1=kHz30, 2=kHz60, 3=kHz120 + dl_subcarrierSpacing = 0; + dl_carrierBandwidth = 25; + #initialDownlinkBWP + #genericParameters + # this is RBstart=0,L=25 (275*(L-1))+RBstart + initialDLBWPlocationAndBandwidth = 6600; +# subcarrierSpacing +# 0=kHz15, 1=kHz30, 2=kHz60, 3=kHz120 + initialDLBWPsubcarrierSpacing = 0; + #pdcch-ConfigCommon + initialDLBWPcontrolResourceSetZero = 0; + initialDLBWPsearchSpaceZero = 0; + + #uplinkConfigCommon + #frequencyInfoUL + ul_frequencyBand = 66; + ul_absoluteFrequencyPointA = 350000; + #scs-SpecificCarrierList + ul_offstToCarrier = 0; +# subcarrierSpacing +# 0=kHz15, 1=kHz30, 2=kHz60, 3=kHz120 + ul_subcarrierSpacing = 0; + ul_carrierBandwidth = 25; + pMax = 20; + #initialUplinkBWP + #genericParameters + initialULBWPlocationAndBandwidth = 6600; +# subcarrierSpacing +# 0=kHz15, 1=kHz30, 2=kHz60, 3=kHz120 + initialULBWPsubcarrierSpacing = 0; + #rach-ConfigCommon + #rach-ConfigGeneric + prach_ConfigurationIndex = 98; +#prach_msg1_FDM +#0 = one, 1=two, 2=four, 3=eight + prach_msg1_FDM = 0; + prach_msg1_FrequencyStart = 0; + zeroCorrelationZoneConfig = 13; + preambleReceivedTargetPower = -118; +#preamblTransMax (0...10) = (3,4,5,6,7,8,10,20,50,100,200) + preambleTransMax = 6; +#powerRampingStep +# 0=dB0,1=dB2,2=dB4,3=dB6 + powerRampingStep = 1; +#ra_ReponseWindow +#1,2,4,8,10,20,40,80 + ra_ResponseWindow = 4; +#ssb_perRACH_OccasionAndCB_PreamblesPerSSB_PR +#1=oneeighth,2=onefourth,3=half,4=one,5=two,6=four,7=eight,8=sixteen + ssb_perRACH_OccasionAndCB_PreamblesPerSSB_PR = 4; +#oneHalf (0..15) 4,8,12,16,...60,64 + ssb_perRACH_OccasionAndCB_PreamblesPerSSB = 15; +#ra_ContentionResolutionTimer +#(0..7) 8,16,24,32,40,48,56,64 + ra_ContentionResolutionTimer = 7; + rsrp_ThresholdSSB = 19; +#prach-RootSequenceIndex_PR +#1 = 839, 2 = 139 + prach_RootSequenceIndex_PR = 2; + prach_RootSequenceIndex = 1; + # SCS for msg1, can only be 15 for 30 kHz < 6 GHz, takes precendence over the one derived from prach-ConfigIndex + msg1_SubcarrierSpacing = 0; +# restrictedSetConfig +# 0=unrestricted, 1=restricted type A, 2=restricted type B + restrictedSetConfig = 0; + + msg3_DeltaPreamble = 1; + p0_NominalWithGrant =-90; + +# pucch-ConfigCommon setup : +# pucchGroupHopping +# 0 = neither, 1= group hopping, 2=sequence hopping + pucchGroupHopping = 0; + hoppingId = 40; + p0_nominal = -90; +# ssb_PositionsInBurs_BitmapPR +# 1=short, 2=medium, 3=long + ssb_PositionsInBurst_PR = 2; + ssb_PositionsInBurst_Bitmap = 0x1; + +# ssb_periodicityServingCell +# 0 = ms5, 1=ms10, 2=ms20, 3=ms40, 4=ms80, 5=ms160, 6=spare2, 7=spare1 + ssb_periodicityServingCell = 2; + +# dmrs_TypeA_position +# 0 = pos2, 1 = pos3 + dmrs_TypeA_Position = 0; + +# subcarrierSpacing +# 0=kHz15, 1=kHz30, 2=kHz60, 3=kHz120 + subcarrierSpacing = 0; + + ssPBCH_BlockPower = -25; + } + + ); + + + # ------- SCTP definitions + SCTP : + { + # Number of streams to use in input/output + SCTP_INSTREAMS = 2; + SCTP_OUTSTREAMS = 2; + }; + + + ////////// MME parameters: + mme_ip_address = ( { ipv4 = "192.168.12.26"; + ipv6 = "192:168:30::17"; + active = "yes"; + preference = "ipv4"; + } + ); + + NETWORK_INTERFACES : + { + + GNB_INTERFACE_NAME_FOR_S1_MME = "eth0"; + GNB_IPV4_ADDRESS_FOR_S1_MME = "192.168.12.111/24"; + GNB_INTERFACE_NAME_FOR_S1U = "eth0"; + GNB_IPV4_ADDRESS_FOR_S1U = "192.168.12.111/24"; + GNB_PORT_FOR_S1U = 2152; # Spec 2152 + }; + } +); + +MACRLCs = ( + { + num_cc = 1; + tr_s_preference = "local_L1"; + tr_n_preference = "local_RRC"; + } +); + +L1s = ( + { + num_cc = 1; + tr_n_preference = "local_mac"; + thread_pool_size = 8; + ofdm_offset_divisor = 8; #set this to UINT_MAX for offset 0 + } +); + +RUs = ( + { + local_rf = "yes"; + nb_tx = 1; + nb_rx = 1; + att_tx = 0; + att_rx = 10; + bands = [7]; + max_pdschReferenceSignalPower = -27; + max_rxgain = 114; + eNB_instances = [0]; + ## beamforming 1x2 matrix: 1 layer x 2 antennas + bf_weights = [0x00007fff, 0x0000]; + ## beamforming 1x4 matrix: 1 layer x 4 antennas + #bf_weights = [0x00007fff, 0x0000,0x0000, 0x0000]; + ## beamforming 2x2 matrix: + #bf_weights = [0x00007fff, 0x00000000, 0x00000000, 0x00007fff]; + ## beamforming 4x4 matrix: + #bf_weights = [0x00007fff, 0x0000, 0x0000, 0x0000, 0x00000000, 0x00007fff, 0x0000, 0x0000, 0x0000, 0x0000, 0x00007fff, 0x0000, 0x0000, 0x0000, 0x0000, 0x00007fff]; + sdr_addrs = "type=x300"; + clock_src = "external"; + # if_freq = 3700000000L; + # if_offset = 1000000; + } +); + +THREAD_STRUCT = ( + { + #three config for level of parallelism "PARALLEL_SINGLE_THREAD", "PARALLEL_RU_L1_SPLIT", or "PARALLEL_RU_L1_TRX_SPLIT" + parallel_config = "PARALLEL_RU_L1_TRX_SPLIT"; + #two option for worker "WORKER_DISABLE" or "WORKER_ENABLE" + worker_config = "WORKER_DISABLE"; + } +); + +security = { + # preferred ciphering algorithms + # the first one of the list that an UE supports in chosen + # valid values: nea0, nea1, nea2, nea3 + ciphering_algorithms = ( "nea0" ); + + # preferred integrity algorithms + # the first one of the list that an UE supports in chosen + # valid values: nia0, nia1, nia2, nia3 + integrity_algorithms = ( "nia2", "nia0" ); + + # setting 'drb_ciphering' to "no" disables ciphering for DRBs, no matter + # what 'ciphering_algorithms' configures; same thing for 'drb_integrity' + drb_ciphering = "yes"; + drb_integrity = "no"; +}; + + log_config : + { + global_log_level ="info"; + hw_log_level ="info"; + phy_log_level ="info"; + mac_log_level ="info"; + rlc_log_level ="info"; + pdcp_log_level ="info"; + rrc_log_level ="info"; + }; + From c42304a7978b35e521aee49f36ac80986219c8b2 Mon Sep 17 00:00:00 2001 From: Thomas Schlichter Date: Tue, 26 Jul 2022 15:29:36 +0200 Subject: [PATCH 21/88] nr_dlsim: also dump rxdataF_ext in case of debugging --- openair1/SIMULATION/NR_PHY/dlsim.c | 1 + 1 file changed, 1 insertion(+) diff --git a/openair1/SIMULATION/NR_PHY/dlsim.c b/openair1/SIMULATION/NR_PHY/dlsim.c index 0f57378946..e46af575c7 100644 --- a/openair1/SIMULATION/NR_PHY/dlsim.c +++ b/openair1/SIMULATION/NR_PHY/dlsim.c @@ -1437,6 +1437,7 @@ int main(int argc, char **argv) if (UE->frame_parms.nb_antennas_rx>1) LOG_M("rxsig1.m","rxs1", UE->common_vars.rxdata[1], frame_length_complex_samples, 1, 1); LOG_M("rxF0.m","rxF0", UE->common_vars.common_vars_rx_data_per_thread[UE_proc.thread_id].rxdataF[0], frame_parms->samples_per_slot_wCP, 1, 1); + LOG_M("rxF_ext.m","rxFe",&UE->pdsch_vars[0][0]->rxdataF_ext[0][0],g_rbSize*12*14,1,1); LOG_M("chestF0.m","chF0",&UE->pdsch_vars[0][0]->dl_ch_estimates_ext[0][0],g_rbSize*12*14,1,1); write_output("rxF_comp.m","rxFc",&UE->pdsch_vars[0][0]->rxdataF_comp0[0][0],N_RB_DL*12*14,1,1); LOG_M("rxF_llr.m","rxFllr",UE->pdsch_vars[UE_proc.thread_id][0]->llr[0],available_bits,1,0); From ef46fe8ba811c7451a311dbe7385cd0c0f0e5359 Mon Sep 17 00:00:00 2001 From: Thomas Schlichter Date: Thu, 4 Aug 2022 16:23:42 +0200 Subject: [PATCH 22/88] Add and harmonize configuration files for 5, 10, 40 MHz FDD with USRP X300 --- .../CONF/gnb.band66.tm1.106PRB.usrpx300.conf | 8 +- .../CONF/gnb.band66.tm1.24PRB.usrpx300.conf | 251 +++++++++++++++ .../CONF/gnb.band66.tm1.25PRB.usrpx300.conf | 4 +- .../gnb.sa.band66.fr1.106PRB.usrpx300.conf | 299 +++++++++++++++++ .../gnb.sa.band66.fr1.24PRB.usrpx300.conf | 300 ++++++++++++++++++ .../gnb.sa.band66.fr1.25PRB.usrpx300.conf | 300 ++++++++++++++++++ 6 files changed, 1156 insertions(+), 6 deletions(-) create mode 100644 targets/PROJECTS/GENERIC-LTE-EPC/CONF/gnb.band66.tm1.24PRB.usrpx300.conf create mode 100644 targets/PROJECTS/GENERIC-NR-5GC/CONF/gnb.sa.band66.fr1.106PRB.usrpx300.conf create mode 100644 targets/PROJECTS/GENERIC-NR-5GC/CONF/gnb.sa.band66.fr1.24PRB.usrpx300.conf create mode 100644 targets/PROJECTS/GENERIC-NR-5GC/CONF/gnb.sa.band66.fr1.25PRB.usrpx300.conf diff --git a/targets/PROJECTS/GENERIC-LTE-EPC/CONF/gnb.band66.tm1.106PRB.usrpx300.conf b/targets/PROJECTS/GENERIC-LTE-EPC/CONF/gnb.band66.tm1.106PRB.usrpx300.conf index 15620ef448..b235410173 100644 --- a/targets/PROJECTS/GENERIC-LTE-EPC/CONF/gnb.band66.tm1.106PRB.usrpx300.conf +++ b/targets/PROJECTS/GENERIC-LTE-EPC/CONF/gnb.band66.tm1.106PRB.usrpx300.conf @@ -102,11 +102,11 @@ gNBs = prach_RootSequenceIndex = 1; # SCS for msg1, can only be 15 for 30 kHz < 6 GHz, takes precendence over the one derived from prach-ConfigIndex # - msg1_SubcarrierSpacing = 1, + msg1_SubcarrierSpacing = 1; # restrictedSetConfig # 0=unrestricted, 1=restricted type A, 2=restricted type B - restrictedSetConfig = 0, + restrictedSetConfig = 0; msg3_DeltaPreamble = 1; p0_NominalWithGrant =-90; @@ -206,7 +206,7 @@ RUs = ( ## beamforming 4x4 matrix: #bf_weights = [0x00007fff, 0x0000, 0x0000, 0x0000, 0x00000000, 0x00007fff, 0x0000, 0x0000, 0x0000, 0x0000, 0x00007fff, 0x0000, 0x0000, 0x0000, 0x0000, 0x00007fff]; sdr_addrs = "type=x300"; - clock_src = "external"; + clock_src = "internal"; # if_freq = 3700000000L; # if_offset = 1000000; } @@ -217,7 +217,7 @@ THREAD_STRUCT = ( #three config for level of parallelism "PARALLEL_SINGLE_THREAD", "PARALLEL_RU_L1_SPLIT", or "PARALLEL_RU_L1_TRX_SPLIT" parallel_config = "PARALLEL_RU_L1_TRX_SPLIT"; #two option for worker "WORKER_DISABLE" or "WORKER_ENABLE" - worker_config = "WORKER_ENABLE"; + worker_config = "WORKER_DISABLE"; } ); diff --git a/targets/PROJECTS/GENERIC-LTE-EPC/CONF/gnb.band66.tm1.24PRB.usrpx300.conf b/targets/PROJECTS/GENERIC-LTE-EPC/CONF/gnb.band66.tm1.24PRB.usrpx300.conf new file mode 100644 index 0000000000..c74476902b --- /dev/null +++ b/targets/PROJECTS/GENERIC-LTE-EPC/CONF/gnb.band66.tm1.24PRB.usrpx300.conf @@ -0,0 +1,251 @@ +Active_gNBs = ( "gNB-Eurecom-5GNRBox"); +# Asn1_verbosity, choice in: none, info, annoying +Asn1_verbosity = "none"; + +gNBs = +( + { + ////////// Identification parameters: + gNB_ID = 0xe00; + + cell_type = "CELL_MACRO_GNB"; + + gNB_name = "gNB-Eurecom-5GNRBox"; + + // Tracking area code, 0x0000 and 0xfffe are reserved values + tracking_area_code = 1; + + plmn_list = ({mcc = 208; mnc = 93; mnc_length = 2;}); + + tr_s_preference = "local_mac"; + + ////////// Physical parameters: + + min_rxtxtime = 6; + + servingCellConfigCommon = ( + { + #spCellConfigCommon + + physCellId = 0; + +# downlinkConfigCommon + #frequencyInfoDL + # this is 2150 MHz + 12 PRBs@30kHz SCS (same as initial BWP) + absoluteFrequencySSB = 430864; + dl_frequencyBand = 66; + # this is 2150 MHz + dl_absoluteFrequencyPointA = 430000; + #scs-SpecificCarrierList + dl_offstToCarrier = 0; +# subcarrierSpacing +# 0=kHz15, 1=kHz30, 2=kHz60, 3=kHz120 + dl_subcarrierSpacing = 1; + dl_carrierBandwidth = 24; + #initialDownlinkBWP + #genericParameters + # this is RBstart=0,L=24 (275*(L-1))+RBstart + initialDLBWPlocationAndBandwidth = 6325; +# subcarrierSpacing +# 0=kHz15, 1=kHz30, 2=kHz60, 3=kHz120 + initialDLBWPsubcarrierSpacing = 1; + #pdcch-ConfigCommon + initialDLBWPcontrolResourceSetZero = 0; + initialDLBWPsearchSpaceZero = 0; + + #uplinkConfigCommon + #frequencyInfoUL + ul_frequencyBand = 66; + ul_absoluteFrequencyPointA = 350000; + #scs-SpecificCarrierList + ul_offstToCarrier = 0; +# subcarrierSpacing +# 0=kHz15, 1=kHz30, 2=kHz60, 3=kHz120 + ul_subcarrierSpacing = 1; + ul_carrierBandwidth = 24; + pMax = 20; + #initialUplinkBWP + #genericParameters + initialULBWPlocationAndBandwidth = 6325; +# subcarrierSpacing +# 0=kHz15, 1=kHz30, 2=kHz60, 3=kHz120 + initialULBWPsubcarrierSpacing = 1; + #rach-ConfigCommon + #rach-ConfigGeneric + prach_ConfigurationIndex = 98; +#prach_msg1_FDM +#0 = one, 1=two, 2=four, 3=eight + prach_msg1_FDM = 0; + prach_msg1_FrequencyStart = 0; + zeroCorrelationZoneConfig = 13; + preambleReceivedTargetPower = -118; +#preamblTransMax (0...10) = (3,4,5,6,7,8,10,20,50,100,200) + preambleTransMax = 6; +#powerRampingStep +# 0=dB0,1=dB2,2=dB4,3=dB6 + powerRampingStep = 1; +#ra_ReponseWindow +#1,2,4,8,10,20,40,80 + ra_ResponseWindow = 4; +#ssb_perRACH_OccasionAndCB_PreamblesPerSSB_PR +#1=oneeighth,2=onefourth,3=half,4=one,5=two,6=four,7=eight,8=sixteen + ssb_perRACH_OccasionAndCB_PreamblesPerSSB_PR = 4; +#oneHalf (0..15) 4,8,12,16,...60,64 + ssb_perRACH_OccasionAndCB_PreamblesPerSSB = 15; +#ra_ContentionResolutionTimer +#(0..7) 8,16,24,32,40,48,56,64 + ra_ContentionResolutionTimer = 7; + rsrp_ThresholdSSB = 19; +#prach-RootSequenceIndex_PR +#1 = 839, 2 = 139 + prach_RootSequenceIndex_PR = 2; + prach_RootSequenceIndex = 1; + # SCS for msg1, can only be 15 for 30 kHz < 6 GHz, takes precendence over the one derived from prach-ConfigIndex + # + msg1_SubcarrierSpacing = 1; + +# restrictedSetConfig +# 0=unrestricted, 1=restricted type A, 2=restricted type B + restrictedSetConfig = 0; + + msg3_DeltaPreamble = 1; + p0_NominalWithGrant =-90; + +# pucch-ConfigCommon setup : +# pucchGroupHopping +# 0 = neither, 1= group hopping, 2=sequence hopping + pucchGroupHopping = 0; + hoppingId = 40; + p0_nominal = -90; +# ssb_PositionsInBurs_BitmapPR +# 1=short, 2=medium, 3=long + ssb_PositionsInBurst_PR = 2; + ssb_PositionsInBurst_Bitmap = 1; + +# ssb_periodicityServingCell +# 0 = ms5, 1=ms10, 2=ms20, 3=ms40, 4=ms80, 5=ms160, 6=spare2, 7=spare1 + ssb_periodicityServingCell = 2; + +# dmrs_TypeA_position +# 0 = pos2, 1 = pos3 + dmrs_TypeA_Position = 0; + +# subcarrierSpacing +# 0=kHz15, 1=kHz30, 2=kHz60, 3=kHz120 + subcarrierSpacing = 1; + + ssPBCH_BlockPower = -25; + } + + ); + + + # ------- SCTP definitions + SCTP : + { + # Number of streams to use in input/output + SCTP_INSTREAMS = 2; + SCTP_OUTSTREAMS = 2; + }; + + + ////////// MME parameters: + mme_ip_address = ( { ipv4 = "192.168.12.26"; + ipv6 = "192:168:30::17"; + active = "yes"; + preference = "ipv4"; + } + ); + + NETWORK_INTERFACES : + { + + GNB_INTERFACE_NAME_FOR_S1_MME = "eth0"; + GNB_IPV4_ADDRESS_FOR_S1_MME = "192.168.12.111/24"; + GNB_INTERFACE_NAME_FOR_S1U = "eth0"; + GNB_IPV4_ADDRESS_FOR_S1U = "192.168.12.111/24"; + GNB_PORT_FOR_S1U = 2152; # Spec 2152 + }; + } +); + +MACRLCs = ( + { + num_cc = 1; + tr_s_preference = "local_L1"; + tr_n_preference = "local_RRC"; + } +); + +L1s = ( +{ + num_cc = 1; + tr_n_preference = "local_mac"; + thread_pool_size = 8; + ofdm_offset_divisor = 8; #set this to UINT_MAX for offset 0 +} +); + +RUs = ( + { + local_rf = "yes"; + nb_tx = 1; + nb_rx = 1; + att_tx = 0; + att_rx = 0; + bands = [7]; + max_pdschReferenceSignalPower = -27; + max_rxgain = 114; + eNB_instances = [0]; + ## beamforming 1x2 matrix: 1 layer x 2 antennas + bf_weights = [0x00007fff, 0x0000]; + ## beamforming 1x4 matrix: 1 layer x 4 antennas + #bf_weights = [0x00007fff, 0x0000,0x0000, 0x0000]; + ## beamforming 2x2 matrix: + #bf_weights = [0x00007fff, 0x00000000, 0x00000000, 0x00007fff]; + ## beamforming 4x4 matrix: + #bf_weights = [0x00007fff, 0x0000, 0x0000, 0x0000, 0x00000000, 0x00007fff, 0x0000, 0x0000, 0x0000, 0x0000, 0x00007fff, 0x0000, 0x0000, 0x0000, 0x0000, 0x00007fff]; + sdr_addrs = "type=x300"; + clock_src = "internal"; + # if_freq = 3700000000L; + # if_offset = 1000000; + } +); + +THREAD_STRUCT = ( + { + #three config for level of parallelism "PARALLEL_SINGLE_THREAD", "PARALLEL_RU_L1_SPLIT", or "PARALLEL_RU_L1_TRX_SPLIT" + parallel_config = "PARALLEL_RU_L1_TRX_SPLIT"; + #two option for worker "WORKER_DISABLE" or "WORKER_ENABLE" + worker_config = "WORKER_DISABLE"; + } +); + +security = { + # preferred ciphering algorithms + # the first one of the list that an UE supports in chosen + # valid values: nea0, nea1, nea2, nea3 + ciphering_algorithms = ( "nea0" ); + + # preferred integrity algorithms + # the first one of the list that an UE supports in chosen + # valid values: nia0, nia1, nia2, nia3 + integrity_algorithms = ( "nia2", "nia0" ); + + # setting 'drb_ciphering' to "no" disables ciphering for DRBs, no matter + # what 'ciphering_algorithms' configures; same thing for 'drb_integrity' + drb_ciphering = "yes"; + drb_integrity = "no"; +}; + + log_config : + { + global_log_level ="info"; + hw_log_level ="info"; + phy_log_level ="info"; + mac_log_level ="info"; + rlc_log_level ="info"; + pdcp_log_level ="info"; + rrc_log_level ="info"; + }; + diff --git a/targets/PROJECTS/GENERIC-LTE-EPC/CONF/gnb.band66.tm1.25PRB.usrpx300.conf b/targets/PROJECTS/GENERIC-LTE-EPC/CONF/gnb.band66.tm1.25PRB.usrpx300.conf index 01f7bbb71a..ac1dba7e42 100644 --- a/targets/PROJECTS/GENERIC-LTE-EPC/CONF/gnb.band66.tm1.25PRB.usrpx300.conf +++ b/targets/PROJECTS/GENERIC-LTE-EPC/CONF/gnb.band66.tm1.25PRB.usrpx300.conf @@ -190,7 +190,7 @@ RUs = ( nb_tx = 1; nb_rx = 1; att_tx = 0; - att_rx = 10; + att_rx = 0; bands = [7]; max_pdschReferenceSignalPower = -27; max_rxgain = 114; @@ -204,7 +204,7 @@ RUs = ( ## beamforming 4x4 matrix: #bf_weights = [0x00007fff, 0x0000, 0x0000, 0x0000, 0x00000000, 0x00007fff, 0x0000, 0x0000, 0x0000, 0x0000, 0x00007fff, 0x0000, 0x0000, 0x0000, 0x0000, 0x00007fff]; sdr_addrs = "type=x300"; - clock_src = "external"; + clock_src = "internal"; # if_freq = 3700000000L; # if_offset = 1000000; } diff --git a/targets/PROJECTS/GENERIC-NR-5GC/CONF/gnb.sa.band66.fr1.106PRB.usrpx300.conf b/targets/PROJECTS/GENERIC-NR-5GC/CONF/gnb.sa.band66.fr1.106PRB.usrpx300.conf new file mode 100644 index 0000000000..560febad88 --- /dev/null +++ b/targets/PROJECTS/GENERIC-NR-5GC/CONF/gnb.sa.band66.fr1.106PRB.usrpx300.conf @@ -0,0 +1,299 @@ +Active_gNBs = ( "5G-GOA-gNB"); +# Asn1_verbosity, choice in: none, info, annoying +Asn1_verbosity = "none"; + +gNBs = +( + { + ////////// Identification parameters: + gNB_ID = 0xe00; + gNB_name = "5G-GOA-gNB"; + + // Tracking area code, 0x0000 and 0xfffe are reserved values + tracking_area_code = 1; + plmn_list = ({ + mcc = 208; + mnc = 99; + mnc_length = 2; + snssaiList = ( + { + sst = 1; + sd = 0x1; // 0 false, else true + }, + { + sst = 1; + sd = 0x112233; // 0 false, else true + } + ); + + }); + + nr_cellid = 12345678L; + + ////////// Physical parameters: + + min_rxtxtime = 6; + + pdcch_ConfigSIB1 = ( + { + controlResourceSetZero = 12; + searchSpaceZero = 0; + } + ); + + servingCellConfigCommon = ( + { + #spCellConfigCommon + + physCellId = 0; + +# downlinkConfigCommon + #frequencyInfoDL + # this is 2150 MHz + 61 PRBs@30kHz SCS + absoluteFrequencySSB = 434392; + dl_frequencyBand = 66; + # this is 2150 MHz + dl_absoluteFrequencyPointA = 430000; + #scs-SpecificCarrierList + dl_offstToCarrier = 0; +# subcarrierSpacing +# 0=kHz15, 1=kHz30, 2=kHz60, 3=kHz120 + dl_subcarrierSpacing = 1; + dl_carrierBandwidth = 106; + #initialDownlinkBWP + #genericParameters + # this is RBstart=0,L=106 (275*(L-1))+RBstart + initialDLBWPlocationAndBandwidth = 28875; # 13475 6366 12925 12956 28875 12952 +# subcarrierSpacing +# 0=kHz15, 1=kHz30, 2=kHz60, 3=kHz120 + initialDLBWPsubcarrierSpacing = 1; + #pdcch-ConfigCommon + initialDLBWPcontrolResourceSetZero = 12; + initialDLBWPsearchSpaceZero = 0; + + #uplinkConfigCommon + #frequencyInfoUL + ul_frequencyBand = 66; + # this is 1750 MHz + ul_absoluteFrequencyPointA = 350000; + #scs-SpecificCarrierList + ul_offstToCarrier = 0; +# subcarrierSpacing +# 0=kHz15, 1=kHz30, 2=kHz60, 3=kHz120 + ul_subcarrierSpacing = 1; + ul_carrierBandwidth = 106; + pMax = 20; + #initialUplinkBWP + #genericParameters + initialULBWPlocationAndBandwidth = 28875; +# subcarrierSpacing +# 0=kHz15, 1=kHz30, 2=kHz60, 3=kHz120 + initialULBWPsubcarrierSpacing = 1; + #rach-ConfigCommon + #rach-ConfigGeneric + prach_ConfigurationIndex = 98; +#prach_msg1_FDM +#0 = one, 1=two, 2=four, 3=eight + prach_msg1_FDM = 0; + prach_msg1_FrequencyStart = 0; + zeroCorrelationZoneConfig = 13; + preambleReceivedTargetPower = -118; +#preamblTransMax (0...10) = (3,4,5,6,7,8,10,20,50,100,200) + preambleTransMax = 6; +#powerRampingStep +# 0=dB0,1=dB2,2=dB4,3=dB6 + powerRampingStep = 1; +#ra_ReponseWindow +#1,2,4,8,10,20,40,80 + ra_ResponseWindow = 4; +#ssb_perRACH_OccasionAndCB_PreamblesPerSSB_PR +#1=oneeighth,2=onefourth,3=half,4=one,5=two,6=four,7=eight,8=sixteen + ssb_perRACH_OccasionAndCB_PreamblesPerSSB_PR = 4; +#oneHalf (0..15) 4,8,12,16,...60,64 + ssb_perRACH_OccasionAndCB_PreamblesPerSSB = 15; +#ra_ContentionResolutionTimer +#(0..7) 8,16,24,32,40,48,56,64 + ra_ContentionResolutionTimer = 7; + rsrp_ThresholdSSB = 19; +#prach-RootSequenceIndex_PR +#1 = 839, 2 = 139 + prach_RootSequenceIndex_PR = 2; + prach_RootSequenceIndex = 1; + # SCS for msg1, can only be 15 for 30 kHz < 6 GHz, takes precendence over the one derived from prach-ConfigIndex + # + msg1_SubcarrierSpacing = 1; +# restrictedSetConfig +# 0=unrestricted, 1=restricted type A, 2=restricted type B + restrictedSetConfig = 0; + + msg3_DeltaPreamble = 1; + p0_NominalWithGrant =-90; + +# pucch-ConfigCommon setup : +# pucchGroupHopping +# 0 = neither, 1= group hopping, 2=sequence hopping + pucchGroupHopping = 0; + hoppingId = 40; + p0_nominal = -90; +# ssb_PositionsInBurs_BitmapPR +# 1=short, 2=medium, 3=long + ssb_PositionsInBurst_PR = 2; + ssb_PositionsInBurst_Bitmap = 1; + +# ssb_periodicityServingCell +# 0 = ms5, 1=ms10, 2=ms20, 3=ms40, 4=ms80, 5=ms160, 6=spare2, 7=spare1 + ssb_periodicityServingCell = 2; + +# dmrs_TypeA_position +# 0 = pos2, 1 = pos3 + dmrs_TypeA_Position = 0; + +# subcarrierSpacing +# 0=kHz15, 1=kHz30, 2=kHz60, 3=kHz120 + subcarrierSpacing = 1; + + + #tdd-UL-DL-ConfigurationCommon +# subcarrierSpacing +# 0=kHz15, 1=kHz30, 2=kHz60, 3=kHz120 + referenceSubcarrierSpacing = 1; + # pattern1 + # dl_UL_TransmissionPeriodicity + # 0=ms0p5, 1=ms0p625, 2=ms1, 3=ms1p25, 4=ms2, 5=ms2p5, 6=ms5, 7=ms10 + dl_UL_TransmissionPeriodicity = 6; + nrofDownlinkSlots = 7; + nrofDownlinkSymbols = 6; + nrofUplinkSlots = 2; + nrofUplinkSymbols = 4; + + ssPBCH_BlockPower = -25; + } + + ); + + + # ------- SCTP definitions + SCTP : + { + # Number of streams to use in input/output + SCTP_INSTREAMS = 2; + SCTP_OUTSTREAMS = 2; + }; + + + ////////// AMF parameters: + amf_ip_address = ( { ipv4 = "192.168.71.132"; + ipv6 = "192:168:30::17"; + active = "yes"; + preference = "ipv4"; + } + ); + + NETWORK_INTERFACES : + { + GNB_INTERFACE_NAME_FOR_NG_AMF = "eno1"; + GNB_IPV4_ADDRESS_FOR_NG_AMF = "192.168.71.129/26"; + GNB_INTERFACE_NAME_FOR_NGU = "eno1"; + GNB_IPV4_ADDRESS_FOR_NGU = "192.168.71.129/26"; + GNB_PORT_FOR_S1U = 2152; # Spec 2152 + }; + + } +); + +MACRLCs = ( +{ + num_cc = 1; + tr_s_preference = "local_L1"; + tr_n_preference = "local_RRC"; + pusch_TargetSNRx10 = 150; + pucch_TargetSNRx10 = 200; + ulsch_max_frame_inactivity = 0; +} +); + +L1s = ( +{ + num_cc = 1; + tr_n_preference = "local_mac"; + prach_dtx_threshold = 120; + pucch0_dtx_threshold = 150; + ofdm_offset_divisor = 8; #set this to UINT_MAX for offset 0 +} +); + +RUs = ( + { + local_rf = "yes"; + nb_tx = 1; + nb_rx = 1; + att_tx = 0; + att_rx = 0; + bands = [7]; + max_pdschReferenceSignalPower = -27; + max_rxgain = 114; + sf_extension = 0; + eNB_instances = [0]; + ##beamforming 1x2 matrix: 1 layer x 2 antennas + bf_weights = [0x00007fff, 0x0000]; + ##beamforming 1x4 matrix: 1 layer x 4 antennas + #bf_weights = [0x00007fff, 0x0000,0x0000, 0x0000]; + ## beamforming 2x2 matrix: + # bf_weights = [0x00007fff, 0x00000000, 0x00000000, 0x00007fff]; + ## beamforming 4x4 matrix: + #bf_weights = [0x00007fff, 0x0000, 0x0000, 0x0000, 0x00000000, 0x00007fff, 0x0000, 0x0000, 0x0000, 0x0000, 0x00007fff, 0x0000, 0x0000, 0x0000, 0x0000, 0x00007fff]; + sdr_addrs = "type=x300"; + clock_src = "internal"; + # if_freq = 3700000000L; + # if_offset = 1000000; + } +); + +THREAD_STRUCT = ( +{ + #three config for level of parallelism "PARALLEL_SINGLE_THREAD", "PARALLEL_RU_L1_SPLIT", or "PARALLEL_RU_L1_TRX_SPLIT" + parallel_config = "PARALLEL_RU_L1_TRX_SPLIT"; + #two option for worker "WORKER_DISABLE" or "WORKER_ENABLE" + worker_config = "WORKER_DISABLE"; +} +); + +rfsimulator : +{ + serveraddr = "server"; + serverport = "4043"; + options = (); #("saviq"); or/and "chanmod" + modelname = "AWGN"; + IQfile = "/tmp/rfsimulator.iqs"; +}; + +security = { + # preferred ciphering algorithms + # the first one of the list that an UE supports in chosen + # valid values: nea0, nea1, nea2, nea3 + ciphering_algorithms = ( "nea0" ); + + # preferred integrity algorithms + # the first one of the list that an UE supports in chosen + # valid values: nia0, nia1, nia2, nia3 + integrity_algorithms = ( "nia2", "nia0" ); + + # setting 'drb_ciphering' to "no" disables ciphering for DRBs, no matter + # what 'ciphering_algorithms' configures; same thing for 'drb_integrity' + drb_ciphering = "yes"; + drb_integrity = "no"; +}; + +log_config : +{ + global_log_level ="info"; + hw_log_level ="info"; + phy_log_level ="info"; + mac_log_level ="info"; + rlc_log_level ="info"; + pdcp_log_level ="info"; + rrc_log_level ="info"; + ngap_log_level ="debug"; + f1ap_log_level ="debug"; +}; + diff --git a/targets/PROJECTS/GENERIC-NR-5GC/CONF/gnb.sa.band66.fr1.24PRB.usrpx300.conf b/targets/PROJECTS/GENERIC-NR-5GC/CONF/gnb.sa.band66.fr1.24PRB.usrpx300.conf new file mode 100644 index 0000000000..3e7f50f506 --- /dev/null +++ b/targets/PROJECTS/GENERIC-NR-5GC/CONF/gnb.sa.band66.fr1.24PRB.usrpx300.conf @@ -0,0 +1,300 @@ +Active_gNBs = ( "5G-GOA-gNB"); +# Asn1_verbosity, choice in: none, info, annoying +Asn1_verbosity = "none"; + +gNBs = +( + { + ////////// Identification parameters: + gNB_ID = 0xe00; + gNB_name = "5G-GOA-gNB"; + + // Tracking area code, 0x0000 and 0xfffe are reserved values + tracking_area_code = 1; + plmn_list = ({ + mcc = 208; + mnc = 99; + mnc_length = 2; + snssaiList = ( + { + sst = 1; + sd = 0x1; // 0 false, else true + }, + { + sst = 1; + sd = 0x112233; // 0 false, else true + } + ); + + }); + + nr_cellid = 12345678L; + + ////////// Physical parameters: + + sib1_tda = 5; + min_rxtxtime = 6; + + pdcch_ConfigSIB1 = ( + { + controlResourceSetZero = 4; + searchSpaceZero = 0; + } + ); + + servingCellConfigCommon = ( + { + #spCellConfigCommon + + physCellId = 0; + +# downlinkConfigCommon + #frequencyInfoDL + # this is 2150 MHz + 14 PRBs@30kHz SCS (same as initial BWP), points to Subcarrier 0 of RB#10 of SSB block + absoluteFrequencySSB = 431008; + dl_frequencyBand = 66; + # this is 2150 MHz + dl_absoluteFrequencyPointA = 430000; + #scs-SpecificCarrierList + dl_offstToCarrier = 0; +# subcarrierSpacing +# 0=kHz15, 1=kHz30, 2=kHz60, 3=kHz120 + dl_subcarrierSpacing = 1; + dl_carrierBandwidth = 24; + #initialDownlinkBWP + #genericParameters + # this is RBstart=0,L=24 (275*(L-1))+RBstart + initialDLBWPlocationAndBandwidth = 6325; +# subcarrierSpacing +# 0=kHz15, 1=kHz30, 2=kHz60, 3=kHz120 + initialDLBWPsubcarrierSpacing = 1; + #pdcch-ConfigCommon + initialDLBWPcontrolResourceSetZero = 4; + initialDLBWPsearchSpaceZero = 0; + + #uplinkConfigCommon + #frequencyInfoUL + ul_frequencyBand = 66; + # this is 1750 MHz + ul_absoluteFrequencyPointA = 350000; + #scs-SpecificCarrierList + ul_offstToCarrier = 0; +# subcarrierSpacing +# 0=kHz15, 1=kHz30, 2=kHz60, 3=kHz120 + ul_subcarrierSpacing = 1; + ul_carrierBandwidth = 24; + pMax = 20; + #initialUplinkBWP + #genericParameters + initialULBWPlocationAndBandwidth = 6325; +# subcarrierSpacing +# 0=kHz15, 1=kHz30, 2=kHz60, 3=kHz120 + initialULBWPsubcarrierSpacing = 1; + #rach-ConfigCommon + #rach-ConfigGeneric + prach_ConfigurationIndex = 98; +#prach_msg1_FDM +#0 = one, 1=two, 2=four, 3=eight + prach_msg1_FDM = 0; + prach_msg1_FrequencyStart = 0; + zeroCorrelationZoneConfig = 13; + preambleReceivedTargetPower = -118; +#preamblTransMax (0...10) = (3,4,5,6,7,8,10,20,50,100,200) + preambleTransMax = 6; +#powerRampingStep +# 0=dB0,1=dB2,2=dB4,3=dB6 + powerRampingStep = 1; +#ra_ReponseWindow +#1,2,4,8,10,20,40,80 + ra_ResponseWindow = 4; +#ssb_perRACH_OccasionAndCB_PreamblesPerSSB_PR +#1=oneeighth,2=onefourth,3=half,4=one,5=two,6=four,7=eight,8=sixteen + ssb_perRACH_OccasionAndCB_PreamblesPerSSB_PR = 4; +#oneHalf (0..15) 4,8,12,16,...60,64 + ssb_perRACH_OccasionAndCB_PreamblesPerSSB = 15; +#ra_ContentionResolutionTimer +#(0..7) 8,16,24,32,40,48,56,64 + ra_ContentionResolutionTimer = 7; + rsrp_ThresholdSSB = 19; +#prach-RootSequenceIndex_PR +#1 = 839, 2 = 139 + prach_RootSequenceIndex_PR = 2; + prach_RootSequenceIndex = 1; + # SCS for msg1, can only be 15 for 30 kHz < 6 GHz, takes precendence over the one derived from prach-ConfigIndex + # + msg1_SubcarrierSpacing = 1; +# restrictedSetConfig +# 0=unrestricted, 1=restricted type A, 2=restricted type B + restrictedSetConfig = 0; + + msg3_DeltaPreamble = 1; + p0_NominalWithGrant =-90; + +# pucch-ConfigCommon setup : +# pucchGroupHopping +# 0 = neither, 1= group hopping, 2=sequence hopping + pucchGroupHopping = 0; + hoppingId = 40; + p0_nominal = -90; +# ssb_PositionsInBurs_BitmapPR +# 1=short, 2=medium, 3=long + ssb_PositionsInBurst_PR = 2; + ssb_PositionsInBurst_Bitmap = 1; + +# ssb_periodicityServingCell +# 0 = ms5, 1=ms10, 2=ms20, 3=ms40, 4=ms80, 5=ms160, 6=spare2, 7=spare1 + ssb_periodicityServingCell = 2; + +# dmrs_TypeA_position +# 0 = pos2, 1 = pos3 + dmrs_TypeA_Position = 0; + +# subcarrierSpacing +# 0=kHz15, 1=kHz30, 2=kHz60, 3=kHz120 + subcarrierSpacing = 1; + + + #tdd-UL-DL-ConfigurationCommon +# subcarrierSpacing +# 0=kHz15, 1=kHz30, 2=kHz60, 3=kHz120 + referenceSubcarrierSpacing = 1; + # pattern1 + # dl_UL_TransmissionPeriodicity + # 0=ms0p5, 1=ms0p625, 2=ms1, 3=ms1p25, 4=ms2, 5=ms2p5, 6=ms5, 7=ms10 + dl_UL_TransmissionPeriodicity = 6; + nrofDownlinkSlots = 7; + nrofDownlinkSymbols = 6; + nrofUplinkSlots = 2; + nrofUplinkSymbols = 4; + + ssPBCH_BlockPower = -25; + } + + ); + + + # ------- SCTP definitions + SCTP : + { + # Number of streams to use in input/output + SCTP_INSTREAMS = 2; + SCTP_OUTSTREAMS = 2; + }; + + + ////////// AMF parameters: + amf_ip_address = ( { ipv4 = "192.168.71.132"; + ipv6 = "192:168:30::17"; + active = "yes"; + preference = "ipv4"; + } + ); + + NETWORK_INTERFACES : + { + GNB_INTERFACE_NAME_FOR_NG_AMF = "eno1"; + GNB_IPV4_ADDRESS_FOR_NG_AMF = "192.168.71.129/26"; + GNB_INTERFACE_NAME_FOR_NGU = "eno1"; + GNB_IPV4_ADDRESS_FOR_NGU = "192.168.71.129/26"; + GNB_PORT_FOR_S1U = 2152; # Spec 2152 + }; + + } +); + +MACRLCs = ( +{ + num_cc = 1; + tr_s_preference = "local_L1"; + tr_n_preference = "local_RRC"; + pusch_TargetSNRx10 = 150; + pucch_TargetSNRx10 = 200; + ulsch_max_frame_inactivity = 0; +} +); + +L1s = ( +{ + num_cc = 1; + tr_n_preference = "local_mac"; + prach_dtx_threshold = 120; + pucch0_dtx_threshold = 150; + ofdm_offset_divisor = 8; #set this to UINT_MAX for offset 0 +} +); + +RUs = ( + { + local_rf = "yes"; + nb_tx = 1; + nb_rx = 1; + att_tx = 0; + att_rx = 0; + bands = [7]; + max_pdschReferenceSignalPower = -27; + max_rxgain = 114; + sf_extension = 0; + eNB_instances = [0]; + ##beamforming 1x2 matrix: 1 layer x 2 antennas + bf_weights = [0x00007fff, 0x0000]; + ##beamforming 1x4 matrix: 1 layer x 4 antennas + #bf_weights = [0x00007fff, 0x0000,0x0000, 0x0000]; + ## beamforming 2x2 matrix: + # bf_weights = [0x00007fff, 0x00000000, 0x00000000, 0x00007fff]; + ## beamforming 4x4 matrix: + #bf_weights = [0x00007fff, 0x0000, 0x0000, 0x0000, 0x00000000, 0x00007fff, 0x0000, 0x0000, 0x0000, 0x0000, 0x00007fff, 0x0000, 0x0000, 0x0000, 0x0000, 0x00007fff]; + sdr_addrs = "type=x300"; + clock_src = "internal"; + # if_freq = 3700000000L; + # if_offset = 1000000; + } +); + +THREAD_STRUCT = ( + { + #three config for level of parallelism "PARALLEL_SINGLE_THREAD", "PARALLEL_RU_L1_SPLIT", or "PARALLEL_RU_L1_TRX_SPLIT" + parallel_config = "PARALLEL_RU_L1_TRX_SPLIT"; + #two option for worker "WORKER_DISABLE" or "WORKER_ENABLE" + worker_config = "WORKER_DISABLE"; + } +); + +rfsimulator : +{ + serveraddr = "server"; + serverport = "4043"; + options = (); #("saviq"); or/and "chanmod" + modelname = "AWGN"; + IQfile = "/tmp/rfsimulator.iqs"; +}; + +security = { + # preferred ciphering algorithms + # the first one of the list that an UE supports in chosen + # valid values: nea0, nea1, nea2, nea3 + ciphering_algorithms = ( "nea0" ); + + # preferred integrity algorithms + # the first one of the list that an UE supports in chosen + # valid values: nia0, nia1, nia2, nia3 + integrity_algorithms = ( "nia2", "nia0" ); + + # setting 'drb_ciphering' to "no" disables ciphering for DRBs, no matter + # what 'ciphering_algorithms' configures; same thing for 'drb_integrity' + drb_ciphering = "yes"; + drb_integrity = "no"; +}; + +log_config : +{ + global_log_level ="info"; + hw_log_level ="info"; + phy_log_level ="info"; + mac_log_level ="info"; + rlc_log_level ="info"; + pdcp_log_level ="info"; + rrc_log_level ="info"; + ngap_log_level ="debug"; + f1ap_log_level ="debug"; +}; + diff --git a/targets/PROJECTS/GENERIC-NR-5GC/CONF/gnb.sa.band66.fr1.25PRB.usrpx300.conf b/targets/PROJECTS/GENERIC-NR-5GC/CONF/gnb.sa.band66.fr1.25PRB.usrpx300.conf new file mode 100644 index 0000000000..dbeb20c23f --- /dev/null +++ b/targets/PROJECTS/GENERIC-NR-5GC/CONF/gnb.sa.band66.fr1.25PRB.usrpx300.conf @@ -0,0 +1,300 @@ +Active_gNBs = ( "5G-GOA-gNB"); +# Asn1_verbosity, choice in: none, info, annoying +Asn1_verbosity = "none"; + +gNBs = +( + { + ////////// Identification parameters: + gNB_ID = 0xe00; + gNB_name = "5G-GOA-gNB"; + + // Tracking area code, 0x0000 and 0xfffe are reserved values + tracking_area_code = 1; + plmn_list = ({ + mcc = 208; + mnc = 99; + mnc_length = 2; + snssaiList = ( + { + sst = 1; + sd = 0x1; // 0 false, else true + }, + { + sst = 1; + sd = 0x112233; // 0 false, else true + } + ); + + }); + + nr_cellid = 12345678L; + + ////////// Physical parameters: + + sib1_tda = 5; + min_rxtxtime = 6; + + pdcch_ConfigSIB1 = ( + { + controlResourceSetZero = 2; + searchSpaceZero = 0; + } + ); + + servingCellConfigCommon = ( + { + #spCellConfigCommon + + physCellId = 0; + +# downlinkConfigCommon + #frequencyInfoDL + # this is 2150 MHz + 14 PRBs@15kHz SCS (same as initial BWP), points to Subcarrier 0 of RB#10 of SSB block + absoluteFrequencySSB = 430504; + dl_frequencyBand = 66; + # this is 2150 MHz + dl_absoluteFrequencyPointA = 430000; + #scs-SpecificCarrierList + dl_offstToCarrier = 0; +# subcarrierSpacing +# 0=kHz15, 1=kHz30, 2=kHz60, 3=kHz120 + dl_subcarrierSpacing = 0; + dl_carrierBandwidth = 25; + #initialDownlinkBWP + #genericParameters + # this is RBstart=0,L=25 (275*(L-1))+RBstart + initialDLBWPlocationAndBandwidth = 6600; +# subcarrierSpacing +# 0=kHz15, 1=kHz30, 2=kHz60, 3=kHz120 + initialDLBWPsubcarrierSpacing = 0; + #pdcch-ConfigCommon + initialDLBWPcontrolResourceSetZero = 2; + initialDLBWPsearchSpaceZero = 0; + + #uplinkConfigCommon + #frequencyInfoUL + ul_frequencyBand = 66; + # this is 1750 MHz + ul_absoluteFrequencyPointA = 350000; + #scs-SpecificCarrierList + ul_offstToCarrier = 0; +# subcarrierSpacing +# 0=kHz15, 1=kHz30, 2=kHz60, 3=kHz120 + ul_subcarrierSpacing = 0; + ul_carrierBandwidth = 25; + pMax = 20; + #initialUplinkBWP + #genericParameters + initialULBWPlocationAndBandwidth = 6600; +# subcarrierSpacing +# 0=kHz15, 1=kHz30, 2=kHz60, 3=kHz120 + initialULBWPsubcarrierSpacing = 0; + #rach-ConfigCommon + #rach-ConfigGeneric + prach_ConfigurationIndex = 98; +#prach_msg1_FDM +#0 = one, 1=two, 2=four, 3=eight + prach_msg1_FDM = 0; + prach_msg1_FrequencyStart = 0; + zeroCorrelationZoneConfig = 13; + preambleReceivedTargetPower = -118; +#preamblTransMax (0...10) = (3,4,5,6,7,8,10,20,50,100,200) + preambleTransMax = 6; +#powerRampingStep +# 0=dB0,1=dB2,2=dB4,3=dB6 + powerRampingStep = 1; +#ra_ReponseWindow +#1,2,4,8,10,20,40,80 + ra_ResponseWindow = 4; +#ssb_perRACH_OccasionAndCB_PreamblesPerSSB_PR +#1=oneeighth,2=onefourth,3=half,4=one,5=two,6=four,7=eight,8=sixteen + ssb_perRACH_OccasionAndCB_PreamblesPerSSB_PR = 4; +#oneHalf (0..15) 4,8,12,16,...60,64 + ssb_perRACH_OccasionAndCB_PreamblesPerSSB = 15; +#ra_ContentionResolutionTimer +#(0..7) 8,16,24,32,40,48,56,64 + ra_ContentionResolutionTimer = 7; + rsrp_ThresholdSSB = 19; +#prach-RootSequenceIndex_PR +#1 = 839, 2 = 139 + prach_RootSequenceIndex_PR = 2; + prach_RootSequenceIndex = 1; + # SCS for msg1, can only be 15 for 30 kHz < 6 GHz, takes precendence over the one derived from prach-ConfigIndex + # + msg1_SubcarrierSpacing = 0; +# restrictedSetConfig +# 0=unrestricted, 1=restricted type A, 2=restricted type B + restrictedSetConfig = 0; + + msg3_DeltaPreamble = 1; + p0_NominalWithGrant =-90; + +# pucch-ConfigCommon setup : +# pucchGroupHopping +# 0 = neither, 1= group hopping, 2=sequence hopping + pucchGroupHopping = 0; + hoppingId = 40; + p0_nominal = -90; +# ssb_PositionsInBurs_BitmapPR +# 1=short, 2=medium, 3=long + ssb_PositionsInBurst_PR = 2; + ssb_PositionsInBurst_Bitmap = 1; + +# ssb_periodicityServingCell +# 0 = ms5, 1=ms10, 2=ms20, 3=ms40, 4=ms80, 5=ms160, 6=spare2, 7=spare1 + ssb_periodicityServingCell = 2; + +# dmrs_TypeA_position +# 0 = pos2, 1 = pos3 + dmrs_TypeA_Position = 0; + +# subcarrierSpacing +# 0=kHz15, 1=kHz30, 2=kHz60, 3=kHz120 + subcarrierSpacing = 0; + + + #tdd-UL-DL-ConfigurationCommon +# subcarrierSpacing +# 0=kHz15, 1=kHz30, 2=kHz60, 3=kHz120 + referenceSubcarrierSpacing = 0; + # pattern1 + # dl_UL_TransmissionPeriodicity + # 0=ms0p5, 1=ms0p625, 2=ms1, 3=ms1p25, 4=ms2, 5=ms2p5, 6=ms5, 7=ms10 + dl_UL_TransmissionPeriodicity = 6; + nrofDownlinkSlots = 7; + nrofDownlinkSymbols = 6; + nrofUplinkSlots = 2; + nrofUplinkSymbols = 4; + + ssPBCH_BlockPower = -25; + } + + ); + + + # ------- SCTP definitions + SCTP : + { + # Number of streams to use in input/output + SCTP_INSTREAMS = 2; + SCTP_OUTSTREAMS = 2; + }; + + + ////////// AMF parameters: + amf_ip_address = ( { ipv4 = "192.168.71.132"; + ipv6 = "192:168:30::17"; + active = "yes"; + preference = "ipv4"; + } + ); + + NETWORK_INTERFACES : + { + GNB_INTERFACE_NAME_FOR_NG_AMF = "eno1"; + GNB_IPV4_ADDRESS_FOR_NG_AMF = "192.168.71.129/26"; + GNB_INTERFACE_NAME_FOR_NGU = "eno1"; + GNB_IPV4_ADDRESS_FOR_NGU = "192.168.71.129/26"; + GNB_PORT_FOR_S1U = 2152; # Spec 2152 + }; + + } +); + +MACRLCs = ( +{ + num_cc = 1; + tr_s_preference = "local_L1"; + tr_n_preference = "local_RRC"; + pusch_TargetSNRx10 = 150; + pucch_TargetSNRx10 = 200; + ulsch_max_frame_inactivity = 0; +} +); + +L1s = ( +{ + num_cc = 1; + tr_n_preference = "local_mac"; + prach_dtx_threshold = 120; + pucch0_dtx_threshold = 150; + ofdm_offset_divisor = 8; #set this to UINT_MAX for offset 0 +} +); + +RUs = ( + { + local_rf = "yes"; + nb_tx = 1; + nb_rx = 1; + att_tx = 0; + att_rx = 0; + bands = [7]; + max_pdschReferenceSignalPower = -27; + max_rxgain = 114; + sf_extension = 0; + eNB_instances = [0]; + ##beamforming 1x2 matrix: 1 layer x 2 antennas + bf_weights = [0x00007fff, 0x0000]; + ##beamforming 1x4 matrix: 1 layer x 4 antennas + #bf_weights = [0x00007fff, 0x0000,0x0000, 0x0000]; + ## beamforming 2x2 matrix: + # bf_weights = [0x00007fff, 0x00000000, 0x00000000, 0x00007fff]; + ## beamforming 4x4 matrix: + #bf_weights = [0x00007fff, 0x0000, 0x0000, 0x0000, 0x00000000, 0x00007fff, 0x0000, 0x0000, 0x0000, 0x0000, 0x00007fff, 0x0000, 0x0000, 0x0000, 0x0000, 0x00007fff]; + sdr_addrs = "type=x300"; + clock_src = "internal"; + # if_freq = 3700000000L; + # if_offset = 1000000; + } +); + +THREAD_STRUCT = ( + { + #three config for level of parallelism "PARALLEL_SINGLE_THREAD", "PARALLEL_RU_L1_SPLIT", or "PARALLEL_RU_L1_TRX_SPLIT" + parallel_config = "PARALLEL_RU_L1_TRX_SPLIT"; + #two option for worker "WORKER_DISABLE" or "WORKER_ENABLE" + worker_config = "WORKER_DISABLE"; + } +); + +rfsimulator : +{ + serveraddr = "server"; + serverport = "4043"; + options = (); #("saviq"); or/and "chanmod" + modelname = "AWGN"; + IQfile = "/tmp/rfsimulator.iqs"; +}; + +security = { + # preferred ciphering algorithms + # the first one of the list that an UE supports in chosen + # valid values: nea0, nea1, nea2, nea3 + ciphering_algorithms = ( "nea0" ); + + # preferred integrity algorithms + # the first one of the list that an UE supports in chosen + # valid values: nia0, nia1, nia2, nia3 + integrity_algorithms = ( "nia2", "nia0" ); + + # setting 'drb_ciphering' to "no" disables ciphering for DRBs, no matter + # what 'ciphering_algorithms' configures; same thing for 'drb_integrity' + drb_ciphering = "yes"; + drb_integrity = "no"; +}; + +log_config : +{ + global_log_level ="info"; + hw_log_level ="info"; + phy_log_level ="info"; + mac_log_level ="info"; + rlc_log_level ="info"; + pdcp_log_level ="info"; + rrc_log_level ="info"; + ngap_log_level ="debug"; + f1ap_log_level ="debug"; +}; + From 71298305555a531b9ddd823a028e799a72b1d5ea Mon Sep 17 00:00:00 2001 From: Thomas Schlichter Date: Thu, 4 Aug 2022 16:28:08 +0200 Subject: [PATCH 23/88] fix Msg2 scheduling scheduling when frame number wraps was not handled correctly --- openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_RA.c | 21 ++++++++++--------- 1 file changed, 11 insertions(+), 10 deletions(-) diff --git a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_RA.c b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_RA.c index 745fc1ae2b..2a630251e1 100644 --- a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_RA.c +++ b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_RA.c @@ -458,18 +458,18 @@ void nr_schedule_msg2(uint16_t rach_frame, uint16_t rach_slot, // slot and frame limit to transmit msg2 according to response window uint8_t slot_limit = (rach_slot + slot_window)%nr_slots_per_frame[mu]; - uint16_t frame_limit = (slot_limit>(rach_slot))? rach_frame : (rach_frame +1); + uint16_t frame_limit = rach_frame + (rach_slot + slot_window)/nr_slots_per_frame[mu]; // computing start of next period - - int FR = *scc->downlinkConfigCommon->frequencyInfoDL->frequencyBandList.list.array[0] >= 257 ? nr_FR2 : nr_FR1; - uint8_t start_next_period = rach_slot-(rach_slot%tdd_period_slot)+tdd_period_slot; int eff_slot = start_next_period + last_dl_slot_period; // initializing scheduling of slot to next mixed (or last dl) slot + // we can't schedule msg2 before sl_ahead since prach while ((eff_slot-rach_slot)<=sl_ahead) { eff_slot += tdd_period_slot; } + + int FR = *scc->downlinkConfigCommon->frequencyInfoDL->frequencyBandList.list.array[0] >= 257 ? nr_FR2 : nr_FR1; if (FR==nr_FR2) { int num_tdd_period = (eff_slot%nr_slots_per_frame[mu])/tdd_period_slot; while((tdd_beam_association[num_tdd_period]!=-1)&&(tdd_beam_association[num_tdd_period]!=beam_index)) { @@ -480,8 +480,9 @@ void nr_schedule_msg2(uint16_t rach_frame, uint16_t rach_slot, tdd_beam_association[num_tdd_period] = beam_index; } - *msg2_frame=(rach_frame + eff_slot/nr_slots_per_frame[mu])%1024; - *msg2_slot=eff_slot%nr_slots_per_frame[mu]; + *msg2_frame = rach_frame + eff_slot / nr_slots_per_frame[mu]; + *msg2_slot = eff_slot % nr_slots_per_frame[mu]; + // go to previous slot if the current scheduled slot is beyond the response window // and if the slot is not among the PDCCH monitored ones (38.213 10.1) while (*msg2_frame > frame_limit @@ -490,10 +491,7 @@ void nr_schedule_msg2(uint16_t rach_frame, uint16_t rach_slot, if((frame_type == FDD) || ((*msg2_slot%tdd_period_slot) > 0)) { if (*msg2_slot==0) { - if(*msg2_frame != 0) - (*msg2_frame)--; - else - *msg2_frame = 1023; + (*msg2_frame)--; *msg2_slot = nr_slots_per_frame[mu] - 1; } else @@ -502,6 +500,9 @@ void nr_schedule_msg2(uint16_t rach_frame, uint16_t rach_slot, else AssertFatal(1==0,"No available DL slot to schedule msg2 has been found"); } + + // calculate frame number considering wrap-around + *msg2_frame = *msg2_frame % 1024; } From 8f6d084c80f1c11a55b159ba4635b5234fbebb2a Mon Sep 17 00:00:00 2001 From: Thomas Schlichter Date: Thu, 4 Aug 2022 16:31:40 +0200 Subject: [PATCH 24/88] small cleanup in get_type0_PDCCH_CSS_config_parameters() --- openair2/LAYER2/NR_MAC_COMMON/nr_mac_common.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/openair2/LAYER2/NR_MAC_COMMON/nr_mac_common.c b/openair2/LAYER2/NR_MAC_COMMON/nr_mac_common.c index 1855958879..37c8bea4e7 100644 --- a/openair2/LAYER2/NR_MAC_COMMON/nr_mac_common.c +++ b/openair2/LAYER2/NR_MAC_COMMON/nr_mac_common.c @@ -3571,7 +3571,7 @@ void get_type0_PDCCH_CSS_config_parameters(NR_Type0_PDCCH_CSS_config_t *type0_PD // type0-pdcch coreset switch( ((int)scs_ssb << 3) | (int)scs_pdcch ){ - case (NR_SubcarrierSpacing_kHz15 << 5) | NR_SubcarrierSpacing_kHz15: + case (NR_SubcarrierSpacing_kHz15 << 3) | NR_SubcarrierSpacing_kHz15: AssertFatal(index_4msb < 15, "38.213 Table 13-1 4 MSB out of range\n"); type0_PDCCH_CSS_config->type0_pdcch_ss_mux_pattern = 1; type0_PDCCH_CSS_config->num_rbs = table_38213_13_1_c2[index_4msb]; From e5fad77f474462ef3ad798fa510478f7b43d9666 Mon Sep 17 00:00:00 2001 From: Thomas Schlichter Date: Fri, 12 Aug 2022 16:43:37 +0200 Subject: [PATCH 25/88] 5G NR DCI improvements --- openair1/PHY/NR_TRANSPORT/nr_dci.c | 4 ++-- openair1/PHY/NR_TRANSPORT/nr_dci_tools.c | 8 ++++---- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/openair1/PHY/NR_TRANSPORT/nr_dci.c b/openair1/PHY/NR_TRANSPORT/nr_dci.c index dc1ed47e0f..c8b5af6ea5 100644 --- a/openair1/PHY/NR_TRANSPORT/nr_dci.c +++ b/openair1/PHY/NR_TRANSPORT/nr_dci.c @@ -198,10 +198,10 @@ void nr_generate_dci(PHY_VARS_gNB *gNB, int8_t cce_idx = reg_list_order[cce_count]; - for (int reg_in_cce_idx = 0; reg_in_cce_idx < NR_NB_REG_PER_CCE; reg_in_cce_idx+=pdcch_pdu_rel15->DurationSymbols) { + for (int reg_in_cce_idx = symbol_idx; reg_in_cce_idx < NR_NB_REG_PER_CCE; reg_in_cce_idx+=pdcch_pdu_rel15->DurationSymbols) { k = cset_start_sc + cce_list[d][cce_idx].reg_list[reg_in_cce_idx].start_sc_idx; - LOG_D(PHY,"CCE %d REG %d k %d\n",cce_idx,reg_in_cce_idx+symbol_idx,k); + LOG_D(PHY,"CCE %d REG %d k %d\n",cce_idx,reg_in_cce_idx,k); if (k >= frame_parms->ofdm_symbol_size) k -= frame_parms->ofdm_symbol_size; diff --git a/openair1/PHY/NR_TRANSPORT/nr_dci_tools.c b/openair1/PHY/NR_TRANSPORT/nr_dci_tools.c index e9d3010ce7..3d166fd87d 100644 --- a/openair1/PHY/NR_TRANSPORT/nr_dci_tools.c +++ b/openair1/PHY/NR_TRANSPORT/nr_dci_tools.c @@ -80,15 +80,15 @@ void nr_fill_cce_list(nr_cce_t cce_list[MAX_DCI_CORESET][NR_MAX_PDCCH_AGG_LEVEL] LOG_D(PHY, "cce_idx %d\n", cce->cce_idx); uint8_t j = cce->cce_idx; - for (int k=6*j/bsize; k<(6*j/bsize+6/bsize); k++) { // loop over REG bundles - + for (uint8_t bundle_idx=0; bundle_idxreg_list[reg_idx]; + reg = &cce->reg_list[bundle_idx*bsize+reg_idx]; reg->reg_idx = bsize*f + reg_idx; reg->start_sc_idx = (reg->reg_idx/dur) * NR_NB_SC_PER_RB; - reg->symb_idx = reg_idx%dur; + reg->symb_idx = reg->reg_idx%dur; LOG_D(PHY, "reg %d symbol %d start subcarrier %d\n", reg->reg_idx, reg->symb_idx, reg->start_sc_idx); } } From 11693b16726316ec69bb6157d710d5974943ef7b Mon Sep 17 00:00:00 2001 From: Thomas Schlichter Date: Fri, 12 Aug 2022 16:44:59 +0200 Subject: [PATCH 26/88] 5G NR: remove hardcoded modulation order --- openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_RA.c | 3 ++- openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_bch.c | 9 +++------ 2 files changed, 5 insertions(+), 7 deletions(-) diff --git a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_RA.c b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_RA.c index 2a630251e1..1676d32938 100644 --- a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_RA.c +++ b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_RA.c @@ -1675,7 +1675,8 @@ void nr_generate_Msg4(module_id_t module_idP, int CC_id, frame_t frameP, sub_fra pdsch_pdu_rel15->NrOfCodewords = 1; int R = nr_get_code_rate_dl(mcsIndex,mcsTableIdx); pdsch_pdu_rel15->targetCodeRate[0] = R; - pdsch_pdu_rel15->qamModOrder[0] = 2; + int Qm = nr_get_Qm_dl(mcsIndex, mcsTableIdx); + pdsch_pdu_rel15->qamModOrder[0] = Qm; pdsch_pdu_rel15->mcsIndex[0] = mcsIndex; pdsch_pdu_rel15->mcsTable[0] = mcsTableIdx; pdsch_pdu_rel15->rvIndex[0] = nr_rv_round_map[harq->round%4]; diff --git a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_bch.c b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_bch.c index 90d0af946a..4739213b25 100644 --- a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_bch.c +++ b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_bch.c @@ -433,10 +433,10 @@ void nr_fill_nfapi_dl_sib1_pdu(int Mod_idP, pdsch_pdu_rel15->CyclicPrefix = 0; pdsch_pdu_rel15->NrOfCodewords = 1; - pdsch_pdu_rel15->targetCodeRate[0] = nr_get_code_rate_dl(gNB_mac->sched_ctrlCommon->sched_pdsch.mcs, 0); - pdsch_pdu_rel15->qamModOrder[0] = 2; + pdsch_pdu_rel15->targetCodeRate[0] = nr_get_code_rate_dl(gNB_mac->sched_ctrlCommon->sched_pdsch.mcs, mcsTableIdx); + pdsch_pdu_rel15->qamModOrder[0] = nr_get_Qm_dl(gNB_mac->sched_ctrlCommon->sched_pdsch.mcs, mcsTableIdx); pdsch_pdu_rel15->mcsIndex[0] = gNB_mac->sched_ctrlCommon->sched_pdsch.mcs; - pdsch_pdu_rel15->mcsTable[0] = 0; + pdsch_pdu_rel15->mcsTable[0] = mcsTableIdx; pdsch_pdu_rel15->rvIndex[0] = 0; pdsch_pdu_rel15->dataScramblingId = *scc->physCellId; pdsch_pdu_rel15->nrOfLayers = 1; @@ -451,10 +451,7 @@ void nr_fill_nfapi_dl_sib1_pdu(int Mod_idP, pdsch_pdu_rel15->rbStart = gNB_mac->sched_ctrlCommon->sched_pdsch.rbStart; pdsch_pdu_rel15->rbSize = gNB_mac->sched_ctrlCommon->sched_pdsch.rbSize; pdsch_pdu_rel15->VRBtoPRBMapping = 0; - pdsch_pdu_rel15->qamModOrder[0] = nr_get_Qm_dl(gNB_mac->sched_ctrlCommon->sched_pdsch.mcs, - mcsTableIdx); pdsch_pdu_rel15->TBSize[0] = TBS; - pdsch_pdu_rel15->mcsTable[0] = mcsTableIdx; pdsch_pdu_rel15->StartSymbolIndex = StartSymbolIndex; pdsch_pdu_rel15->NrOfSymbols = NrOfSymbols; pdsch_pdu_rel15->dlDmrsSymbPos = dlDmrsSymbPos; From 54ed3eb4fabc13a6725602366d74dfe3619482e3 Mon Sep 17 00:00:00 2001 From: francescomani Date: Mon, 29 Aug 2022 08:22:09 +0200 Subject: [PATCH 27/88] test NSA --- openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_ulsch.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_ulsch.c b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_ulsch.c index a10594ce77..261fe7dea9 100644 --- a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_ulsch.c +++ b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_ulsch.c @@ -255,7 +255,7 @@ int nr_process_mac_pdu(instance_t module_idP, deltaMCS); /* 38.133 Table10.1.18.1-1 */ sched_ctrl->pcmax = PCMAX - 29; - LOG_D(NR_MAC, "SINGLE ENTRY PHR R1 %d PH %d (%d dB) R2 %d PCMAX %d (%d dBm)\n", + LOG_I(NR_MAC, "SINGLE ENTRY PHR R1 %d PH %d (%d dB) R2 %d PCMAX %d (%d dBm)\n", phr->R1, PH, sched_ctrl->ph, phr->R2, PCMAX, sched_ctrl->pcmax); break; @@ -1357,7 +1357,9 @@ void pf_ul(module_id_t module_id, const int B = cmax(sched_ctrl->estimated_ul_buffer - sched_ctrl->sched_ul_bytes, 0); /* adjust rbSize and MCS according to PHR and BPRE */ sched_pusch->mu = scc->uplinkConfigCommon->initialUplinkBWP->genericParameters.subcarrierSpacing; - nr_ue_max_mcs_min_rb(sched_pusch->mu, sched_ctrl->ph, ps, current_BWP, min_rbSize, B, &max_rbSize, &sched_pusch->mcs); + if(sched_ctrl->pcmax!=0 || + sched_ctrl->ph!=0) // verify if the PHR related parameter have been initialized + nr_ue_max_mcs_min_rb(sched_pusch->mu, sched_ctrl->ph, ps, current_BWP, min_rbSize, B, &max_rbSize, &sched_pusch->mcs); if (sched_pusch->mcs < sched_ctrl->ul_bler_stats.mcs) sched_ctrl->ul_bler_stats.mcs = sched_pusch->mcs; /* force estimated MCS down */ From 8e56e14df5cac72c3cd6d7a4472817b3608f0fcb Mon Sep 17 00:00:00 2001 From: francescomani Date: Mon, 29 Aug 2022 16:25:09 +0200 Subject: [PATCH 28/88] phr config harmonization --- openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_ulsch.c | 2 +- openair2/RRC/NR/MESSAGES/asn1_msg.c | 7 +------ openair2/RRC/NR/nr_rrc_config.c | 10 ++++++++++ openair2/RRC/NR/nr_rrc_config.h | 1 + openair2/RRC/NR/rrc_gNB_reconfig.c | 11 +---------- 5 files changed, 14 insertions(+), 17 deletions(-) diff --git a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_ulsch.c b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_ulsch.c index 261fe7dea9..e3e08af014 100644 --- a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_ulsch.c +++ b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_ulsch.c @@ -255,7 +255,7 @@ int nr_process_mac_pdu(instance_t module_idP, deltaMCS); /* 38.133 Table10.1.18.1-1 */ sched_ctrl->pcmax = PCMAX - 29; - LOG_I(NR_MAC, "SINGLE ENTRY PHR R1 %d PH %d (%d dB) R2 %d PCMAX %d (%d dBm)\n", + LOG_D(NR_MAC, "SINGLE ENTRY PHR R1 %d PH %d (%d dB) R2 %d PCMAX %d (%d dBm)\n", phr->R1, PH, sched_ctrl->ph, phr->R2, PCMAX, sched_ctrl->pcmax); break; diff --git a/openair2/RRC/NR/MESSAGES/asn1_msg.c b/openair2/RRC/NR/MESSAGES/asn1_msg.c index 6aaa96a8e7..6156eb8dc3 100755 --- a/openair2/RRC/NR/MESSAGES/asn1_msg.c +++ b/openair2/RRC/NR/MESSAGES/asn1_msg.c @@ -1943,12 +1943,7 @@ void fill_initial_cellGroupConfig(int uid, tag->tag_Id = 0; tag->timeAlignmentTimer = NR_TimeAlignmentTimer_infinity; ASN_SEQUENCE_ADD(&mac_CellGroupConfig->tag_Config->tag_ToAddModList->list,tag); - mac_CellGroupConfig->phr_Config = calloc(1, sizeof(*mac_CellGroupConfig->phr_Config)); - mac_CellGroupConfig->phr_Config->present = NR_SetupRelease_PHR_Config_PR_setup; - mac_CellGroupConfig->phr_Config->choice.setup = calloc(1, sizeof(*mac_CellGroupConfig->phr_Config->choice.setup)); - mac_CellGroupConfig->phr_Config->choice.setup->phr_PeriodicTimer = NR_PHR_Config__phr_PeriodicTimer_sf10; - mac_CellGroupConfig->phr_Config->choice.setup->phr_ProhibitTimer = NR_PHR_Config__phr_ProhibitTimer_sf10; - mac_CellGroupConfig->phr_Config->choice.setup->phr_Tx_PowerFactorChange = NR_PHR_Config__phr_Tx_PowerFactorChange_dB1; + set_phr_config(mac_CellGroupConfig); mac_CellGroupConfig->schedulingRequestConfig = calloc(1, sizeof(*mac_CellGroupConfig->schedulingRequestConfig)); mac_CellGroupConfig->schedulingRequestConfig->schedulingRequestToAddModList = CALLOC(1,sizeof(*mac_CellGroupConfig->schedulingRequestConfig->schedulingRequestToAddModList)); diff --git a/openair2/RRC/NR/nr_rrc_config.c b/openair2/RRC/NR/nr_rrc_config.c index 5d1e3e97d0..d56cbe3410 100644 --- a/openair2/RRC/NR/nr_rrc_config.c +++ b/openair2/RRC/NR/nr_rrc_config.c @@ -837,3 +837,13 @@ void set_dl_mcs_table(int scs, bwp_Dedicated->pdsch_Config->choice.setup->mcs_Table = NULL; } +void set_phr_config(NR_MAC_CellGroupConfig_t *mac_CellGroupConfig) +{ + mac_CellGroupConfig->phr_Config = calloc(1, sizeof(*mac_CellGroupConfig->phr_Config)); + mac_CellGroupConfig->phr_Config->present = NR_SetupRelease_PHR_Config_PR_setup; + mac_CellGroupConfig->phr_Config->choice.setup = calloc(1, sizeof(*mac_CellGroupConfig->phr_Config->choice.setup)); + mac_CellGroupConfig->phr_Config->choice.setup->phr_PeriodicTimer = NR_PHR_Config__phr_PeriodicTimer_sf10; + mac_CellGroupConfig->phr_Config->choice.setup->phr_ProhibitTimer = NR_PHR_Config__phr_ProhibitTimer_sf10; + mac_CellGroupConfig->phr_Config->choice.setup->phr_Tx_PowerFactorChange = NR_PHR_Config__phr_Tx_PowerFactorChange_dB1; +} + diff --git a/openair2/RRC/NR/nr_rrc_config.h b/openair2/RRC/NR/nr_rrc_config.h index 27aebcf94b..2f114b22a1 100644 --- a/openair2/RRC/NR/nr_rrc_config.h +++ b/openair2/RRC/NR/nr_rrc_config.h @@ -111,6 +111,7 @@ typedef struct physicalcellgroup_s{ long RNTI_Value[MAX_NUM_CCs]; }physicalcellgroup_t; +void set_phr_config(NR_MAC_CellGroupConfig_t *mac_CellGroupConfig); uint64_t get_ssb_bitmap(const NR_ServingCellConfigCommon_t *scc); void rrc_coreset_config(NR_ControlResourceSet_t *coreset, int bwp_id, diff --git a/openair2/RRC/NR/rrc_gNB_reconfig.c b/openair2/RRC/NR/rrc_gNB_reconfig.c index 08baeb3d45..a03e29f254 100644 --- a/openair2/RRC/NR/rrc_gNB_reconfig.c +++ b/openair2/RRC/NR/rrc_gNB_reconfig.c @@ -558,16 +558,7 @@ void fill_default_secondaryCellGroup(NR_ServingCellConfigCommon_t *servingcellco tag->tag_Id = 0; tag->timeAlignmentTimer = NR_TimeAlignmentTimer_infinity; ASN_SEQUENCE_ADD(&mac_CellGroupConfig->tag_Config->tag_ToAddModList->list,tag); - mac_CellGroupConfig->phr_Config = calloc(1,sizeof(*mac_CellGroupConfig->phr_Config)); - mac_CellGroupConfig->phr_Config->present = NR_SetupRelease_PHR_Config_PR_setup; - mac_CellGroupConfig->phr_Config->choice.setup = calloc(1,sizeof(*mac_CellGroupConfig->phr_Config->choice.setup)); - mac_CellGroupConfig->phr_Config->choice.setup->phr_PeriodicTimer = NR_PHR_Config__phr_PeriodicTimer_sf20; - mac_CellGroupConfig->phr_Config->choice.setup->phr_ProhibitTimer = NR_PHR_Config__phr_ProhibitTimer_sf0; - mac_CellGroupConfig->phr_Config->choice.setup->phr_Tx_PowerFactorChange = NR_PHR_Config__phr_Tx_PowerFactorChange_dB3; - mac_CellGroupConfig->phr_Config->choice.setup->multiplePHR=false; - mac_CellGroupConfig->phr_Config->choice.setup->dummy=false; - mac_CellGroupConfig->phr_Config->choice.setup->phr_Type2OtherCell = false; - mac_CellGroupConfig->phr_Config->choice.setup->phr_ModeOtherCG = NR_PHR_Config__phr_ModeOtherCG_real; + set_phr_config(mac_CellGroupConfig); mac_CellGroupConfig->skipUplinkTxDynamic=false; mac_CellGroupConfig->ext1 = NULL; secondaryCellGroup->physicalCellGroupConfig = calloc(1,sizeof(*secondaryCellGroup->physicalCellGroupConfig)); From 1e39dd777d524050a670085e2e6316dce7d2f331 Mon Sep 17 00:00:00 2001 From: francescomani Date: Sat, 13 Aug 2022 15:26:30 +0200 Subject: [PATCH 29/88] fix physical simulators --- openair1/SIMULATION/NR_PHY/dlschsim.c | 79 ++++++++++--------- openair1/SIMULATION/NR_PHY/dlsim.c | 1 + openair1/SIMULATION/NR_PHY/ulschsim.c | 1 + openair1/SIMULATION/NR_PHY/ulsim.c | 3 +- openair2/LAYER2/NR_MAC_COMMON/nr_mac_common.c | 11 ++- openair2/LAYER2/NR_MAC_COMMON/nr_mac_common.h | 2 + .../NR_MAC_gNB/gNB_scheduler_primitives.c | 10 +-- openair2/LAYER2/NR_MAC_gNB/mac_proto.h | 1 - 8 files changed, 57 insertions(+), 51 deletions(-) diff --git a/openair1/SIMULATION/NR_PHY/dlschsim.c b/openair1/SIMULATION/NR_PHY/dlschsim.c index 39cd540795..f8f11c83a8 100644 --- a/openair1/SIMULATION/NR_PHY/dlschsim.c +++ b/openair1/SIMULATION/NR_PHY/dlschsim.c @@ -75,45 +75,45 @@ void init_downlink_harq_status(NR_DL_UE_HARQ_t *dl_harq) {} int main(int argc, char **argv) { - char c; - int i; //,j,l,aa; - double SNR, SNR_lin, snr0 = -2.0, snr1 = 2.0; - double snr_step = 0.1; - uint8_t snr1set = 0; - int **txdata; - double **s_re, **s_im, **r_re, **r_im; - // int sync_pos, sync_pos_slot; - // FILE *rx_frame_file; - FILE *output_fd = NULL; - //uint8_t write_output_file = 0; - // int subframe_offset; - // char fname[40], vname[40]; - int trial, n_trials = 1, n_errors = 0, n_false_positive = 0; - uint8_t n_tx = 1, n_rx = 1; - //uint8_t transmission_mode = 1; - uint16_t Nid_cell = 0; - channel_desc_t *gNB2UE; - uint8_t extended_prefix_flag = 0; - //int8_t interf1 = -21, interf2 = -21; - FILE *input_fd = NULL, *pbch_file_fd = NULL; - //char input_val_str[50],input_val_str2[50]; - //uint16_t NB_RB=25; - SCM_t channel_model = AWGN; //Rayleigh1_anticorr; - uint16_t N_RB_DL = 106, mu = 1; - //unsigned char frame_type = 0; - unsigned char pbch_phase = 0; - int frame = 0, slot = 0; - int frame_length_complex_samples; - //int frame_length_complex_samples_no_prefix; - NR_DL_FRAME_PARMS *frame_parms; - uint8_t Kmimo = 0; - uint32_t Nsoft = 0; - double sigma; - unsigned char qbits = 8; - int ret; - //int run_initial_sync=0; - int loglvl = OAILOG_WARNING; - uint8_t dlsch_threads = 0; + char c; + int i; //,j,l,aa; + double SNR, SNR_lin, snr0 = -2.0, snr1 = 2.0; + double snr_step = 0.1; + uint8_t snr1set = 0; + int **txdata; + double **s_re, **s_im, **r_re, **r_im; + // int sync_pos, sync_pos_slot; + // FILE *rx_frame_file; + FILE *output_fd = NULL; + //uint8_t write_output_file = 0; + // int subframe_offset; + // char fname[40], vname[40]; + int trial, n_trials = 1, n_errors = 0, n_false_positive = 0; + uint8_t n_tx = 1, n_rx = 1; + //uint8_t transmission_mode = 1; + uint16_t Nid_cell = 0; + channel_desc_t *gNB2UE; + uint8_t extended_prefix_flag = 0; + //int8_t interf1 = -21, interf2 = -21; + FILE *input_fd = NULL, *pbch_file_fd = NULL; + //char input_val_str[50],input_val_str2[50]; + //uint16_t NB_RB=25; + SCM_t channel_model = AWGN; //Rayleigh1_anticorr; + uint16_t N_RB_DL = 106, mu = 1; + //unsigned char frame_type = 0; + unsigned char pbch_phase = 0; + int frame = 0, slot = 0; + int frame_length_complex_samples; + //int frame_length_complex_samples_no_prefix; + NR_DL_FRAME_PARMS *frame_parms; + uint8_t Kmimo = 0; + uint32_t Nsoft = 0; + double sigma; + unsigned char qbits = 8; + int ret; + //int run_initial_sync=0; + int loglvl = OAILOG_WARNING; + uint8_t dlsch_threads = 0; float target_error_rate = 0.01; uint64_t SSB_positions=0x01; uint16_t nb_symb_sch = 12; @@ -460,6 +460,7 @@ int main(int argc, char **argv) rel15->mcsIndex[0] = Imcs; rel15->numDmrsCdmGrpsNoData = 1; rel15->maintenance_parms_v3.tbSizeLbrmBytes = Tbslbrm; + rel15->maintenance_parms_v3.ldpcBaseGraph = get_BG(TBS, rate); double modulated_input[16 * 68 * 384]; // [hna] 16 segments, 68*Zc short channel_output_fixed[16 * 68 * 384]; //unsigned char *estimated_output; diff --git a/openair1/SIMULATION/NR_PHY/dlsim.c b/openair1/SIMULATION/NR_PHY/dlsim.c index 3ff3fe66cd..4d1aa9ef0d 100644 --- a/openair1/SIMULATION/NR_PHY/dlsim.c +++ b/openair1/SIMULATION/NR_PHY/dlsim.c @@ -318,6 +318,7 @@ void nr_dlsim_preprocessor(module_id_t module_id, sched_pdsch->rbStart = g_rbStart; sched_pdsch->rbSize = g_rbSize; sched_pdsch->mcs = g_mcsIndex; + sched_pdsch->nrOfLayers = g_nrOfLayers; /* the following might override the table that is mandated by RRC * configuration */ current_BWP->mcsTableIdx = g_mcsTableIdx; diff --git a/openair1/SIMULATION/NR_PHY/ulschsim.c b/openair1/SIMULATION/NR_PHY/ulschsim.c index 5392424285..e661d9a969 100644 --- a/openair1/SIMULATION/NR_PHY/ulschsim.c +++ b/openair1/SIMULATION/NR_PHY/ulschsim.c @@ -466,6 +466,7 @@ int main(int argc, char **argv) rel15_ul->nrOfLayers = Nl; rel15_ul->target_code_rate = code_rate; rel15_ul->pusch_data.tb_size = TBS>>3; + rel15_ul->maintenance_parms_v3.ldpcBaseGraph = get_BG(TBS, code_rate); /////////////////////////////////////////////////// double modulated_input[16 * 68 * 384]; // [hna] 16 segments, 68*Zc diff --git a/openair1/SIMULATION/NR_PHY/ulsim.c b/openair1/SIMULATION/NR_PHY/ulsim.c index 3ac1ec3439..1dcb045d16 100644 --- a/openair1/SIMULATION/NR_PHY/ulsim.c +++ b/openair1/SIMULATION/NR_PHY/ulsim.c @@ -1126,7 +1126,7 @@ int main(int argc, char **argv) pusch_pdu->bwp_size = abwp_size; } - pusch_pdu->pusch_data.tb_size = TBS/8; + pusch_pdu->pusch_data.tb_size = TBS>>3; pusch_pdu->pdu_bit_map = pdu_bit_map; pusch_pdu->rnti = n_rnti; pusch_pdu->mcs_index = Imcs; @@ -1158,6 +1158,7 @@ int main(int argc, char **argv) pusch_pdu->pusch_ptrs.ptrs_freq_density = ptrs_freq_density; pusch_pdu->pusch_ptrs.ptrs_ports_list = (nfapi_nr_ptrs_ports_t *) malloc(2*sizeof(nfapi_nr_ptrs_ports_t)); pusch_pdu->pusch_ptrs.ptrs_ports_list[0].ptrs_re_offset = 0; + pusch_pdu->maintenance_parms_v3.ldpcBaseGraph = get_BG(TBS, code_rate); // if transform precoding is enabled if (transform_precoding == transformPrecoder_enabled) { diff --git a/openair2/LAYER2/NR_MAC_COMMON/nr_mac_common.c b/openair2/LAYER2/NR_MAC_COMMON/nr_mac_common.c index 1855958879..44aad62196 100644 --- a/openair2/LAYER2/NR_MAC_COMMON/nr_mac_common.c +++ b/openair2/LAYER2/NR_MAC_COMMON/nr_mac_common.c @@ -3498,6 +3498,15 @@ void csi_period_offset(NR_CSI_ReportConfig_t *csirep, } } +uint8_t get_BG(uint32_t A, uint16_t R) { + + float code_rate = (float) R / 10240.0f; + if ((A <=292) || ((A<=3824) && (code_rate <= 0.6667)) || code_rate <= 0.25) + return 2; + else + return 1; +} + uint32_t get_Y(NR_SearchSpace_t *ss, int slot, rnti_t rnti) { if(ss->searchSpaceType->present == NR_SearchSpace__searchSpaceType_PR_common) @@ -4738,4 +4747,4 @@ uint16_t nr_get_csi_bitlen(nr_csi_report_t *csi_report_template, uint8_t csi_rep } return csi_bitlen; -} \ No newline at end of file +} diff --git a/openair2/LAYER2/NR_MAC_COMMON/nr_mac_common.h b/openair2/LAYER2/NR_MAC_COMMON/nr_mac_common.h index 3b76faeef1..5450adf7f0 100644 --- a/openair2/LAYER2/NR_MAC_COMMON/nr_mac_common.h +++ b/openair2/LAYER2/NR_MAC_COMMON/nr_mac_common.h @@ -39,6 +39,8 @@ uint32_t get_Y(NR_SearchSpace_t *ss, int slot, rnti_t rnti); +uint8_t get_BG(uint32_t A, uint16_t R); + uint64_t from_nrarfcn(int nr_bandP, uint8_t scs_index, uint32_t dl_nrarfcn); uint32_t to_nrarfcn(int nr_bandP, uint64_t dl_CarrierFreq, uint8_t scs_index, uint32_t bw); diff --git a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_primitives.c b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_primitives.c index 4adfa5cf65..293ed72b12 100644 --- a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_primitives.c +++ b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_primitives.c @@ -212,6 +212,7 @@ uint8_t get_mcs_from_cqi(int mcs_table, int cqi_table, int cqi_idx) return 9; } + void set_dl_dmrs_ports(NR_pdsch_semi_static_t *ps) { //TODO first basic implementation of dmrs port selection @@ -248,15 +249,6 @@ void set_dl_dmrs_ports(NR_pdsch_semi_static_t *ps) { } } -uint8_t get_BG(uint32_t A, uint16_t R) { - - float code_rate = (float) R / 10240.0f; - if ((A <=292) || ((A<=3824) && (code_rate <= 0.6667)) || code_rate <= 0.25) - return 2; - else - return 1; -} - NR_ControlResourceSet_t *get_coreset(gNB_MAC_INST *nrmac, NR_ServingCellConfigCommon_t *scc, void *bwp, diff --git a/openair2/LAYER2/NR_MAC_gNB/mac_proto.h b/openair2/LAYER2/NR_MAC_gNB/mac_proto.h index b51d72b409..6a3f778af9 100644 --- a/openair2/LAYER2/NR_MAC_gNB/mac_proto.h +++ b/openair2/LAYER2/NR_MAC_gNB/mac_proto.h @@ -469,7 +469,6 @@ uint16_t set_pm_index(NR_UE_sched_ctrl_t *sched_ctrl, int codebook_mode); uint8_t get_mcs_from_cqi(int mcs_table, int cqi_table, int cqi_idx); -uint8_t get_BG(uint32_t A, uint16_t R); uint8_t set_dl_nrOfLayers(NR_UE_sched_ctrl_t *sched_ctrl); const int get_dl_tda(const gNB_MAC_INST *nrmac, const NR_ServingCellConfigCommon_t *scc, int slot); From 18500674df2b9694f3d1e3b47046378b35124aad Mon Sep 17 00:00:00 2001 From: Thomas Schlichter Date: Fri, 12 Aug 2022 16:46:08 +0200 Subject: [PATCH 30/88] improve nr_dlsch_decoding --- .../PHY/NR_UE_TRANSPORT/nr_dlsch_decoding.c | 33 ++++++++----------- 1 file changed, 14 insertions(+), 19 deletions(-) diff --git a/openair1/PHY/NR_UE_TRANSPORT/nr_dlsch_decoding.c b/openair1/PHY/NR_UE_TRANSPORT/nr_dlsch_decoding.c index e6833c4cb4..4f22712335 100644 --- a/openair1/PHY/NR_UE_TRANSPORT/nr_dlsch_decoding.c +++ b/openair1/PHY/NR_UE_TRANSPORT/nr_dlsch_decoding.c @@ -259,7 +259,6 @@ void nr_processDLSegment(void* arg) { int length_dec; int no_iteration_ldpc; int Kr; - int Kr_bytes; int K_bits_F; uint8_t crc_type; int i; @@ -282,8 +281,7 @@ void nr_processDLSegment(void* arg) { __m128i *pv = (__m128i*)&z; __m128i *pl = (__m128i*)&l; - Kr = harq_process->K; // [hna] overwrites this line "Kr = p_decParams->Z*kb" - Kr_bytes = Kr>>3; + Kr = harq_process->K; K_bits_F = Kr-harq_process->F; t_nrLDPC_time_stats procTime = {0}; @@ -293,8 +291,7 @@ void nr_processDLSegment(void* arg) { start_meas(&rdata->ts_deinterleave); //VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_DLSCH_DEINTERLEAVING, VCD_FUNCTION_IN); - int16_t w[E]; - memset(w, 0, sizeof(w)); + int16_t w[E]; nr_deinterleaving_ldpc(E, Qm, w, // [hna] w is e @@ -321,7 +318,7 @@ void nr_processDLSegment(void* arg) { w, harq_process->C, harq_process->rvidx, - (harq_process->first_rx==1)?1:0, + harq_process->first_rx, E, harq_process->F, Kr-harq_process->F-2*(p_decoderParms->Z))==-1) { @@ -333,8 +330,6 @@ void nr_processDLSegment(void* arg) { } stop_meas(&rdata->ts_rate_unmatch); - r_offset += E; - if (LOG_DEBUGFLAG(DEBUG_DLSCH_DECOD)) { LOG_D(PHY,"decoder input(segment %u) :",r); @@ -344,8 +339,6 @@ void nr_processDLSegment(void* arg) { LOG_D(PHY,"\n"); } - memset(harq_process->c[r],0,Kr_bytes); - if (harq_process->C == 1) { if (A > NR_MAX_PDSCH_TBS) crc_type = CRC24_A; @@ -383,21 +376,23 @@ void nr_processDLSegment(void* arg) { &procTime); //VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_DLSCH_LDPC, VCD_FUNCTION_OUT); + LOG_D(PHY,"no_iteration_ldpc = %d\n", no_iteration_ldpc); // Fixme: correct type is unsigned, but nrLDPC_decoder and all called behind use signed int if (check_crc((uint8_t *)llrProcBuf,length_dec,harq_process->F,crc_type)) { LOG_D(PHY,"Segment %u CRC OK\n",r); - - if (r==0) { - for (int i=0; i<10; i++) LOG_D(PHY,"byte %d : %x\n",i,((uint8_t *)llrProcBuf)[i]); - } - - //Temporary hack - no_iteration_ldpc = dlsch->max_ldpc_iterations; - rdata->decodeIterations = no_iteration_ldpc; + if (no_iteration_ldpc > dlsch->max_ldpc_iterations) + no_iteration_ldpc = dlsch->max_ldpc_iterations; } else { LOG_D(PHY,"CRC NOT OK\n"); + no_iteration_ldpc = dlsch->max_ldpc_iterations + 1; } + if (r==0) { + for (int i=0; i<10; i++) LOG_D(PHY,"byte %d : %x\n",i,((uint8_t *)llrProcBuf)[i]); + } + + rdata->decodeIterations = no_iteration_ldpc; + nb_total_decod++; if (no_iteration_ldpc > dlsch->max_ldpc_iterations) { @@ -547,7 +542,7 @@ uint32_t nr_dlsch_decoding(PHY_VARS_NR_UE *phy_vars_ue, } if (LOG_DEBUGFLAG(DEBUG_DLSCH_DECOD) && (!frame%100)) - LOG_I(PHY,"K %d C %d Z %d nl %d \n", harq_process->K, harq_process->C, p_decParams->Z, harq_process->Nl); + LOG_I(PHY,"K %d C %d Z %d nl %d \n", harq_process->K, harq_process->C, harq_process->Z, harq_process->Nl); } VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_DLSCH_SEGMENTATION, VCD_FUNCTION_OUT); From f06fc314c689bf4260b634e7e8e70b2d8baaa4e1 Mon Sep 17 00:00:00 2001 From: Abdelrahman Astro Date: Sat, 3 Sep 2022 09:08:48 +0000 Subject: [PATCH 31/88] quick fix for gnb.sa.band41.fr1.106PRB.usrpb210.conf --- .../CONF/gnb.sa.band41.fr1.106PRB.usrpb210.conf | 4 ---- 1 file changed, 4 deletions(-) diff --git a/targets/PROJECTS/GENERIC-NR-5GC/CONF/gnb.sa.band41.fr1.106PRB.usrpb210.conf b/targets/PROJECTS/GENERIC-NR-5GC/CONF/gnb.sa.band41.fr1.106PRB.usrpb210.conf index 42aa555771..c20ae98726 100644 --- a/targets/PROJECTS/GENERIC-NR-5GC/CONF/gnb.sa.band41.fr1.106PRB.usrpb210.conf +++ b/targets/PROJECTS/GENERIC-NR-5GC/CONF/gnb.sa.band41.fr1.106PRB.usrpb210.conf @@ -339,7 +339,3 @@ log_config : ngap_log_level ="debug"; f1ap_log_level ="debug"; }; -<<<<<<< HEAD -======= - ->>>>>>> origin/develop From 1ef62f5842e3f291cec2dfd07c9c88180fe424c2 Mon Sep 17 00:00:00 2001 From: Laurent Thomas Date: Sat, 3 Sep 2022 12:09:52 +0200 Subject: [PATCH 32/88] fix bug gtp-u len and robustify the gtp-u receiver --- common/utils/ocp_itti/intertask_interface.cpp | 2 + openair3/ocp-gtpu/gtp_itf.cpp | 224 ++++++++++-------- 2 files changed, 130 insertions(+), 96 deletions(-) diff --git a/common/utils/ocp_itti/intertask_interface.cpp b/common/utils/ocp_itti/intertask_interface.cpp index 82f7eb5774..5dbff3a40d 100644 --- a/common/utils/ocp_itti/intertask_interface.cpp +++ b/common/utils/ocp_itti/intertask_interface.cpp @@ -171,6 +171,8 @@ extern "C" { AssertFatal(epoll_ctl(t->epoll_fd, EPOLL_CTL_ADD, fd, &event) == 0, "epoll_ctl (EPOLL_CTL_ADD) failed for task %s, fd %d: %s!\n", itti_get_task_name(task_id), fd, strerror(errno)); + eventfd_t sem_counter = 1; + AssertFatal ( sizeof(sem_counter) == write(t->sem_fd, &sem_counter, sizeof(sem_counter)), ""); } void itti_unsubscribe_event_fd(task_id_t task_id, int fd) { diff --git a/openair3/ocp-gtpu/gtp_itf.cpp b/openair3/ocp-gtpu/gtp_itf.cpp index 2c0bd46a5d..9f1c4a04a9 100644 --- a/openair3/ocp-gtpu/gtp_itf.cpp +++ b/openair3/ocp-gtpu/gtp_itf.cpp @@ -163,11 +163,46 @@ static teid_t gtpv1uNewTeid(void) { } instance_t legacyInstanceMapping=0; -#define compatInst(a) ((a)==0 || (a)==INSTANCE_DEFAULT?legacyInstanceMapping:a) +#define compatInst(a) ((a)==0 || (a)==INSTANCE_DEFAULT ? legacyInstanceMapping:a) -#define GTPV1U_HEADER_SIZE (8) +#define getInstRetVoid(insT) \ + auto instChk=globGtp.instances.find(compatInst(insT)); \ + if (instChk == globGtp.instances.end()) { \ + LOG_E(GTPU,"try to get a gtp-u not existing output\n"); \ + pthread_mutex_unlock(&globGtp.gtp_lock); \ + return; \ + } \ + gtpEndPoint * inst=&instChk->second; - #define HDR_MAX 256 // 256 is supposed to be larger than any gtp header +#define getInstRetInt(insT) \ + auto instChk=globGtp.instances.find(compatInst(insT)); \ + if (instChk == globGtp.instances.end()) { \ + LOG_E(GTPU,"try to get a gtp-u not existing output\n"); \ + pthread_mutex_unlock(&globGtp.gtp_lock); \ + return GTPNOK; \ + } \ + gtpEndPoint * inst=&instChk->second; + + +#define getRntiRetVoid(insT, RnTi) \ + auto ptrRnti=insT->ue2te_mapping.find(RnTi); \ + \ + if ( ptrRnti==insT->ue2te_mapping.end() ) { \ + LOG_E(GTPU, "[%ld] gtpv1uSend failed: while getting ue rnti %x in hashtable ue_mapping\n", instance, rnti); \ + pthread_mutex_unlock(&globGtp.gtp_lock); \ + return; \ + } + +#define getRntiRetInt(insT, RnTi) \ + auto ptrRnti=insT->ue2te_mapping.find(RnTi); \ + \ + if ( ptrRnti==insT->ue2te_mapping.end() ) { \ + LOG_E(GTPU, "[%ld] gtpv1uSend failed: while getting ue rnti %x in hashtable ue_mapping\n", instance, rnti); \ + pthread_mutex_unlock(&globGtp.gtp_lock); \ + return GTPNOK; \ + } + +#define HDR_MAX 256 // 256 is supposed to be larger than any gtp header static int gtpv1uCreateAndSendMsg(int h, uint32_t peerIp, uint16_t peerPort, @@ -196,13 +231,11 @@ static int gtpv1uCreateAndSendMsg(int h, msgHdr->PT=1; msgHdr->version=1; msgHdr->msgType=msgType; - msgHdr->msgLength = htons(msgLen + extensionHeader_length); msgHdr->teid=htonl(teid); curPtr+=sizeof(Gtpv1uMsgHeaderT); if (seqNumFlag || (extHdrType != NO_MORE_EXT_HDRS) || npduNumFlag) { - msgHdr->msgLength += htons(4); *(uint16_t *)curPtr = seqNumFlag ? seqNum : 0x0000; curPtr+=sizeof(uint16_t); *(uint8_t *)curPtr = npduNumFlag ? npduNum : 0x00; @@ -229,9 +262,10 @@ static int gtpv1uCreateAndSendMsg(int h, curPtr+=msgLen; } - AssertFatal(curPtr-(buffer+msgLen) < HDR_MAX, ""); + msgHdr->msgLength = htons(curPtr-(buffer+sizeof(Gtpv1uMsgHeaderT))); + AssertFatal(curPtr-(buffer+msgLen) < HDR_MAX, "fixed max size of all headers too short"); // Fix me: add IPv6 support, using flag ipVersion - static struct sockaddr_in to= {0}; + struct sockaddr_in to= {0}; to.sin_family = AF_INET; to.sin_port = htons(peerPort); to.sin_addr.s_addr = peerIp ; @@ -253,14 +287,8 @@ static void gtpv1uSend(instance_t instance, gtpv1u_enb_tunnel_data_req_t *req, b rnti_t rnti=req->rnti; int rab_id=req->rab_id; pthread_mutex_lock(&globGtp.gtp_lock); - auto inst=&globGtp.instances[compatInst(instance)]; - auto ptrRnti=inst->ue2te_mapping.find(rnti); - - if ( ptrRnti==inst->ue2te_mapping.end() ) { - LOG_E(GTPU, "[%ld] gtpv1uSend failed: while getting ue rnti %x in hashtable ue_mapping\n", instance, rnti); - pthread_mutex_unlock(&globGtp.gtp_lock); - return; - } + getInstRetVoid(compatInst(instance)); + getRntiRetVoid(inst, rnti); map::iterator ptr2=ptrRnti->second.bearers.find(rab_id); @@ -292,14 +320,8 @@ static void gtpv1uSend2(instance_t instance, gtpv1u_gnb_tunnel_data_req_t *req, rnti_t rnti=req->rnti; int rab_id=req->pdusession_id; pthread_mutex_lock(&globGtp.gtp_lock); - auto inst=&globGtp.instances[compatInst(instance)]; - auto ptrRnti=inst->ue2te_mapping.find(rnti); - - if ( ptrRnti==inst->ue2te_mapping.end() ) { - LOG_E(GTPU, "[%ld] GTP-U gtpv1uSend failed: while getting ue rnti %x in hashtable ue_mapping\n", instance, rnti); - pthread_mutex_unlock(&globGtp.gtp_lock); - return; - } + getInstRetVoid(compatInst(instance)); + getRntiRetVoid(inst, rnti); map::iterator ptr2=ptrRnti->second.bearers.find(rab_id); @@ -385,14 +407,8 @@ static void gtpv1uSendDlDeliveryStatus(instance_t instance, gtpv1u_DU_buffer_rep rnti_t rnti=req->rnti; int rab_id=req->pdusession_id; pthread_mutex_lock(&globGtp.gtp_lock); - auto inst=&globGtp.instances[compatInst(instance)]; - auto ptrRnti=inst->ue2te_mapping.find(rnti); - - if ( ptrRnti==inst->ue2te_mapping.end() ) { - LOG_E(GTPU, "[%ld] GTP-U gtpv1uSend failed: while getting ue rnti %x in hashtable ue_mapping\n", instance, rnti); - pthread_mutex_unlock(&globGtp.gtp_lock); - return; - } + getInstRetVoid(compatInst(instance)); + getRntiRetVoid(inst, rnti); map::iterator ptr2=ptrRnti->second.bearers.find(rab_id); @@ -419,14 +435,8 @@ static void gtpv1uEndTunnel(instance_t instance, gtpv1u_enb_tunnel_data_req_t *r rnti_t rnti=req->rnti; int rab_id=req->rab_id; pthread_mutex_lock(&globGtp.gtp_lock); - auto inst=&globGtp.instances[compatInst(instance)]; - auto ptrRnti=inst->ue2te_mapping.find(rnti); - - if ( ptrRnti==inst->ue2te_mapping.end() ) { - LOG_E(GTPU, "[%ld] gtpv1uSend failed: while getting ue rnti %x in hashtable ue_mapping\n", instance, rnti); - pthread_mutex_unlock(&globGtp.gtp_lock); - return; - } + getInstRetVoid(compatInst(instance)); + getRntiRetVoid(inst, rnti); map::iterator ptr2=ptrRnti->second.bearers.find(rab_id); @@ -571,14 +581,8 @@ instance_t gtpv1Init(openAddr_t context) { void GtpuUpdateTunnelOutgoingTeid(instance_t instance, rnti_t rnti, ebi_t bearer_id, teid_t newOutgoingTeid) { pthread_mutex_lock(&globGtp.gtp_lock); - auto inst=&globGtp.instances[compatInst(instance)]; - auto ptrRnti=inst->ue2te_mapping.find(rnti); - - if ( ptrRnti == inst->ue2te_mapping.end() ) { - LOG_E(GTPU,"[%ld] Update tunnel for a not existing rnti %x\n", instance, rnti); - pthread_mutex_unlock(&globGtp.gtp_lock); - return; - } + getInstRetVoid(compatInst(instance)); + getRntiRetVoid(inst, rnti); map::iterator ptr2=ptrRnti->second.bearers.find(bearer_id); @@ -605,8 +609,7 @@ teid_t newGtpuCreateTunnel(instance_t instance, gtpCallback callBack, gtpCallbackSDAP callBackSDAP) { pthread_mutex_lock(&globGtp.gtp_lock); - instance=compatInst(instance); - auto inst=&globGtp.instances[instance]; + getInstRetInt(compatInst(instance)); auto it=inst->ue2te_mapping.find(rnti); if ( it != inst->ue2te_mapping.end() && it->second.bearers.find(outgoing_bearer_id) != it->second.bearers.end()) { @@ -682,8 +685,14 @@ int gtpv1u_create_s1u_tunnel(instance_t instance, create_tunnel_req->rnti, create_tunnel_req->num_tunnels, create_tunnel_req->sgw_S1u_teid[0]); - tcp_udp_port_t dstport=globGtp.instances[compatInst(instance)].get_dstport(); - + pthread_mutex_lock(&globGtp.gtp_lock); + getInstRetInt(compatInst(instance)); + + tcp_udp_port_t dstport=inst->get_dstport(); + uint8_t addr[inst->foundAddrLen]; + memcpy(addr, inst->foundAddr, inst->foundAddrLen); + pthread_mutex_unlock(&globGtp.gtp_lock); + for (int i = 0; i < create_tunnel_req->num_tunnels; i++) { AssertFatal(create_tunnel_req->eps_bearer_id[i] > 4, "From legacy code not clear, seems impossible (bearer=%d)\n", @@ -704,9 +713,8 @@ int gtpv1u_create_s1u_tunnel(instance_t instance, create_tunnel_resp->num_tunnels=create_tunnel_req->num_tunnels; create_tunnel_resp->enb_S1u_teid[i]=teid; create_tunnel_resp->eps_bearer_id[i] = create_tunnel_req->eps_bearer_id[i]; - memcpy(create_tunnel_resp->enb_addr.buffer,globGtp.instances[compatInst(instance)].foundAddr, - globGtp.instances[compatInst(instance)].foundAddrLen); - create_tunnel_resp->enb_addr.length= globGtp.instances[compatInst(instance)].foundAddrLen; + memcpy(create_tunnel_resp->enb_addr.buffer,addr,sizeof(addr)); + create_tunnel_resp->enb_addr.length= sizeof(addr); } return !GTPNOK; @@ -725,10 +733,11 @@ int gtpv1u_update_s1u_tunnel( create_tunnel_req->sgw_S1u_teid[0], create_tunnel_req->eps_bearer_id[0]); pthread_mutex_lock(&globGtp.gtp_lock); - auto inst=&globGtp.instances[compatInst(instance)]; + getInstRetInt(compatInst(instance)); if ( inst->ue2te_mapping.find(create_tunnel_req->rnti) == inst->ue2te_mapping.end() ) { - LOG_E(GTPU,"[%ld] Update not already existing tunnel (new rnti %x, old rnti %x)\n", instance, create_tunnel_req->rnti, prior_rnti); + LOG_E(GTPU,"[%ld] Update not already existing tunnel (new rnti %x, old rnti %x)\n", + instance, create_tunnel_req->rnti, prior_rnti); } auto it=inst->ue2te_mapping.find(prior_rnti); @@ -755,7 +764,13 @@ int gtpv1u_create_ngu_tunnel( const instance_t instance, create_tunnel_req->rnti, create_tunnel_req->num_tunnels, create_tunnel_req->outgoing_teid[0]); - tcp_udp_port_t dstport = globGtp.instances[compatInst(instance)].get_dstport(); + pthread_mutex_lock(&globGtp.gtp_lock); + getInstRetInt(compatInst(instance)); + + tcp_udp_port_t dstport = inst->get_dstport(); + uint8_t addr[inst->foundAddrLen]; + memcpy(addr, inst->foundAddr, inst->foundAddrLen); + pthread_mutex_unlock(&globGtp.gtp_lock); for (int i = 0; i < create_tunnel_req->num_tunnels; i++) { teid_t teid = newGtpuCreateTunnel(instance, create_tunnel_req->rnti, @@ -771,9 +786,8 @@ int gtpv1u_create_ngu_tunnel( const instance_t instance, create_tunnel_resp->rnti=create_tunnel_req->rnti; create_tunnel_resp->num_tunnels=create_tunnel_req->num_tunnels; create_tunnel_resp->gnb_NGu_teid[i]=teid; - memcpy(create_tunnel_resp->gnb_addr.buffer,globGtp.instances[compatInst(instance)].foundAddr, - globGtp.instances[compatInst(instance)].foundAddrLen); - create_tunnel_resp->gnb_addr.length= globGtp.instances[compatInst(instance)].foundAddrLen; + memcpy(create_tunnel_resp->gnb_addr.buffer,addr,sizeof(addr)); + create_tunnel_resp->gnb_addr.length= sizeof(addr); } return !GTPNOK; @@ -799,25 +813,19 @@ int newGtpuDeleteAllTunnels(instance_t instance, rnti_t rnti) { LOG_D(GTPU, "[%ld] Start delete tunnels for RNTI %x\n", instance, rnti); pthread_mutex_lock(&globGtp.gtp_lock); - auto inst=&globGtp.instances[compatInst(instance)]; - auto it=inst->ue2te_mapping.find(rnti); - - if ( it == inst->ue2te_mapping.end() ) { - LOG_W(GTPU,"[%ld] Delete GTP tunnels for rnti: %x, but no tunnel exits\n", instance, rnti); - pthread_mutex_unlock(&globGtp.gtp_lock); - return -1; - } + getInstRetInt(compatInst(instance)); + getRntiRetInt(inst, rnti); int nb=0; - for (auto j=it->second.bearers.begin(); - j!=it->second.bearers.end(); + for (auto j=ptrRnti->second.bearers.begin(); + j!=ptrRnti->second.bearers.end(); ++j) { inst->te2ue_mapping.erase(j->second.teid_incoming); nb++; } - inst->ue2te_mapping.erase(it); + inst->ue2te_mapping.erase(ptrRnti); pthread_mutex_unlock(&globGtp.gtp_lock); LOG_I(GTPU, "[%ld] Deleted all tunnels for RNTI %x (%d tunnels deleted)\n", instance, rnti, nb); return !GTPNOK; @@ -834,21 +842,14 @@ int newGtpuDeleteTunnels(instance_t instance, rnti_t rnti, int nbTunnels, pduses LOG_D(GTPU, "[%ld] Start delete tunnels for RNTI %x\n", instance, rnti); pthread_mutex_lock(&globGtp.gtp_lock); - auto inst=&globGtp.instances[compatInst(instance)]; - auto ptrRNTI=inst->ue2te_mapping.find(rnti); - - if ( ptrRNTI == inst->ue2te_mapping.end() ) { - LOG_W(GTPU,"[%ld] Delete GTP tunnels for rnti: %x, but no tunnel exits\n", instance, rnti); - pthread_mutex_unlock(&globGtp.gtp_lock); - return -1; - } - + getInstRetInt(compatInst(instance)); + getRntiRetInt(inst, rnti); int nb=0; for (int i=0; isecond.bearers.find(pdusession_id[i]); + auto ptr2=ptrRnti->second.bearers.find(pdusession_id[i]); - if ( ptr2 == ptrRNTI->second.bearers.end() ) { + if ( ptr2 == ptrRnti->second.bearers.end() ) { LOG_E(GTPU,"[%ld] GTP-U instance: delete of not existing tunnel RNTI:RAB: %x/%x\n", instance, rnti,pdusession_id[i]); } else { inst->te2ue_mapping.erase(ptr2->second.teid_incoming); @@ -856,9 +857,9 @@ int newGtpuDeleteTunnels(instance_t instance, rnti_t rnti, int nbTunnels, pduses } } - if (ptrRNTI->second.bearers.size() == 0 ) + if (ptrRnti->second.bearers.size() == 0 ) // no tunnels on this rnti, erase the ue entry - inst->ue2te_mapping.erase(ptrRNTI); + inst->ue2te_mapping.erase(ptrRnti); pthread_mutex_unlock(&globGtp.gtp_lock); LOG_I(GTPU, "[%ld] Deleted all tunnels for RNTI %x (%d tunnels deleted)\n", instance, rnti, nb); @@ -936,7 +937,8 @@ static int Gtpv1uHandleEndMarker(int h, pthread_mutex_lock(&globGtp.gtp_lock); // the socket Linux file handler is the instance id - auto inst=&globGtp.instances[h]; + getInstRetInt(h); + auto tunnel=inst->te2ue_mapping.find(ntohl(msgHdr->teid)); if ( tunnel == inst->te2ue_mapping.end() ) { @@ -996,7 +998,8 @@ static int Gtpv1uHandleGpdu(int h, pthread_mutex_lock(&globGtp.gtp_lock); // the socket Linux file handler is the instance id - auto inst=&globGtp.instances[h]; + getInstRetInt(h); + auto tunnel=inst->te2ue_mapping.find(ntohl(msgHdr->teid)); if ( tunnel == inst->te2ue_mapping.end() ) { @@ -1007,7 +1010,7 @@ static int Gtpv1uHandleGpdu(int h, /* see TS 29.281 5.1 */ //Minimum length of GTP-U header if non of the optional fields are present - int offset = sizeof(Gtpv1uMsgHeaderT); + unsigned int offset = sizeof(Gtpv1uMsgHeaderT); uint8_t qfi = -1; bool rqi = false; @@ -1025,12 +1028,20 @@ static int Gtpv1uHandleGpdu(int h, extension_header_length = msgBuf[offset]; switch (next_extension_header_type) { case PDU_SESSION_CONTAINER: { + if (offset + sizeof(PDUSessionContainerT) > msgBufLen ) { + LOG_E(GTPU, "gtp-u received header is malformed, ignore gtp packet\n"); + return GTPNOK; + } PDUSessionContainerT *pdusession_cntr = (PDUSessionContainerT *)(msgBuf + offset + 1); qfi = pdusession_cntr->QFI; rqi = pdusession_cntr->Reflective_QoS_activation; break; } case NR_RAN_CONTAINER: { + if (offset + 1 > msgBufLen ) { + LOG_E(GTPU, "gtp-u received header is malformed, ignore gtp packet\n"); + return GTPNOK; + } uint8_t PDU_type = (msgBuf[offset+1]>>4) & 0x0f; if (PDU_type == 0){ //DL USER Data Format int additional_offset = 6; //Additional offset capturing the first non-mandatory octet (TS 38.425, Figure 5.5.2.1-1) @@ -1057,10 +1068,14 @@ static int Gtpv1uHandleGpdu(int h, } default: LOG_W(GTPU, "unhandled extension 0x%2.2x, skipping\n", next_extension_header_type); - break; + break; } offset += extension_header_length * EXT_HDR_LNTH_OCTET_UNITS; + if (offset > msgBufLen ) { + LOG_E(GTPU, "gtp-u received header is malformed, ignore gtp packet\n"); + return GTPNOK; + } next_extension_header_type = msgBuf[offset - 1]; } } @@ -1082,6 +1097,10 @@ static int Gtpv1uHandleGpdu(int h, const mui_t mui=RLC_MUI_UNDEFINED; const confirm_t confirm=RLC_SDU_CONFIRM_NO; const sdu_size_t sdu_buffer_size=msgBufLen-offset; + if (sdu_buffer_size < 1) { + LOG_E(GTPU, "gtp-u received header is malformed, ignore gtp packet\n"); + return GTPNOK; + } unsigned char *const sdu_buffer=msgBuf+offset; const pdcp_transmission_mode_t mode=PDCP_TRANSMISSION_MODE_DATA; const uint32_t sourceL2Id=0; @@ -1139,7 +1158,10 @@ static int Gtpv1uHandleGpdu(int h, extensionHeader->buffer[offset] = (NR_PDCP_PDU_SN >> 16) & 0xff; extensionHeader->buffer[offset+1] = (NR_PDCP_PDU_SN >> 8) & 0xff; extensionHeader->buffer[offset+2] = NR_PDCP_PDU_SN & 0xff; - LOG_D(GTPU, "Octets reporting NR_PDCP_PDU_SN, extensionHeader->buffer[offset]: %u, extensionHeader->buffer[offset+1]:%u, extensionHeader->buffer[offset+2]:%u \n", extensionHeader->buffer[offset], extensionHeader->buffer[offset+1],extensionHeader->buffer[offset+2]); + LOG_D(GTPU, "Octets reporting NR_PDCP_PDU_SN, extensionHeader-> %u:%u:%u \n", + extensionHeader->buffer[offset], + extensionHeader->buffer[offset+1], + extensionHeader->buffer[offset+2]); extensionHeader->buffer[offset+3] = 0x00; //Padding octet extensionHeader->buffer[offset+4] = 0x00; //No more extension headers /*Total size of DDD_status PDU = size of mandatory part + @@ -1148,7 +1170,10 @@ static int Gtpv1uHandleGpdu(int h, * according to TS 38.425: Fig. 5.5.2.2-1 and section 5.5.3.24*/ extensionHeader->length = 1+sizeof(DlDataDeliveryStatus_flagsT)+3+1+1; gtpv1uCreateAndSendMsg( - h, peerIp, peerPort, GTP_GPDU, inst->te2ue_mapping[ntohl(msgHdr->teid)].outgoing_teid, NULL, 0, false, false, 0, 0, NR_RAN_CONTAINER, extensionHeader->buffer, extensionHeader->length); + h, peerIp, peerPort, GTP_GPDU, + inst->te2ue_mapping[ntohl(msgHdr->teid)].outgoing_teid, + NULL, 0, false, false, 0, 0, NR_RAN_CONTAINER, + extensionHeader->buffer, extensionHeader->length); } LOG_D(GTPU,"[%d] Received a %d bytes packet for: teid:%x\n", h, @@ -1158,7 +1183,7 @@ static int Gtpv1uHandleGpdu(int h, } void gtpv1uReceiver(int h) { - uint8_t udpData[65536]; + uint8_t udpData[65536]; int udpDataLen; socklen_t from_len; struct sockaddr_in addr; @@ -1172,10 +1197,17 @@ void gtpv1uReceiver(int h) { LOG_W(GTPU, "[%d] Recvfrom returned 0\n", h); return; } else { - uint8_t msgType = *((uint8_t *)(udpData + 1)); - LOG_D(GTPU, "[%d] Received GTP data, msg type: %x\n", h, msgType); - - switch(msgType) { + if ( udpDataLen < (int)sizeof(Gtpv1uMsgHeaderT) ) { + LOG_W(GTPU, "[%d] received malformed gtp packet \n", h); + return; + } + Gtpv1uMsgHeaderT* msg=(Gtpv1uMsgHeaderT*) udpData; + if ( (int)(ntohs(msg->msgLength) + sizeof(Gtpv1uMsgHeaderT)) != udpDataLen ) { + LOG_W(GTPU, "[%d] received malformed gtp packet length\n", h); + return; + } + LOG_D(GTPU, "[%d] Received GTP data, msg type: %x\n", h, msg->msgType); + switch(msg->msgType) { case GTP_ECHO_RSP: break; @@ -1200,7 +1232,7 @@ void gtpv1uReceiver(int h) { break; default: - LOG_E(GTPU, "[%d] Received a GTP packet of unknown type: %d\n", h, msgType); + LOG_E(GTPU, "[%d] Received a GTP packet of unknown type: %d\n", h, msg->msgType); break; } } From d1a36c29c236c055b539e59a546a5a7da2a5b41e Mon Sep 17 00:00:00 2001 From: Robert Schmidt Date: Mon, 5 Sep 2022 13:48:55 +0200 Subject: [PATCH 33/88] Limit XML repeatCount to 1 --- ci-scripts/xml_files/benetel_nsa_quectel.xml | 2 +- ci-scripts/xml_files/benetel_nsa_quectel_longrun.xml | 2 +- ci-scripts/xml_files/container_4g_l2sim_tdd.xml | 2 +- ci-scripts/xml_files/container_4g_rfsim_tdd_05MHz.xml | 2 +- ci-scripts/xml_files/container_5g_fdd_rfsim.xml | 2 +- ci-scripts/xml_files/container_5g_l2sim_tdd.xml | 2 +- ci-scripts/xml_files/container_5g_rfsim.xml | 2 +- ci-scripts/xml_files/enb_ocp_usrp210_band7_test_05mhz_tm1.xml | 2 +- ci-scripts/xml_files/enb_ue_usrp210_band7_test_05mhz_tm1.xml | 2 +- .../enb_ue_usrp210_band7_test_05mhz_tm1_fembms_no_s1.xml | 2 +- .../enb_ue_usrp210_band7_test_05mhz_tm1_mbms_no_s1.xml | 2 +- ci-scripts/xml_files/enb_ue_usrp210_band7_test_05mhz_tm1_s1.xml | 2 +- ci-scripts/xml_files/enb_usrp210_band40_test_05mhz_tm2.xml | 2 +- ci-scripts/xml_files/enb_usrp210_band40_test_20mhz_tm1.xml | 2 +- ...b_usrp210_band7_test_05mhz_tm1_rrc_inactivity_no_flexran.xml | 2 +- ...nb_usrp210_band7_test_05mhz_tm1_rrc_inactivity_w_flexran.xml | 2 +- ci-scripts/xml_files/enb_usrp210_band7_test_10mhz_tm1_cdrx.xml | 2 +- ci-scripts/xml_files/gnb_nr_ue_usrp_run.xml | 2 +- ci-scripts/xml_files/gnb_nr_ue_usrp_run_multi_thread.xml | 2 +- ci-scripts/xml_files/gnb_usrp_build.xml | 2 +- ci-scripts/xml_files/if4p5_usrp210_band40_test_10mhz.xml | 2 +- ci-scripts/xml_files/if4p5_usrp210_band40_test_20mhz.xml | 2 +- .../xml_files/inria/enb_ue_usrp210_band7_test_05mhz_tm1.xml | 2 +- .../inria/enb_ue_usrp210_band7_test_05mhz_tm1_nos1.xml | 2 +- .../xml_files/inria/enb_usrp210_band7_x2_ho_test_05Mhz_tm1.xml | 2 +- ci-scripts/xml_files/multi_rru_band38_test_10mhz_tm1.xml | 2 +- ci-scripts/xml_files/nr_ue_usrp_build.xml | 2 +- ci-scripts/xml_files/ue_band20_test_10mhz_orange.xml | 2 +- ci-scripts/xml_files/ue_band20_test_10mhz_sfr.xml | 2 +- ci-scripts/xml_files/x2ho_enb_usrp210_band13_test_05mhz_tm1.xml | 2 +- 30 files changed, 30 insertions(+), 30 deletions(-) diff --git a/ci-scripts/xml_files/benetel_nsa_quectel.xml b/ci-scripts/xml_files/benetel_nsa_quectel.xml index 8c284b6673..5da8322f22 100644 --- a/ci-scripts/xml_files/benetel_nsa_quectel.xml +++ b/ci-scripts/xml_files/benetel_nsa_quectel.xml @@ -24,7 +24,7 @@ TEST-NSA-FR1-TM1 NSA Ping DL UL with QUECTEL tasks - 3 + 1 030000 040000 diff --git a/ci-scripts/xml_files/benetel_nsa_quectel_longrun.xml b/ci-scripts/xml_files/benetel_nsa_quectel_longrun.xml index 2e4494c819..3173e6315a 100644 --- a/ci-scripts/xml_files/benetel_nsa_quectel_longrun.xml +++ b/ci-scripts/xml_files/benetel_nsa_quectel_longrun.xml @@ -24,7 +24,7 @@ TEST-NSA-FR1-TM1 NSA Ping DL UL with QUECTEL tasks - 3 + 1 030000 040000 diff --git a/ci-scripts/xml_files/container_4g_l2sim_tdd.xml b/ci-scripts/xml_files/container_4g_l2sim_tdd.xml index 5298d01ef3..3ac32e1989 100644 --- a/ci-scripts/xml_files/container_4g_l2sim_tdd.xml +++ b/ci-scripts/xml_files/container_4g_l2sim_tdd.xml @@ -24,7 +24,7 @@ l2sim-4glte-tdd Testing 4G LTE L2 sim - FDD eNB wrench - 2 + 1 100001 000000 diff --git a/ci-scripts/xml_files/container_4g_rfsim_tdd_05MHz.xml b/ci-scripts/xml_files/container_4g_rfsim_tdd_05MHz.xml index aa70db1fed..7a29e50f39 100644 --- a/ci-scripts/xml_files/container_4g_rfsim_tdd_05MHz.xml +++ b/ci-scripts/xml_files/container_4g_rfsim_tdd_05MHz.xml @@ -24,7 +24,7 @@ rfsim-4glte-tdd05mhz Monolithic eNB - TDD 05MHz wrench - 2 + 1 100011 000011 diff --git a/ci-scripts/xml_files/container_5g_fdd_rfsim.xml b/ci-scripts/xml_files/container_5g_fdd_rfsim.xml index 9564b24b35..578d5f221f 100644 --- a/ci-scripts/xml_files/container_5g_fdd_rfsim.xml +++ b/ci-scripts/xml_files/container_5g_fdd_rfsim.xml @@ -24,7 +24,7 @@ rfsim-5gnr-fdd Monolithic FDD gNB with SDAP wrench - 4 + 1 100011 000010 diff --git a/ci-scripts/xml_files/container_5g_l2sim_tdd.xml b/ci-scripts/xml_files/container_5g_l2sim_tdd.xml index be6b789b6b..cc3c1ae391 100644 --- a/ci-scripts/xml_files/container_5g_l2sim_tdd.xml +++ b/ci-scripts/xml_files/container_5g_l2sim_tdd.xml @@ -24,7 +24,7 @@ l2sim-5gnr-tdd Testing 5G NR L2 sim - TDD gNB wrench - 2 + 1 100001 000000 diff --git a/ci-scripts/xml_files/container_5g_rfsim.xml b/ci-scripts/xml_files/container_5g_rfsim.xml index 653e1e6513..5ad400ecc1 100644 --- a/ci-scripts/xml_files/container_5g_rfsim.xml +++ b/ci-scripts/xml_files/container_5g_rfsim.xml @@ -24,7 +24,7 @@ rfsim-5gnr-tdd Monolithic TDD gNB wrench - 4 + 1 100001 000000 diff --git a/ci-scripts/xml_files/enb_ocp_usrp210_band7_test_05mhz_tm1.xml b/ci-scripts/xml_files/enb_ocp_usrp210_band7_test_05mhz_tm1.xml index d330d826bf..eebe62b3b5 100644 --- a/ci-scripts/xml_files/enb_ocp_usrp210_band7_test_05mhz_tm1.xml +++ b/ci-scripts/xml_files/enb_ocp_usrp210_band7_test_05mhz_tm1.xml @@ -24,7 +24,7 @@ test-05-tm1 Test-05MHz-TM1 tasks - 4 + 1 030201 040101 diff --git a/ci-scripts/xml_files/enb_ue_usrp210_band7_test_05mhz_tm1.xml b/ci-scripts/xml_files/enb_ue_usrp210_band7_test_05mhz_tm1.xml index 48ce2f298f..723956fe60 100644 --- a/ci-scripts/xml_files/enb_ue_usrp210_band7_test_05mhz_tm1.xml +++ b/ci-scripts/xml_files/enb_ue_usrp210_band7_test_05mhz_tm1.xml @@ -24,7 +24,7 @@ test-05-tm1-nos1-tunnel Test-05MHz-TM1-noS1-tunnel tasks - 4 + 1 030201 090109 030101 000001 090101 000002 040501 040502 000001 040601 040602 040641 040642 000001 090109 030201 diff --git a/ci-scripts/xml_files/enb_ue_usrp210_band7_test_05mhz_tm1_fembms_no_s1.xml b/ci-scripts/xml_files/enb_ue_usrp210_band7_test_05mhz_tm1_fembms_no_s1.xml index fb66ce0c66..cf090379df 100644 --- a/ci-scripts/xml_files/enb_ue_usrp210_band7_test_05mhz_tm1_fembms_no_s1.xml +++ b/ci-scripts/xml_files/enb_ue_usrp210_band7_test_05mhz_tm1_fembms_no_s1.xml @@ -24,7 +24,7 @@ test-05-tm1-fembms-nos1-tunnel Test-05MHz-FEMBMS-TM1-noS1-tunnel tasks - 2 + 1 030201 090109 030104 000001 090104 000002 040605 000001 090109 030201 diff --git a/ci-scripts/xml_files/enb_ue_usrp210_band7_test_05mhz_tm1_mbms_no_s1.xml b/ci-scripts/xml_files/enb_ue_usrp210_band7_test_05mhz_tm1_mbms_no_s1.xml index 234f6639ce..c778b43eb5 100644 --- a/ci-scripts/xml_files/enb_ue_usrp210_band7_test_05mhz_tm1_mbms_no_s1.xml +++ b/ci-scripts/xml_files/enb_ue_usrp210_band7_test_05mhz_tm1_mbms_no_s1.xml @@ -24,7 +24,7 @@ test-05-tm1-mbms-nos1-tunnel Test-05MHz-MBMS-TM1-noS1-tunnel tasks - 2 + 1 030201 090109 030103 000001 090103 000002 040605 000001 090109 030201 diff --git a/ci-scripts/xml_files/enb_ue_usrp210_band7_test_05mhz_tm1_s1.xml b/ci-scripts/xml_files/enb_ue_usrp210_band7_test_05mhz_tm1_s1.xml index 791d32eec0..07e3a4135a 100644 --- a/ci-scripts/xml_files/enb_ue_usrp210_band7_test_05mhz_tm1_s1.xml +++ b/ci-scripts/xml_files/enb_ue_usrp210_band7_test_05mhz_tm1_s1.xml @@ -24,7 +24,7 @@ test-05-tm1-tunnel Test-05MHz-TM1-tunnel tasks - 2 + 1 030201 090109 030102 000001 090102 000002 040503 000001 040603 040604 040643 040644 000001 090109 030201 diff --git a/ci-scripts/xml_files/enb_usrp210_band40_test_05mhz_tm2.xml b/ci-scripts/xml_files/enb_usrp210_band40_test_05mhz_tm2.xml index 2e7da714b0..9295306f23 100644 --- a/ci-scripts/xml_files/enb_usrp210_band40_test_05mhz_tm2.xml +++ b/ci-scripts/xml_files/enb_usrp210_band40_test_05mhz_tm2.xml @@ -25,7 +25,7 @@ test-05-tm2 Test-05MHz-TM2 tasks - 2 + 1 True 040608 diff --git a/ci-scripts/xml_files/enb_usrp210_band40_test_20mhz_tm1.xml b/ci-scripts/xml_files/enb_usrp210_band40_test_20mhz_tm1.xml index ef9fee0dca..1b32b873ca 100644 --- a/ci-scripts/xml_files/enb_usrp210_band40_test_20mhz_tm1.xml +++ b/ci-scripts/xml_files/enb_usrp210_band40_test_20mhz_tm1.xml @@ -24,7 +24,7 @@ test-20-tm1 Test-20MHz-TM1 tasks - 4 + 1 True 040623 diff --git a/ci-scripts/xml_files/enb_usrp210_band7_test_05mhz_tm1_rrc_inactivity_no_flexran.xml b/ci-scripts/xml_files/enb_usrp210_band7_test_05mhz_tm1_rrc_inactivity_no_flexran.xml index aedd980c34..90d54a2c82 100644 --- a/ci-scripts/xml_files/enb_usrp210_band7_test_05mhz_tm1_rrc_inactivity_no_flexran.xml +++ b/ci-scripts/xml_files/enb_usrp210_band7_test_05mhz_tm1_rrc_inactivity_no_flexran.xml @@ -24,7 +24,7 @@ test-05-tm1-rrc-no-flex Test-05MHz-TM1-RRC-Inactivity tasks - 2 + 1 030201 040101 diff --git a/ci-scripts/xml_files/enb_usrp210_band7_test_05mhz_tm1_rrc_inactivity_w_flexran.xml b/ci-scripts/xml_files/enb_usrp210_band7_test_05mhz_tm1_rrc_inactivity_w_flexran.xml index b488637483..1667e94f71 100644 --- a/ci-scripts/xml_files/enb_usrp210_band7_test_05mhz_tm1_rrc_inactivity_w_flexran.xml +++ b/ci-scripts/xml_files/enb_usrp210_band7_test_05mhz_tm1_rrc_inactivity_w_flexran.xml @@ -24,7 +24,7 @@ test-05-tm1-rrc-w-flex Test-05MHz-TM1-RRC-Inactivity-FlexRan tasks - 2 + 1 030201 040101 diff --git a/ci-scripts/xml_files/enb_usrp210_band7_test_10mhz_tm1_cdrx.xml b/ci-scripts/xml_files/enb_usrp210_band7_test_10mhz_tm1_cdrx.xml index 82e0a32f6a..28140305db 100644 --- a/ci-scripts/xml_files/enb_usrp210_band7_test_10mhz_tm1_cdrx.xml +++ b/ci-scripts/xml_files/enb_usrp210_band7_test_10mhz_tm1_cdrx.xml @@ -24,7 +24,7 @@ test-10-cdrx-tm1 Test-10MHz-CDRX-TM1 tasks - 4 + 1 030201 040101 diff --git a/ci-scripts/xml_files/gnb_nr_ue_usrp_run.xml b/ci-scripts/xml_files/gnb_nr_ue_usrp_run.xml index d025b95ce5..dd2b15a4f2 100644 --- a/ci-scripts/xml_files/gnb_nr_ue_usrp_run.xml +++ b/ci-scripts/xml_files/gnb_nr_ue_usrp_run.xml @@ -24,7 +24,7 @@ run-oai-gnb-nr-ue Run-gNB-and-NR-UE tasks - 2 + 1 090101 000001 090102 000002 090108 090109 diff --git a/ci-scripts/xml_files/gnb_nr_ue_usrp_run_multi_thread.xml b/ci-scripts/xml_files/gnb_nr_ue_usrp_run_multi_thread.xml index ffd41e9e86..7c9d689e44 100644 --- a/ci-scripts/xml_files/gnb_nr_ue_usrp_run_multi_thread.xml +++ b/ci-scripts/xml_files/gnb_nr_ue_usrp_run_multi_thread.xml @@ -24,7 +24,7 @@ run-oai-gnb-nr-ue-tx-write-thread Run-gNB-and-NR-UE-TX-Write-Thread tasks - 2 + 1 090103 000001 090104 000002 090108 090109 diff --git a/ci-scripts/xml_files/gnb_usrp_build.xml b/ci-scripts/xml_files/gnb_usrp_build.xml index 81c7d4e24e..f8ec797646 100644 --- a/ci-scripts/xml_files/gnb_usrp_build.xml +++ b/ci-scripts/xml_files/gnb_usrp_build.xml @@ -24,7 +24,7 @@ gnb-build-tab Build-gNB wrench - 4 + 1 010101 diff --git a/ci-scripts/xml_files/if4p5_usrp210_band40_test_10mhz.xml b/ci-scripts/xml_files/if4p5_usrp210_band40_test_10mhz.xml index f755a7ec96..b7c2622283 100644 --- a/ci-scripts/xml_files/if4p5_usrp210_band40_test_10mhz.xml +++ b/ci-scripts/xml_files/if4p5_usrp210_band40_test_10mhz.xml @@ -24,7 +24,7 @@ test-10 Test-10MHz tasks - 2 + 1 True 040612 diff --git a/ci-scripts/xml_files/if4p5_usrp210_band40_test_20mhz.xml b/ci-scripts/xml_files/if4p5_usrp210_band40_test_20mhz.xml index 4e84c47faf..287f75c59f 100644 --- a/ci-scripts/xml_files/if4p5_usrp210_band40_test_20mhz.xml +++ b/ci-scripts/xml_files/if4p5_usrp210_band40_test_20mhz.xml @@ -24,7 +24,7 @@ test-20 Test-20MHz tasks - 2 + 1 030201 040101 diff --git a/ci-scripts/xml_files/inria/enb_ue_usrp210_band7_test_05mhz_tm1.xml b/ci-scripts/xml_files/inria/enb_ue_usrp210_band7_test_05mhz_tm1.xml index c2fb2e8e2e..cd9ed8809e 100644 --- a/ci-scripts/xml_files/inria/enb_ue_usrp210_band7_test_05mhz_tm1.xml +++ b/ci-scripts/xml_files/inria/enb_ue_usrp210_band7_test_05mhz_tm1.xml @@ -24,7 +24,7 @@ test-05-tm1-oai-ue Test-05MHz-TM1-OAI-UE tasks - 4 + 1 030201 090109 030102 000001 090102 000002 040503 000002 040603 040604 040643 040644 000002 090109 000001 030201 diff --git a/ci-scripts/xml_files/inria/enb_ue_usrp210_band7_test_05mhz_tm1_nos1.xml b/ci-scripts/xml_files/inria/enb_ue_usrp210_band7_test_05mhz_tm1_nos1.xml index d5bdc5a42d..16cc4b9a41 100644 --- a/ci-scripts/xml_files/inria/enb_ue_usrp210_band7_test_05mhz_tm1_nos1.xml +++ b/ci-scripts/xml_files/inria/enb_ue_usrp210_band7_test_05mhz_tm1_nos1.xml @@ -24,7 +24,7 @@ test-05-tm1-nos1-tunnel Test-05MHz-TM1-noS1-tunnel tasks - 4 + 1 030201 090109 030101 000001 090101 000002 040501 040502 000001 040601 040602 040641 040642 000001 090109 030201 diff --git a/ci-scripts/xml_files/inria/enb_usrp210_band7_x2_ho_test_05Mhz_tm1.xml b/ci-scripts/xml_files/inria/enb_usrp210_band7_x2_ho_test_05Mhz_tm1.xml index b4b20c1239..36c4e2c1a8 100644 --- a/ci-scripts/xml_files/inria/enb_usrp210_band7_x2_ho_test_05Mhz_tm1.xml +++ b/ci-scripts/xml_files/inria/enb_usrp210_band7_x2_ho_test_05Mhz_tm1.xml @@ -24,7 +24,7 @@ test-x2-ho-05-tm1 Test-X2-Handover-05MHz-TM1 tasks - 2 + 1 040101 030201 030202 050102 diff --git a/ci-scripts/xml_files/multi_rru_band38_test_10mhz_tm1.xml b/ci-scripts/xml_files/multi_rru_band38_test_10mhz_tm1.xml index 3875a3df03..fdde60bd4c 100644 --- a/ci-scripts/xml_files/multi_rru_band38_test_10mhz_tm1.xml +++ b/ci-scripts/xml_files/multi_rru_band38_test_10mhz_tm1.xml @@ -24,7 +24,7 @@ test-multi-rru-10 Test-Multi-RRU-10MHz tasks - 2 + 1 030211 030212 030213 030111 030112 030113 diff --git a/ci-scripts/xml_files/nr_ue_usrp_build.xml b/ci-scripts/xml_files/nr_ue_usrp_build.xml index bc04efdb4b..dd3a10f2f5 100644 --- a/ci-scripts/xml_files/nr_ue_usrp_build.xml +++ b/ci-scripts/xml_files/nr_ue_usrp_build.xml @@ -24,7 +24,7 @@ nr-ue-build-tab Build-NR-UE wrench - 2 + 1 010102 diff --git a/ci-scripts/xml_files/ue_band20_test_10mhz_orange.xml b/ci-scripts/xml_files/ue_band20_test_10mhz_orange.xml index 49ccfbca14..eba64191f0 100644 --- a/ci-scripts/xml_files/ue_band20_test_10mhz_orange.xml +++ b/ci-scripts/xml_files/ue_band20_test_10mhz_orange.xml @@ -24,7 +24,7 @@ test-10mhz-orange Test-10Mhz-Orange tasks - 4 + 1 090109 090110 000001 090109 diff --git a/ci-scripts/xml_files/ue_band20_test_10mhz_sfr.xml b/ci-scripts/xml_files/ue_band20_test_10mhz_sfr.xml index fdc70a9bdd..359fca1a11 100644 --- a/ci-scripts/xml_files/ue_band20_test_10mhz_sfr.xml +++ b/ci-scripts/xml_files/ue_band20_test_10mhz_sfr.xml @@ -24,7 +24,7 @@ test-10mHz-sfr Test-10MHz-SFR tasks - 4 + 1 090109 090111 000001 090109 diff --git a/ci-scripts/xml_files/x2ho_enb_usrp210_band13_test_05mhz_tm1.xml b/ci-scripts/xml_files/x2ho_enb_usrp210_band13_test_05mhz_tm1.xml index 14872c9f8f..e7a2c42cd6 100644 --- a/ci-scripts/xml_files/x2ho_enb_usrp210_band13_test_05mhz_tm1.xml +++ b/ci-scripts/xml_files/x2ho_enb_usrp210_band13_test_05mhz_tm1.xml @@ -25,7 +25,7 @@ test-x2-ho-05-tm1 Test-X2-HO-FDD-05MHz-TM1 tasks - 2 + 1 True 030201 030202 From 6e36b5405aecb33df7dc989c3230a5c8d7ca8f41 Mon Sep 17 00:00:00 2001 From: luis_pereira87 Date: Mon, 5 Sep 2022 13:33:00 +0100 Subject: [PATCH 34/88] Fix power calculation based on CSI-RS --- openair1/PHY/NR_UE_TRANSPORT/csi_rx.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/openair1/PHY/NR_UE_TRANSPORT/csi_rx.c b/openair1/PHY/NR_UE_TRANSPORT/csi_rx.c index 43944b2fa8..bfa578edce 100644 --- a/openair1/PHY/NR_UE_TRANSPORT/csi_rx.c +++ b/openair1/PHY/NR_UE_TRANSPORT/csi_rx.c @@ -270,7 +270,7 @@ uint32_t calc_power_csirs(const uint16_t *x, const fapi_nr_dl_config_csirs_pdu_r continue; } sum_x = sum_x + x[rb-csirs_config_pdu->start_rb]; - sum_x2 = sum_x2 + x[rb]*x[rb-csirs_config_pdu->start_rb]; + sum_x2 = sum_x2 + x[rb-csirs_config_pdu->start_rb]*x[rb-csirs_config_pdu->start_rb]; size++; } return sum_x2/size - (sum_x/size)*(sum_x/size); From e2c59441cdb838e1548d3699adcb25b464a4a20e Mon Sep 17 00:00:00 2001 From: Robert Schmidt Date: Mon, 29 Aug 2022 18:34:56 +0200 Subject: [PATCH 35/88] Dockerfile: delete artifacts using -c before building --- docker/Dockerfile.build.rhel8.2 | 2 +- docker/Dockerfile.build.ubuntu18 | 2 +- docker/Dockerfile.phySim.rhel8.2 | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/docker/Dockerfile.build.rhel8.2 b/docker/Dockerfile.build.rhel8.2 index 2664096a9b..6fc2598276 100644 --- a/docker/Dockerfile.build.rhel8.2 +++ b/docker/Dockerfile.build.rhel8.2 @@ -35,4 +35,4 @@ COPY . . RUN /bin/sh oaienv && \ cd cmake_targets && \ mkdir -p log && \ - ./build_oai --eNB --gNB --RU --UE --nrUE --ninja --build-lib all -w USRP --verbose-ci --noavx512 + ./build_oai --eNB --gNB --RU --UE --nrUE --ninja --build-lib all -w USRP --verbose-ci --noavx512 -c diff --git a/docker/Dockerfile.build.ubuntu18 b/docker/Dockerfile.build.ubuntu18 index 7809d56216..8c1ea3556d 100644 --- a/docker/Dockerfile.build.ubuntu18 +++ b/docker/Dockerfile.build.ubuntu18 @@ -35,4 +35,4 @@ COPY . . RUN /bin/sh oaienv && \ cd cmake_targets && \ mkdir -p log && \ - ./build_oai --eNB --gNB --RU --UE --nrUE --ninja --build-lib all -w USRP --verbose-ci --noavx512 + ./build_oai --eNB --gNB --RU --UE --nrUE --ninja --build-lib all -w USRP --verbose-ci --noavx512 -c diff --git a/docker/Dockerfile.phySim.rhel8.2 b/docker/Dockerfile.phySim.rhel8.2 index b4eb9a1eeb..507b56f18d 100644 --- a/docker/Dockerfile.phySim.rhel8.2 +++ b/docker/Dockerfile.phySim.rhel8.2 @@ -38,7 +38,7 @@ RUN yum install -y libasan RUN /bin/sh oaienv && \ cd cmake_targets && \ mkdir -p log && \ - ./build_oai --phy_simulators --ninja --verbose-ci --sanitize-address --noavx512 + ./build_oai --phy_simulators --ninja --verbose-ci --sanitize-address --noavx512 -c #start from scratch for target executable FROM registry.access.redhat.com/ubi8/ubi:latest as oai-physim From e62662e46359d68a3923df7c95764b439afd7ef3 Mon Sep 17 00:00:00 2001 From: Robert Schmidt Date: Mon, 8 Aug 2022 15:50:59 +0200 Subject: [PATCH 36/88] Correct entitlements in base Dockerfile --- ci-scripts/cls_containerize.py | 7 ++++--- docker/Dockerfile.base.rhel8.2 | 8 ++++++-- 2 files changed, 10 insertions(+), 5 deletions(-) diff --git a/ci-scripts/cls_containerize.py b/ci-scripts/cls_containerize.py index edf43cd1bf..e3d5397eee 100644 --- a/ci-scripts/cls_containerize.py +++ b/ci-scripts/cls_containerize.py @@ -215,9 +215,10 @@ class Containerize(): # if asterix, copy the entitlement and subscription manager configurations if self.host == 'Red Hat': - mySSH.command('mkdir -p tmp/ca/ tmp/entitlement/', '\$', 5) - mySSH.command('sudo cp /etc/rhsm/ca/redhat-uep.pem tmp/ca/', '\$', 5) - mySSH.command('sudo cp /etc/pki/entitlement/*.pem tmp/entitlement/', '\$', 5) + mySSH.command('mkdir -p ./etc-pki-entitlement ./rhsm-conf ./rhsm-ca', '\$', 5) + mySSH.command('sudo cp /etc/rhsm/rhsm.conf ./rhsm-conf/', '\$', 5) + mySSH.command('sudo cp /etc/rhsm/ca/redhat-uep.pem ./rhsm-ca/', '\$', 5) + mySSH.command('sudo cp /etc/pki/entitlement/*.pem ./etc-pki-entitlement/', '\$', 5) baseImage = 'ran-base' baseTag = 'develop' diff --git a/docker/Dockerfile.base.rhel8.2 b/docker/Dockerfile.base.rhel8.2 index 3050f09849..5f897bd0e2 100644 --- a/docker/Dockerfile.base.rhel8.2 +++ b/docker/Dockerfile.base.rhel8.2 @@ -32,8 +32,12 @@ ENV TZ=Europe/Paris ENV BUILD_UHD_FROM_SOURCE=True ENV UHD_VERSION=3.15.0.0 -COPY tmp/ca/redhat-uep.pem /etc/rhsm/ca -COPY tmp/entitlement/*.pem /etc/pki/entitlement +# Copy the entitlements +COPY ./etc-pki-entitlement /etc/pki/entitlement + +# Copy the subscription manager configurations +COPY ./rhsm-conf /etc/rhsm +COPY ./rhsm-ca /etc/rhsm/ca #install developers pkg/repo RUN rm -f /etc/rhsm-host && \ From 02f97a15b44ee560f4f70980852d07a7ee550617 Mon Sep 17 00:00:00 2001 From: Robert Schmidt Date: Mon, 1 Aug 2022 15:11:19 +0200 Subject: [PATCH 37/88] Drop old OpenShift cluster files --- docker/Dockerfile.eNB.rhel7.oc4-4 | 83 -------------- docker/Dockerfile.eNB.rhel8.2.oc4-4 | 124 --------------------- docker/Dockerfile.gNB.rhel7.oc4-4 | 89 --------------- docker/Dockerfile.gNB.rhel8.2.oc4-4 | 128 ---------------------- docker/Dockerfile.lteUE.rhel8.2.oc4-4 | 122 --------------------- docker/Dockerfile.nrUE.rhel8.2.oc4-4 | 119 -------------------- docker/Dockerfile.ran.rhel7.oc4-4 | 74 ------------- docker/Dockerfile.ran.rhel8.2.oc4-4 | 74 ------------- docker/README.md | 4 +- openshift/oai-enb-build-config.yml | 55 ---------- openshift/oai-enb-image-stream.yml | 30 ----- openshift/oai-enb-rh8-build-config.yml | 48 -------- openshift/oai-gnb-build-config.yml | 55 ---------- openshift/oai-gnb-image-stream.yml | 30 ----- openshift/oai-gnb-rh8-build-config.yml | 48 -------- openshift/oai-gnb-rh8-image-stream.yml | 30 ----- openshift/oai-lte-ue-rh8-build-config.yml | 48 -------- openshift/oai-lte-ue-rh8-image-stream.yml | 30 ----- openshift/oai-nr-ue-rh8-build-config.yml | 48 -------- openshift/oai-nr-ue-rh8-image-stream.yml | 30 ----- openshift/oai-ran-build-config.yml | 52 --------- openshift/oai-ran-image-stream.yml | 30 ----- openshift/oai-ran-rh8-build-config.yml | 57 ---------- 23 files changed, 1 insertion(+), 1407 deletions(-) delete mode 100644 docker/Dockerfile.eNB.rhel7.oc4-4 delete mode 100644 docker/Dockerfile.eNB.rhel8.2.oc4-4 delete mode 100644 docker/Dockerfile.gNB.rhel7.oc4-4 delete mode 100644 docker/Dockerfile.gNB.rhel8.2.oc4-4 delete mode 100644 docker/Dockerfile.lteUE.rhel8.2.oc4-4 delete mode 100644 docker/Dockerfile.nrUE.rhel8.2.oc4-4 delete mode 100644 docker/Dockerfile.ran.rhel7.oc4-4 delete mode 100644 docker/Dockerfile.ran.rhel8.2.oc4-4 delete mode 100644 openshift/oai-enb-build-config.yml delete mode 100644 openshift/oai-enb-image-stream.yml delete mode 100644 openshift/oai-enb-rh8-build-config.yml delete mode 100644 openshift/oai-gnb-build-config.yml delete mode 100644 openshift/oai-gnb-image-stream.yml delete mode 100644 openshift/oai-gnb-rh8-build-config.yml delete mode 100644 openshift/oai-gnb-rh8-image-stream.yml delete mode 100644 openshift/oai-lte-ue-rh8-build-config.yml delete mode 100644 openshift/oai-lte-ue-rh8-image-stream.yml delete mode 100644 openshift/oai-nr-ue-rh8-build-config.yml delete mode 100644 openshift/oai-nr-ue-rh8-image-stream.yml delete mode 100644 openshift/oai-ran-build-config.yml delete mode 100644 openshift/oai-ran-image-stream.yml delete mode 100644 openshift/oai-ran-rh8-build-config.yml diff --git a/docker/Dockerfile.eNB.rhel7.oc4-4 b/docker/Dockerfile.eNB.rhel7.oc4-4 deleted file mode 100644 index 85c2a17ead..0000000000 --- a/docker/Dockerfile.eNB.rhel7.oc4-4 +++ /dev/null @@ -1,83 +0,0 @@ -#/* -# * 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 -# */ -#--------------------------------------------------------------------- -# -# Dockerfile for the Open-Air-Interface BUILD service -# Valid for RHEL7 in the OpenShift context (v4.4) -# -#--------------------------------------------------------------------- - -FROM image-registry.openshift-image-registry.svc:5000/oai/oai-ran:latest AS enb-build - - -WORKDIR /oai-enb -COPY . . - -#run build_oai to build the target image -RUN /bin/sh oaienv && \ - cd cmake_targets && \ - mkdir -p log && \ - ./build_oai --eNB - - -#start from scratch for target executable -FROM registry.access.redhat.com/ubi7/ubi:latest as oai-enb - -# Entitlements and RHSM configurations are Open-Shift Secret and ConfigMaps -# It is pre-requisite -RUN rm -Rf /etc/rhsm/ca /etc/pki/entitlement -# Copy the entitlements -COPY ./etc-pki-entitlement /etc/pki/entitlement -# Copy the subscription manager configurations -COPY ./rhsm-conf /etc/rhsm -COPY ./rhsm-ca /etc/rhsm/ca - - -#install developers pkg/repo -RUN rm /etc/rhsm-host && \ - # Initialize /etc/yum.repos.d/redhat.repo - # See https://access.redhat.com/solutions/1443553 - yum repolist --disablerepo=* && \ - yum-config-manager --enable rhel-7-server-optional-rpms rhel-server-rhscl-7-rpms && \ - yum update -y && \ - yum install -y \ - lksctp-tools \ - protobuf-c \ - nettle \ - libyaml && \ - echo "/usr/local/lib" > /etc/ld.so.conf.d/local-lib.conf - - -WORKDIR /opt/oai-enb/bin -COPY --from=enb-build /oai-enb/targets/bin/lte-softmodem.Rel15 . - -RUN ldd lte-softmodem.Rel15 - -#EXPOSE 2152/udp # S1U, GTP/UDP -#EXPOSE 22100/tcp # ? -#EXPOSE 36412/udp # S1C, SCTP/UDP -#EXPOSE 36422/udp # X2C, SCTP/UDP -#EXPOSE 50000/udp # IF5 / ORI (control) -#EXPOSE 50001/udp # IF5 / ECPRI (data) - -#CMD ["/opt/oai-enb/bin/lte-softmodem", "-O", "/opt/oai-enb/etc/enb.conf"] -#ENTRYPOINT ["/opt/oai-enb/bin/entrypoint.sh"] - diff --git a/docker/Dockerfile.eNB.rhel8.2.oc4-4 b/docker/Dockerfile.eNB.rhel8.2.oc4-4 deleted file mode 100644 index 03f6ec8e45..0000000000 --- a/docker/Dockerfile.eNB.rhel8.2.oc4-4 +++ /dev/null @@ -1,124 +0,0 @@ -#/* -# * 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 -# */ -#--------------------------------------------------------------------- -# -# Dockerfile for the Open-Air-Interface BUILD service -# Valid for RHEL8 in the OpenShift context (v4.4) -# -#--------------------------------------------------------------------- - -FROM image-registry.openshift-image-registry.svc:5000/oai/oai-ran:rhel8-latest AS enb-build - - -WORKDIR /oai-ran - -#run build_oai to build the target image -RUN /bin/sh oaienv && \ - cd cmake_targets && \ - rm -Rf log && \ - mkdir -p log && \ - ./build_oai --eNB --ninja -w USRP - -# debug -#RUN ldconfig -v && ldd /oai-ran/targets/bin/lte-softmodem.Rel15 -#RUN ls -ls /oai-ran/targets/bin -#RUN ls -ls /oai-ran/cmake_targets/ran_build/build/*.so - -#start from scratch for target executable -FROM registry.access.redhat.com/ubi8/ubi:latest as oai-enb - -RUN yum update -y && \ - yum install -y --enablerepo="ubi-8-codeready-builder" \ - lksctp-tools \ - nettle \ - atlas \ - net-tools \ - iproute \ - iputils \ - libyaml && \ - echo "/usr/local/lib" > /etc/ld.so.conf.d/local-lib.conf && \ - echo "/usr/local/lib64" >> /etc/ld.so.conf.d/local-lib.conf - -WORKDIR /opt/oai-enb/bin -COPY --from=enb-build /oai-ran/targets/bin/lte-softmodem.Rel15 . - -WORKDIR /usr/local/lib/ -COPY --from=enb-build /oai-ran/targets/bin/liboai_eth_transpro.so.Rel15 . -COPY --from=enb-build /oai-ran/targets/bin/librfsimulator.so.Rel15 . -COPY --from=enb-build /oai-ran/targets/bin/liboai_usrpdevif.so.Rel15 . -COPY --from=enb-build /oai-ran/targets/bin/libcoding.so . -COPY --from=enb-build /oai-ran/targets/bin/libparams_libconfig.so . -COPY --from=enb-build /oai-ran/cmake_targets/ran_build/build/libdfts.so . -COPY --from=enb-build /oai-ran/cmake_targets/ran_build/build/liboai_iqplayer.so . -RUN /bin/bash -c "ln -s /usr/local/lib/liboai_eth_transpro.so.Rel15 /usr/local/lib/liboai_transpro.so" -RUN /bin/bash -c "ln -s /usr/local/lib/liboai_usrpdevif.so.Rel15 /usr/local/lib/liboai_device.so" -RUN /bin/bash -c "ln -s /usr/local/lib/librfsimulator.so.Rel15 /usr/local/lib/librfsimulator.so" - -COPY --from=enb-build /usr/local/lib/libprotobuf-c.so.1 . - -COPY --from=enb-build /lib64/libconfig.so.9 /lib64 -COPY --from=enb-build /lib64/libblas.so.3 /lib64 -COPY --from=enb-build /lib64/liblapack.so.3 /lib64 -COPY --from=enb-build /lib64/liblapacke.so.3 /lib64 -COPY --from=enb-build /lib64/libboost_chrono.so.1.66.0 /lib64 -COPY --from=enb-build /lib64/libboost_date_time.so.1.66.0 /lib64 -COPY --from=enb-build /lib64/libboost_filesystem.so.1.66.0 /lib64 -COPY --from=enb-build /lib64/libboost_program_options.so.1.66.0 /lib64 -COPY --from=enb-build /lib64/libboost_serialization.so.1.66.0 /lib64 -COPY --from=enb-build /lib64/libboost_thread.so.1.66.0 /lib64 -COPY --from=enb-build /lib64/libboost_system.so.1.66.0 /lib64 -COPY --from=enb-build /lib64/libboost_unit_test_framework.so.1.66.0 /lib64 -COPY --from=enb-build /lib64/libboost_atomic.so.1.66.0 /lib64 -COPY --from=enb-build /lib64/libboost_timer.so.1.66.0 /lib64 -COPY --from=enb-build /usr/local/lib64/libuhd.so.4.0.0 /usr/local/lib64 - -RUN ldconfig - -#debug -RUN ldd /usr/local/lib/liboai_eth_transpro.so.Rel15 -RUN ldd /usr/local/lib/librfsimulator.so.Rel15 -RUN ldd /usr/local/lib/liboai_usrpdevif.so.Rel15 -RUN ldd /usr/local/lib/libcoding.so -RUN ldd /usr/local/lib/libparams_libconfig.so -RUN ldd /usr/local/lib/libdfts.so -RUN ldd /usr/local/lib/liboai_iqplayer.so -RUN ldd /opt/oai-enb/bin/lte-softmodem.Rel15 - -# Copy the relevant configuration files for eNB -WORKDIR /opt/oai-enb/etc -COPY --from=enb-build /oai-ran/ci-scripts/conf_files/enb.* . -COPY --from=enb-build /oai-ran/ci-scripts/conf_files/rcc.* . -COPY --from=enb-build /oai-ran/ci-scripts/conf_files/cu.* . -COPY --from=enb-build /oai-ran/ci-scripts/conf_files/du.* . -COPY --from=enb-build /oai-ran/ci-scripts/conf_files/rru.* . - -WORKDIR /opt/oai-enb - -#EXPOSE 2152/udp # S1U, GTP/UDP -#EXPOSE 22100/tcp # ? -#EXPOSE 36412/udp # S1C, SCTP/UDP -#EXPOSE 36422/udp # X2C, SCTP/UDP -#EXPOSE 50000/udp # IF5 / ORI (control) -#EXPOSE 50001/udp # IF5 / ECPRI (data) - -#CMD ["/opt/oai-enb/bin/lte-softmodem", "-O", "/opt/oai-enb/etc/enb.conf"] -#ENTRYPOINT ["/opt/oai-enb/bin/entrypoint.sh"] -CMD ["sleep", "infinity"] diff --git a/docker/Dockerfile.gNB.rhel7.oc4-4 b/docker/Dockerfile.gNB.rhel7.oc4-4 deleted file mode 100644 index 5165dd9715..0000000000 --- a/docker/Dockerfile.gNB.rhel7.oc4-4 +++ /dev/null @@ -1,89 +0,0 @@ -#/* -# * 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 -# */ -#--------------------------------------------------------------------- -# -# Dockerfile for the Open-Air-Interface BUILD service -# Valid for RHEL7 in the OpenShift context (v4.4) -# -#--------------------------------------------------------------------- - -FROM image-registry.openshift-image-registry.svc:5000/oai/oai-ran:latest AS gnb-build - - -WORKDIR /oai-gnb -COPY . . - -#run build_oai to build the target image -RUN /bin/sh oaienv && \ - cd cmake_targets && \ - mkdir -p log && \ - ./build_oai --gNB - - -#start from scratch for target executable -FROM registry.access.redhat.com/ubi7/ubi:latest as oai-gnb - -# Entitlements and RHSM configurations are Open-Shift Secret and ConfigMaps -# It is pre-requisite -RUN rm -Rf /etc/rhsm/ca /etc/pki/entitlement -# Copy the entitlements -COPY ./etc-pki-entitlement /etc/pki/entitlement -# Copy the subscription manager configurations -COPY ./rhsm-conf /etc/rhsm -COPY ./rhsm-ca /etc/rhsm/ca - - -#install developers pkg/repo -RUN rm /etc/rhsm-host && \ - # Initialize /etc/yum.repos.d/redhat.repo - # See https://access.redhat.com/solutions/1443553 - yum repolist --disablerepo=* && \ - yum-config-manager --enable rhel-7-server-optional-rpms rhel-server-rhscl-7-rpms && \ - yum update -y && \ - yum install -y \ - libXpm \ - libX11 \ - atlas \ - blas \ - lapack \ - lksctp-tools \ - protobuf-c \ - nettle \ - libyaml && \ - echo "/usr/local/lib" > /etc/ld.so.conf.d/local-lib.conf - -WORKDIR /opt/oai-gnb/bin -COPY --from=gnb-build /oai-gnb/targets/bin/nr-softmodem.Rel15 . -WORKDIR /lib64 -COPY --from=gnb-build /lib64/libforms.so.2 . - -RUN ldd /opt/oai-gnb/bin/nr-softmodem.Rel15 - -#EXPOSE 2152/udp # S1U, GTP/UDP -#EXPOSE 22100/tcp # ? -#EXPOSE 36412/udp # S1C, SCTP/UDP -#EXPOSE 36422/udp # X2C, SCTP/UDP -#EXPOSE 50000/udp # IF5 / ORI (control) -#EXPOSE 50001/udp # IF5 / ECPRI (data) - -#CMD ["/opt/oai-gnb/bin/nr-softmodem", "-O", "/opt/oai-gnb/etc/gnb.conf"] -#ENTRYPOINT ["/opt/oai-gnb/bin/entrypoint.sh"] - diff --git a/docker/Dockerfile.gNB.rhel8.2.oc4-4 b/docker/Dockerfile.gNB.rhel8.2.oc4-4 deleted file mode 100644 index 6c88d3ad8e..0000000000 --- a/docker/Dockerfile.gNB.rhel8.2.oc4-4 +++ /dev/null @@ -1,128 +0,0 @@ -#/* -# * 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 -# */ -#--------------------------------------------------------------------- -# -# Dockerfile for the Open-Air-Interface BUILD service -# Valid for RHEL8 in the OpenShift context (v4.4) -# -#--------------------------------------------------------------------- - -FROM image-registry.openshift-image-registry.svc:5000/oai/oai-ran:rhel8-latest AS gnb-build - - -WORKDIR /oai-ran - -#run build_oai to build the target image -RUN /bin/sh oaienv && \ - cd cmake_targets && \ - rm -Rf log && \ - mkdir -p log && \ - ./build_oai --gNB --ninja -w USRP - -#debug -#RUN ldconfig -v -#RUN ldd /oai-ran/targets/bin/nr-softmodem.Rel15 -#RUN ls -lst /oai-ran/targets/bin -#RUN ls -lst /oai-ran/cmake_targets/ran_build/build/*.so - -#start from scratch for target executable -FROM registry.access.redhat.com/ubi8/ubi:latest as oai-gnb - -RUN yum repolist --disablerepo=* && \ - yum update -y && \ - yum install -y --enablerepo="ubi-8-codeready-builder" \ - libXpm \ - libX11 \ - atlas \ - lksctp-tools \ - nettle \ - net-tools \ - iputils \ - libyaml && \ - echo "/usr/local/lib" > /etc/ld.so.conf.d/local-lib.conf && \ - echo "/usr/local/lib64" >> /etc/ld.so.conf.d/local-lib.conf - -WORKDIR /opt/oai-gnb/bin -COPY --from=gnb-build /oai-ran/targets/bin/nr-softmodem.Rel15 . - -WORKDIR /usr/local/lib/ -COPY --from=gnb-build /oai-ran/targets/bin/liboai_eth_transpro.so.Rel15 . -COPY --from=gnb-build /oai-ran/targets/bin/librfsimulator.so.Rel15 . -COPY --from=gnb-build /oai-ran/targets/bin/liboai_usrpdevif.so.Rel15 . -COPY --from=gnb-build /oai-ran/targets/bin/libcoding.so . -COPY --from=gnb-build /oai-ran/targets/bin/libparams_libconfig.so . -COPY --from=gnb-build /oai-ran/cmake_targets/ran_build/build/libdfts.so . -COPY --from=gnb-build /oai-ran/cmake_targets/ran_build/build/libldpc.so . -COPY --from=gnb-build /oai-ran/cmake_targets/ran_build/build/libldpc_optim.so . -COPY --from=gnb-build /oai-ran/cmake_targets/ran_build/build/libldpc_optim8seg.so . -COPY --from=gnb-build /oai-ran/cmake_targets/ran_build/build/libldpc_orig.so . - -RUN /bin/bash -c "ln -s /usr/local/lib/liboai_eth_transpro.so.Rel15 /usr/local/lib/liboai_transpro.so" -RUN /bin/bash -c "ln -s /usr/local/lib/liboai_usrpdevif.so.Rel15 /usr/local/lib/liboai_device.so" -RUN /bin/bash -c "ln -s /usr/local/lib/librfsimulator.so.Rel15 /usr/local/lib/librfsimulator.so" -COPY --from=gnb-build /usr/local/lib/libprotobuf-c.so.1 . - -COPY --from=gnb-build /lib64/libconfig.so.9 /lib64 -COPY --from=gnb-build /lib64/libforms.so.2 /lib64 -COPY --from=gnb-build /lib64/libblas.so.3 /lib64 -COPY --from=gnb-build /lib64/liblapack.so.3 /lib64 -COPY --from=gnb-build /lib64/liblapacke.so.3 /lib64 -COPY --from=gnb-build /lib64/libboost_chrono.so.1.66.0 /lib64 -COPY --from=gnb-build /lib64/libboost_date_time.so.1.66.0 /lib64 -COPY --from=gnb-build /lib64/libboost_filesystem.so.1.66.0 /lib64 -COPY --from=gnb-build /lib64/libboost_program_options.so.1.66.0 /lib64 -COPY --from=gnb-build /lib64/libboost_serialization.so.1.66.0 /lib64 -COPY --from=gnb-build /lib64/libboost_thread.so.1.66.0 /lib64 -COPY --from=gnb-build /lib64/libboost_system.so.1.66.0 /lib64 -COPY --from=gnb-build /lib64/libboost_unit_test_framework.so.1.66.0 /lib64 -COPY --from=gnb-build /lib64/libboost_atomic.so.1.66.0 /lib64 -COPY --from=gnb-build /lib64/libboost_timer.so.1.66.0 /lib64 -COPY --from=gnb-build /usr/local/lib64/libuhd.so.4.0.0 /usr/local/lib64 - -RUN ldconfig -#debug -RUN ldd /opt/oai-gnb/bin/nr-softmodem.Rel15 -RUN ldd /usr/local/lib/liboai_eth_transpro.so.Rel15 -RUN ldd /usr/local/lib/librfsimulator.so.Rel15 -RUN ldd /usr/local/lib/liboai_usrpdevif.so.Rel15 -RUN ldd /usr/local/lib/libcoding.so -RUN ldd /usr/local/lib/libparams_libconfig.so -RUN ldd /usr/local/lib/libdfts.so -RUN ldd /usr/local/lib/libldpc.so -RUN ldd /usr/local/lib/libldpc_optim.so -RUN ldd /usr/local/lib/libldpc_optim8seg.so -RUN ldd /usr/local/lib/libldpc_orig.so - -# Copy the relevant configuration files for gNB -WORKDIR /opt/oai-gnb/etc -COPY --from=gnb-build /oai-ran/ci-scripts/conf_files/gnb.* . - -WORKDIR /opt/oai-gnb -#EXPOSE 2152/udp # S1U, GTP/UDP -#EXPOSE 22100/tcp # ? -#EXPOSE 36412/udp # S1C, SCTP/UDP -#EXPOSE 36422/udp # X2C, SCTP/UDP -#EXPOSE 50000/udp # IF5 / ORI (control) -#EXPOSE 50001/udp # IF5 / ECPRI (data) - -#CMD ["/opt/oai-gnb/bin/nr-softmodem", "-O", "/opt/oai-gnb/etc/gnb.conf"] -#ENTRYPOINT ["/opt/oai-gnb/bin/entrypoint.sh"] -CMD ["sleep", "infinity"] diff --git a/docker/Dockerfile.lteUE.rhel8.2.oc4-4 b/docker/Dockerfile.lteUE.rhel8.2.oc4-4 deleted file mode 100644 index cc492882f5..0000000000 --- a/docker/Dockerfile.lteUE.rhel8.2.oc4-4 +++ /dev/null @@ -1,122 +0,0 @@ -#/* -# * 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 -# */ -#--------------------------------------------------------------------- -# -# Dockerfile for the Open-Air-Interface BUILD service -# Valid for RHEL8 in the OpenShift context (v4.4) -# -#--------------------------------------------------------------------- - -FROM image-registry.openshift-image-registry.svc:5000/oai/oai-ran:rhel8-latest AS lte-ue-build - - -WORKDIR /oai-ran - -#run build_oai to build the target image -RUN /bin/sh oaienv && \ - cd cmake_targets && \ - rm -Rf log && \ - mkdir -p log && \ - ./build_oai --UE --ninja -w USRP - -# debug -#RUN ldconfig -v && ldd /oai-ran/targets/bin/lte-uesoftmodem.Rel15 -#RUN ls -lst /oai-ran/targets/bin -#RUN ls -lst /oai-ran/cmake_targets/ran_build/build/*.so - -#start from scratch for target executable -FROM registry.access.redhat.com/ubi8/ubi:latest as oai-lte-ue - -RUN yum update -y && \ - yum install -y --enablerepo="ubi-8-codeready-builder" \ - lksctp-tools \ - nettle \ - atlas \ - iproute \ - net-tools \ - iputils \ - libyaml && \ - echo "/usr/local/lib" > /etc/ld.so.conf.d/local-lib.conf && \ - echo "/usr/local/lib64" >> /etc/ld.so.conf.d/local-lib.conf - -WORKDIR /opt/oai-lte-ue/bin -COPY --from=lte-ue-build /oai-ran/targets/bin/lte-uesoftmodem.Rel15 . -COPY --from=lte-ue-build /oai-ran/targets/bin/conf2uedata . -COPY --from=lte-ue-build /oai-ran/targets/bin/nvram . -COPY --from=lte-ue-build /oai-ran/targets/bin/usim . -COPY --from=lte-ue-build /oai-ran/targets/bin/.ue_emm.nvram0 . -COPY --from=lte-ue-build /oai-ran/targets/bin/.ue.nvram0 . -COPY --from=lte-ue-build /oai-ran/targets/bin/.usim.nvram0 . - -WORKDIR /usr/local/lib/ -COPY --from=lte-ue-build /oai-ran/targets/bin/liboai_eth_transpro.so.Rel15 . -COPY --from=lte-ue-build /oai-ran/targets/bin/librfsimulator.so.Rel15 . -COPY --from=lte-ue-build /oai-ran/targets/bin/liboai_usrpdevif.so.Rel15 . -COPY --from=lte-ue-build /oai-ran/targets/bin/libcoding.so . -COPY --from=lte-ue-build /oai-ran/targets/bin/libparams_libconfig.so . -COPY --from=lte-ue-build /oai-ran/cmake_targets/ran_build/build/libSIMU.so . -COPY --from=lte-ue-build /oai-ran/cmake_targets/ran_build/build/libdfts.so . -RUN /bin/bash -c "ln -s /usr/local/lib/liboai_eth_transpro.so.Rel15 /usr/local/lib/liboai_transpro.so" -RUN /bin/bash -c "ln -s /usr/local/lib/liboai_usrpdevif.so.Rel15 /usr/local/lib/liboai_device.so" -RUN /bin/bash -c "ln -s /usr/local/lib/librfsimulator.so.Rel15 /usr/local/lib/librfsimulator.so" - -COPY --from=lte-ue-build /usr/local/lib/libprotobuf-c.so.1 . - -COPY --from=lte-ue-build /lib64/libconfig.so.9 /lib64 -COPY --from=lte-ue-build /lib64/libblas.so.3 /lib64 -COPY --from=lte-ue-build /lib64/liblapack.so.3 /lib64 -COPY --from=lte-ue-build /lib64/liblapacke.so.3 /lib64 -COPY --from=lte-ue-build /lib64/libboost_chrono.so.1.66.0 /lib64 -COPY --from=lte-ue-build /lib64/libboost_date_time.so.1.66.0 /lib64 -COPY --from=lte-ue-build /lib64/libboost_filesystem.so.1.66.0 /lib64 -COPY --from=lte-ue-build /lib64/libboost_program_options.so.1.66.0 /lib64 -COPY --from=lte-ue-build /lib64/libboost_serialization.so.1.66.0 /lib64 -COPY --from=lte-ue-build /lib64/libboost_thread.so.1.66.0 /lib64 -COPY --from=lte-ue-build /lib64/libboost_system.so.1.66.0 /lib64 -COPY --from=lte-ue-build /lib64/libboost_unit_test_framework.so.1.66.0 /lib64 -COPY --from=lte-ue-build /lib64/libboost_atomic.so.1.66.0 /lib64 -COPY --from=lte-ue-build /lib64/libboost_timer.so.1.66.0 /lib64 -COPY --from=lte-ue-build /usr/local/lib64/libuhd.so.4.0.0 /usr/local/lib64 - -RUN ldconfig - -#debug -RUN ldd /opt/oai-lte-ue/bin/lte-uesoftmodem.Rel15 -RUN ldd /opt/oai-lte-ue/bin/conf2uedata -RUN ldd /opt/oai-lte-ue/bin/nvram -RUN ldd /opt/oai-lte-ue/bin/usim -RUN ldd /usr/local/lib/liboai_eth_transpro.so.Rel15 -RUN ldd /usr/local/lib/librfsimulator.so.Rel15 -RUN ldd /usr/local/lib/liboai_usrpdevif.so.Rel15 -RUN ldd /usr/local/lib/libcoding.so -RUN ldd /usr/local/lib/libparams_libconfig.so -RUN ldd /usr/local/lib/libSIMU.so -RUN ldd /usr/local/lib/libdfts.so - -# Copy the relevant configuration files for eNB -WORKDIR /opt/oai-lte-ue/etc -COPY --from=lte-ue-build /oai-ran/ci-scripts/conf_files/ue.* . -COPY --from=lte-ue-build /oai-ran/openair3/NAS/TOOLS/ue_eurecom_test_sfr.conf ./ue_usim.conf - -WORKDIR /opt/oai-lte-ue -#CMD ["/opt/oai-lte-ue/bin/lte-uesoftmodem", "-O", "/opt/oai-lte-ue/etc/enb.conf"] -#ENTRYPOINT ["/opt/oai-lte-ue/bin/entrypoint.sh"] -CMD ["sleep", "infinity"] diff --git a/docker/Dockerfile.nrUE.rhel8.2.oc4-4 b/docker/Dockerfile.nrUE.rhel8.2.oc4-4 deleted file mode 100644 index 2d018c96af..0000000000 --- a/docker/Dockerfile.nrUE.rhel8.2.oc4-4 +++ /dev/null @@ -1,119 +0,0 @@ -#/* -# * 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 -# */ -#--------------------------------------------------------------------- -# -# Dockerfile for the Open-Air-Interface BUILD service -# Valid for RHEL8 in the OpenShift context (v4.4) -# -#--------------------------------------------------------------------- - -FROM image-registry.openshift-image-registry.svc:5000/oai/oai-ran:rhel8-latest AS nr-ue-build - - -WORKDIR /oai-ran - -#run build_oai to build the target image -RUN /bin/sh oaienv && \ - cd cmake_targets && \ - rm -Rf log && \ - mkdir -p log && \ - ./build_oai --nrUE --ninja -w USRP - -# debug -#RUN ldconfig -v -#RUN ldd /oai-ran/targets/bin/nr-uesoftmodem.Rel15 -#RUN ls -lst /oai-ran/targets/bin -#RUN ls -lst /oai-ran/cmake_targets/ran_build/build/*.so - -#start from scratch for target executable -FROM registry.access.redhat.com/ubi8/ubi:latest as oai-nr-ue - -RUN yum update -y && \ - yum install -y --enablerepo="ubi-8-codeready-builder" \ - lksctp-tools \ - nettle \ - net-tools \ - iputils \ - atlas \ - libXpm \ - libX11 \ - libyaml && \ - echo "/usr/local/lib" > /etc/ld.so.conf.d/local-lib.conf && \ - echo "/usr/local/lib64" >> /etc/ld.so.conf.d/local-lib.conf - -WORKDIR /opt/oai-nr-ue/bin -COPY --from=nr-ue-build /oai-ran/targets/bin/nr-uesoftmodem.Rel15 . - -WORKDIR /usr/local/lib/ -COPY --from=nr-ue-build /oai-ran/targets/bin/liboai_eth_transpro.so.Rel15 . -COPY --from=nr-ue-build /oai-ran/targets/bin/librfsimulator.so.Rel15 . -COPY --from=nr-ue-build /oai-ran/targets/bin/liboai_usrpdevif.so.Rel15 . -COPY --from=nr-ue-build /oai-ran/targets/bin/libcoding.so . -COPY --from=nr-ue-build /oai-ran/targets/bin/libparams_libconfig.so . -COPY --from=nr-ue-build /oai-ran/cmake_targets/ran_build/build/libdfts.so . -COPY --from=nr-ue-build /oai-ran/cmake_targets/ran_build/build/libldpc.so . -COPY --from=nr-ue-build /oai-ran/cmake_targets/ran_build/build/libldpc_optim.so . -COPY --from=nr-ue-build /oai-ran/cmake_targets/ran_build/build/libldpc_optim8seg.so . -COPY --from=nr-ue-build /oai-ran/cmake_targets/ran_build/build/libldpc_orig.so . -RUN /bin/bash -c "ln -s /usr/local/lib/liboai_eth_transpro.so.Rel15 /usr/local/lib/liboai_transpro.so" -RUN /bin/bash -c "ln -s /usr/local/lib/liboai_usrpdevif.so.Rel15 /usr/local/lib/liboai_device.so" -RUN /bin/bash -c "ln -s /usr/local/lib/librfsimulator.so.Rel15 /usr/local/lib/librfsimulator.so" - -COPY --from=nr-ue-build /usr/local/lib/libprotobuf-c.so.1 . - -COPY --from=nr-ue-build /lib64/libconfig.so.9 /lib64 -COPY --from=nr-ue-build /lib64/libblas.so.3 /lib64 -COPY --from=nr-ue-build /lib64/liblapack.so.3 /lib64 -COPY --from=nr-ue-build /lib64/liblapacke.so.3 /lib64 -COPY --from=nr-ue-build /lib64/libforms.so.2 /lib64 -COPY --from=nr-ue-build /lib64/libboost_chrono.so.1.66.0 /lib64 -COPY --from=nr-ue-build /lib64/libboost_date_time.so.1.66.0 /lib64 -COPY --from=nr-ue-build /lib64/libboost_filesystem.so.1.66.0 /lib64 -COPY --from=nr-ue-build /lib64/libboost_program_options.so.1.66.0 /lib64 -COPY --from=nr-ue-build /lib64/libboost_serialization.so.1.66.0 /lib64 -COPY --from=nr-ue-build /lib64/libboost_thread.so.1.66.0 /lib64 -COPY --from=nr-ue-build /lib64/libboost_system.so.1.66.0 /lib64 -COPY --from=nr-ue-build /lib64/libboost_unit_test_framework.so.1.66.0 /lib64 -COPY --from=nr-ue-build /lib64/libboost_atomic.so.1.66.0 /lib64 -COPY --from=nr-ue-build /lib64/libboost_timer.so.1.66.0 /lib64 -COPY --from=nr-ue-build /usr/local/lib64/libuhd.so.4.0.0 /usr/local/lib64 - -RUN ldconfig -RUN ldd /opt/oai-nr-ue/bin/nr-uesoftmodem.Rel15 -RUN ldd /usr/local/lib/liboai_eth_transpro.so.Rel15 -RUN ldd /usr/local/lib/librfsimulator.so.Rel15 -RUN ldd /usr/local/lib/liboai_usrpdevif.so.Rel15 -RUN ldd /usr/local/lib/libcoding.so -RUN ldd /usr/local/lib/libparams_libconfig.so -RUN ldd /usr/local/lib/libdfts.so -RUN ldd /usr/local/lib/libldpc.so -RUN ldd /usr/local/lib/libldpc_optim.so -RUN ldd /usr/local/lib/libldpc_optim8seg.so -RUN ldd /usr/local/lib/libldpc_orig.so - -# 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.* . - -WORKDIR /opt/oai-nr-ue -#CMD ["/opt/oai-nr-ue/bin/nr-uesoftmodem", "-O", "/opt/oai-nr-ue/etc/enb.conf"] -#ENTRYPOINT ["/opt/oai-nr-ue/bin/entrypoint.sh"] -CMD ["sleep", "infinity"] diff --git a/docker/Dockerfile.ran.rhel7.oc4-4 b/docker/Dockerfile.ran.rhel7.oc4-4 deleted file mode 100644 index 2f0423801a..0000000000 --- a/docker/Dockerfile.ran.rhel7.oc4-4 +++ /dev/null @@ -1,74 +0,0 @@ -#/* -# * 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 -# */ -#--------------------------------------------------------------------- -# -# Dockerfile for the Open-Air-Interface BUILD service -# Valid for RHEL7 in the OpenShift context (v4.4) -# -#--------------------------------------------------------------------- - - -FROM registry.access.redhat.com/ubi7/ubi:latest AS ran-base - -# Entitlements and RHSM configurations are Open-Shift Secret and ConfigMaps -# It is pre-requisite -RUN rm -Rf /etc/rhsm/ca /etc/pki/entitlement -# Copy the entitlements -COPY ./etc-pki-entitlement /etc/pki/entitlement -# Copy the subscription manager configurations -COPY ./rhsm-conf /etc/rhsm -COPY ./rhsm-ca /etc/rhsm/ca - - -#install developers pkg/repo -RUN rm /etc/rhsm-host && \ - # Initialize /etc/yum.repos.d/redhat.repo - # See https://access.redhat.com/solutions/1443553 - yum repolist --disablerepo=* && \ - yum-config-manager --enable rhel-7-server-optional-rpms rhel-server-rhscl-7-rpms && \ - yum update -y && \ - yum install -y \ - #gcc needed for build_oai - gcc gcc-c++ \ - diffutils \ - file \ - psmisc \ - git \ - #unzip is needed for protobuf - unzip && \ - echo "/usr/local/lib" > /etc/ld.so.conf.d/local-lib.conf - -# In some network environments, GIT proxy is required -RUN /bin/bash -c "if [[ -v NEEDED_GIT_PROXY ]]; then git config --global http.proxy $NEEDED_GIT_PROXY; fi" - -#create the WORKDIR -WORKDIR /oai-ran -COPY . . - -#run build_oai -I to get the builder image -RUN /bin/sh oaienv && \ - cd cmake_targets && \ - mkdir -p log && \ - ./build_oai -I - -#as the image is public, we need to remove the subscription manager configurations -#RUN rm -Rf /etc/rhsm /etc/pki/entitlement - diff --git a/docker/Dockerfile.ran.rhel8.2.oc4-4 b/docker/Dockerfile.ran.rhel8.2.oc4-4 deleted file mode 100644 index 93af2b0e37..0000000000 --- a/docker/Dockerfile.ran.rhel8.2.oc4-4 +++ /dev/null @@ -1,74 +0,0 @@ -#/* -# * 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 -# */ -#--------------------------------------------------------------------- -# -# Dockerfile for the Open-Air-Interface BUILD service -# Valid for RHEL8 in the OpenShift context (v4.4) -# -#--------------------------------------------------------------------- - - -FROM registry.access.redhat.com/ubi8/ubi:latest AS ran-base - -# Entitlements and RHSM configurations are Open-Shift Secret and ConfigMaps -# It is pre-requisite -RUN rm -Rf /etc/rhsm/ca /etc/pki/entitlement -# Copy the entitlements -COPY ./etc-pki-entitlement /etc/pki/entitlement -# Copy the subscription manager configurations -COPY ./rhsm-conf /etc/rhsm -COPY ./rhsm-ca /etc/rhsm/ca - -#install developers pkg/repo -RUN rm /etc/rhsm-host && \ - # Initialize /etc/yum.repos.d/redhat.repo - # See https://access.redhat.com/solutions/1443553 - yum repolist --disablerepo=* && \ - subscription-manager repos --enable codeready-builder-for-rhel-8-x86_64-rpms && \ - yum update -y && \ - yum install -y \ - #gcc needed for build_oai - gcc gcc-c++ \ - diffutils \ - file \ - psmisc \ - git \ - #unzip is needed for protobuf - unzip && \ - echo "/usr/local/lib" > /etc/ld.so.conf.d/local-lib.conf && \ - echo "/usr/local/lib64" >> /etc/ld.so.conf.d/local-lib.conf - -# In some network environments, GIT proxy is required -RUN /bin/bash -c "if [[ -v NEEDED_GIT_PROXY ]]; then git config --global http.proxy $NEEDED_GIT_PROXY; fi" - -#create the WORKDIR -WORKDIR /oai-ran -COPY . . - -#run build_oai -I to get the builder image -RUN /bin/sh oaienv && \ - cd cmake_targets && \ - mkdir -p log && \ - ./build_oai -I -w USRP - -#as the image is public, we need to remove the subscription certificates -RUN rm -Rf /etc/pki/entitlement/*.pem - diff --git a/docker/README.md b/docker/README.md index 85f553c721..7844b46bce 100644 --- a/docker/README.md +++ b/docker/README.md @@ -78,9 +78,7 @@ The currently-supported OS are: The currently-supported cluster version is: -- `rhel8.2.oc4-4` - -We have also `rhel7.oc4-4` support but it will be discontinued soon. +- `rhel8.2.oc4-9` For more details in build within a Openshift Cluster, see [OpenShift README](../openshift/README.md) for more details. diff --git a/openshift/oai-enb-build-config.yml b/openshift/oai-enb-build-config.yml deleted file mode 100644 index 3f6875c50d..0000000000 --- a/openshift/oai-enb-build-config.yml +++ /dev/null @@ -1,55 +0,0 @@ -#/* -# * 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 -# */ -#--------------------------------------------------------------------- -# -kind: BuildConfig -apiVersion: build.openshift.io/v1 -metadata: - name: "oai-enb-build-config" -spec: - runPolicy: "Serial" - source: - #still needed for the target image - git: - uri: "https://gitlab.eurecom.fr/oai/openairinterface5g.git" - ref: "develop" - httpProxy: http://proxy.eurecom.fr:8080 - httpsProxy: https://proxy.eurecom.fr:8080 - secrets: - - secret: - name: etc-pki-entitlement - destinationDir: etc-pki-entitlement - configMaps: - - configMap: - name: rhsm-conf - destinationDir: rhsm-conf - - configMap: - name: rhsm-ca - destinationDir: rhsm-ca - - strategy: - #using both builder image and target image docker - dockerStrategy: - dockerfilePath: "docker/Dockerfile.eNB.rhel7.oc4-4" - output: - to: - kind: "ImageStreamTag" - name: "oai-enb:latest" diff --git a/openshift/oai-enb-image-stream.yml b/openshift/oai-enb-image-stream.yml deleted file mode 100644 index 94ee13e50f..0000000000 --- a/openshift/oai-enb-image-stream.yml +++ /dev/null @@ -1,30 +0,0 @@ -#/* -# * 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 -# */ -#--------------------------------------------------------------------- -# -apiVersion: v1 -kind: ImageStream -metadata: - name: oai-enb - namespace: oai -status: - tag: latest - diff --git a/openshift/oai-enb-rh8-build-config.yml b/openshift/oai-enb-rh8-build-config.yml deleted file mode 100644 index e715fc5733..0000000000 --- a/openshift/oai-enb-rh8-build-config.yml +++ /dev/null @@ -1,48 +0,0 @@ -#/* -# * 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 -# */ -#--------------------------------------------------------------------- -# -kind: BuildConfig -apiVersion: build.openshift.io/v1 -metadata: - name: "oai-enb-rh8-build-config" -spec: - runPolicy: "Serial" - source: - #still needed for the target image - git: - uri: "https://gitlab.eurecom.fr/oai/openairinterface5g.git" - ref: "develop" - httpProxy: http://proxy.eurecom.fr:8080 - httpsProxy: https://proxy.eurecom.fr:8080 - strategy: - #using both builder image and target image docker - dockerStrategy: - dockerfilePath: "docker/Dockerfile.eNB.rhel8.2.oc4-4" - nodeSelector: - kubernetes.io/hostname: dedale.5glab.nsa.eurecom.fr - resources: - requests: - ephemeral-storage: "8Gi" - output: - to: - kind: "ImageStreamTag" - name: "oai-enb:rhel8-latest" diff --git a/openshift/oai-gnb-build-config.yml b/openshift/oai-gnb-build-config.yml deleted file mode 100644 index b0c99959d1..0000000000 --- a/openshift/oai-gnb-build-config.yml +++ /dev/null @@ -1,55 +0,0 @@ -#/* -# * 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 -# */ -#--------------------------------------------------------------------- -# -kind: BuildConfig -apiVersion: build.openshift.io/v1 -metadata: - name: "oai-gnb-build-config" -spec: - runPolicy: "Serial" - source: - #still needed for the target image - git: - uri: "https://gitlab.eurecom.fr/oai/openairinterface5g.git" - ref: "develop" - httpProxy: http://proxy.eurecom.fr:8080 - httpsProxy: https://proxy.eurecom.fr:8080 - secrets: - - secret: - name: etc-pki-entitlement - destinationDir: etc-pki-entitlement - configMaps: - - configMap: - name: rhsm-conf - destinationDir: rhsm-conf - - configMap: - name: rhsm-ca - destinationDir: rhsm-ca - - strategy: - #using both builder image and target image docker - dockerStrategy: - dockerfilePath: "docker/Dockerfile.gNB.rhel7.oc4-4" - output: - to: - kind: "ImageStreamTag" - name: "oai-gnb:latest" diff --git a/openshift/oai-gnb-image-stream.yml b/openshift/oai-gnb-image-stream.yml deleted file mode 100644 index 22a6c157d2..0000000000 --- a/openshift/oai-gnb-image-stream.yml +++ /dev/null @@ -1,30 +0,0 @@ -#/* -# * 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 -# */ -#--------------------------------------------------------------------- -# -apiVersion: v1 -kind: ImageStream -metadata: - name: oai-gnb - namespace: oai -status: - tag: latest - diff --git a/openshift/oai-gnb-rh8-build-config.yml b/openshift/oai-gnb-rh8-build-config.yml deleted file mode 100644 index aa3553c1e4..0000000000 --- a/openshift/oai-gnb-rh8-build-config.yml +++ /dev/null @@ -1,48 +0,0 @@ -#/* -# * 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 -# */ -#--------------------------------------------------------------------- -# -kind: BuildConfig -apiVersion: build.openshift.io/v1 -metadata: - name: "oai-gnb-rh8-build-config" -spec: - runPolicy: "Serial" - source: - #still needed for the target image - git: - uri: "https://gitlab.eurecom.fr/oai/openairinterface5g.git" - ref: "develop" - httpProxy: http://proxy.eurecom.fr:8080 - httpsProxy: https://proxy.eurecom.fr:8080 - strategy: - #using both builder image and target image docker - dockerStrategy: - dockerfilePath: "docker/Dockerfile.gNB.rhel8.2.oc4-4" - nodeSelector: - kubernetes.io/hostname: dedale.5glab.nsa.eurecom.fr - resources: - requests: - ephemeral-storage: "15Gi" - output: - to: - kind: "ImageStreamTag" - name: "oai-gnb:rhel8-latest" diff --git a/openshift/oai-gnb-rh8-image-stream.yml b/openshift/oai-gnb-rh8-image-stream.yml deleted file mode 100644 index 2e04e94f5b..0000000000 --- a/openshift/oai-gnb-rh8-image-stream.yml +++ /dev/null @@ -1,30 +0,0 @@ -#/* -# * 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 -# */ -#--------------------------------------------------------------------- -# -apiVersion: v1 -kind: ImageStream -metadata: - name: oai-gnb - namespace: oai -status: - tag: rhel8-latest - diff --git a/openshift/oai-lte-ue-rh8-build-config.yml b/openshift/oai-lte-ue-rh8-build-config.yml deleted file mode 100644 index f077e4cb26..0000000000 --- a/openshift/oai-lte-ue-rh8-build-config.yml +++ /dev/null @@ -1,48 +0,0 @@ -#/* -# * 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 -# */ -#--------------------------------------------------------------------- -# -kind: BuildConfig -apiVersion: build.openshift.io/v1 -metadata: - name: "oai-lte-ue-rh8-build-config" -spec: - runPolicy: "Serial" - source: - #still needed for the target image - git: - uri: "https://gitlab.eurecom.fr/oai/openairinterface5g.git" - ref: "develop" - httpProxy: http://proxy.eurecom.fr:8080 - httpsProxy: https://proxy.eurecom.fr:8080 - strategy: - #using both builder image and target image docker - dockerStrategy: - dockerfilePath: "docker/Dockerfile.lteUE.rhel8.2.oc4-4" - nodeSelector: - kubernetes.io/hostname: dedale.5glab.nsa.eurecom.fr - resources: - requests: - ephemeral-storage: "8Gi" - output: - to: - kind: "ImageStreamTag" - name: "oai-lte-ue:rhel8-latest" diff --git a/openshift/oai-lte-ue-rh8-image-stream.yml b/openshift/oai-lte-ue-rh8-image-stream.yml deleted file mode 100644 index 09aeb2a766..0000000000 --- a/openshift/oai-lte-ue-rh8-image-stream.yml +++ /dev/null @@ -1,30 +0,0 @@ -#/* -# * 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 -# */ -#--------------------------------------------------------------------- -# -apiVersion: v1 -kind: ImageStream -metadata: - name: oai-lte-ue - namespace: oai -status: - tag: rhel8-latest - diff --git a/openshift/oai-nr-ue-rh8-build-config.yml b/openshift/oai-nr-ue-rh8-build-config.yml deleted file mode 100644 index b3367f6ab6..0000000000 --- a/openshift/oai-nr-ue-rh8-build-config.yml +++ /dev/null @@ -1,48 +0,0 @@ -#/* -# * 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 -# */ -#--------------------------------------------------------------------- -# -kind: BuildConfig -apiVersion: build.openshift.io/v1 -metadata: - name: "oai-nr-ue-rh8-build-config" -spec: - runPolicy: "Serial" - source: - #still needed for the target image - git: - uri: "https://gitlab.eurecom.fr/oai/openairinterface5g.git" - ref: "develop" - httpProxy: http://proxy.eurecom.fr:8080 - httpsProxy: https://proxy.eurecom.fr:8080 - strategy: - #using both builder image and target image docker - dockerStrategy: - dockerfilePath: "docker/Dockerfile.nrUE.rhel8.2.oc4-4" - nodeSelector: - kubernetes.io/hostname: dedale.5glab.nsa.eurecom.fr - resources: - requests: - ephemeral-storage: "8Gi" - output: - to: - kind: "ImageStreamTag" - name: "oai-nr-ue:rhel8-latest" diff --git a/openshift/oai-nr-ue-rh8-image-stream.yml b/openshift/oai-nr-ue-rh8-image-stream.yml deleted file mode 100644 index e61cc0dfde..0000000000 --- a/openshift/oai-nr-ue-rh8-image-stream.yml +++ /dev/null @@ -1,30 +0,0 @@ -#/* -# * 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 -# */ -#--------------------------------------------------------------------- -# -apiVersion: v1 -kind: ImageStream -metadata: - name: oai-nr-ue - namespace: oai -status: - tag: rhel8-latest - diff --git a/openshift/oai-ran-build-config.yml b/openshift/oai-ran-build-config.yml deleted file mode 100644 index 39d7a40f6d..0000000000 --- a/openshift/oai-ran-build-config.yml +++ /dev/null @@ -1,52 +0,0 @@ -#/* -# * 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 -# */ -#--------------------------------------------------------------------- -# -kind: BuildConfig -apiVersion: build.openshift.io/v1 -metadata: - name: "oai-ran-build-config" -spec: - runPolicy: "Serial" - source: - git: - uri: "https://gitlab.eurecom.fr/oai/openairinterface5g.git" - ref: "develop" - httpProxy: http://proxy.eurecom.fr:8080 - httpsProxy: https://proxy.eurecom.fr:8080 - secrets: - - secret: - name: etc-pki-entitlement - destinationDir: etc-pki-entitlement - configMaps: - - configMap: - name: rhsm-conf - destinationDir: rhsm-conf - - configMap: - name: rhsm-ca - destinationDir: rhsm-ca - strategy: - dockerStrategy: - dockerfilePath: "docker/Dockerfile.ran.rhel7.oc4-4" - output: - to: - kind: "ImageStreamTag" - name: "oai-ran:latest" diff --git a/openshift/oai-ran-image-stream.yml b/openshift/oai-ran-image-stream.yml deleted file mode 100644 index e1ef9d0b31..0000000000 --- a/openshift/oai-ran-image-stream.yml +++ /dev/null @@ -1,30 +0,0 @@ -#/* -# * 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 -# */ -#--------------------------------------------------------------------- -# -apiVersion: v1 -kind: ImageStream -metadata: - name: oai-ran - namespace: oai -status: - tag: latest - diff --git a/openshift/oai-ran-rh8-build-config.yml b/openshift/oai-ran-rh8-build-config.yml deleted file mode 100644 index 3d27b7cb5c..0000000000 --- a/openshift/oai-ran-rh8-build-config.yml +++ /dev/null @@ -1,57 +0,0 @@ -#/* -# * 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 -# */ -#--------------------------------------------------------------------- -# -kind: BuildConfig -apiVersion: build.openshift.io/v1 -metadata: - name: "oai-ran-rhel8-build-config" -spec: - runPolicy: "Serial" - source: - git: - uri: "https://gitlab.eurecom.fr/oai/openairinterface5g.git" - ref: "develop" - httpProxy: http://proxy.eurecom.fr:8080 - httpsProxy: https://proxy.eurecom.fr:8080 - secrets: - - secret: - name: etc-pki-entitlement - destinationDir: etc-pki-entitlement - configMaps: - - configMap: - name: rhsm-conf - destinationDir: rhsm-conf - - configMap: - name: rhsm-ca - destinationDir: rhsm-ca - strategy: - dockerStrategy: - dockerfilePath: "docker/Dockerfile.ran.rhel8.2.oc4-4" - nodeSelector: - kubernetes.io/hostname: dedale.5glab.nsa.eurecom.fr - resources: - requests: - ephemeral-storage: "5Gi" - output: - to: - kind: "ImageStreamTag" - name: "oai-ran:rhel8-latest" From d524bbb0edceea312906e3bf6ff741debe4ad57b Mon Sep 17 00:00:00 2001 From: Robert Schmidt Date: Wed, 27 Jul 2022 17:05:31 +0200 Subject: [PATCH 38/88] Add openshift build-configs and image-streams --- openshift/oai-enb-bc.yaml | 37 +++++++++++++++++++++++++++ openshift/oai-enb-is.yaml | 32 ++++++++++++++++++++++++ openshift/oai-gnb-bc.yaml | 37 +++++++++++++++++++++++++++ openshift/oai-gnb-is.yaml | 33 +++++++++++++++++++++++++ openshift/oai-lte-ue-bc.yaml | 37 +++++++++++++++++++++++++++ openshift/oai-lte-ue-is.yaml | 32 ++++++++++++++++++++++++ openshift/oai-nr-ue-bc.yaml | 37 +++++++++++++++++++++++++++ openshift/oai-nr-ue-is.yaml | 32 ++++++++++++++++++++++++ openshift/ran-base-bc.yaml | 48 ++++++++++++++++++++++++++++++++++++ openshift/ran-base-is.yaml | 31 +++++++++++++++++++++++ openshift/ran-build-bc.yaml | 41 ++++++++++++++++++++++++++++++ openshift/ran-build-is.yaml | 33 +++++++++++++++++++++++++ 12 files changed, 430 insertions(+) create mode 100644 openshift/oai-enb-bc.yaml create mode 100644 openshift/oai-enb-is.yaml create mode 100644 openshift/oai-gnb-bc.yaml create mode 100644 openshift/oai-gnb-is.yaml create mode 100644 openshift/oai-lte-ue-bc.yaml create mode 100644 openshift/oai-lte-ue-is.yaml create mode 100644 openshift/oai-nr-ue-bc.yaml create mode 100644 openshift/oai-nr-ue-is.yaml create mode 100644 openshift/ran-base-bc.yaml create mode 100644 openshift/ran-base-is.yaml create mode 100644 openshift/ran-build-bc.yaml create mode 100644 openshift/ran-build-is.yaml diff --git a/openshift/oai-enb-bc.yaml b/openshift/oai-enb-bc.yaml new file mode 100644 index 0000000000..f9973224cc --- /dev/null +++ b/openshift/oai-enb-bc.yaml @@ -0,0 +1,37 @@ +#/* +# * 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 +# */ +#--------------------------------------------------------------------- +# +kind: BuildConfig +apiVersion: build.openshift.io/v1 +metadata: + name: "oai-enb" +spec: + runPolicy: "Serial" + source: + type: "Binary" + strategy: + dockerStrategy: + dockerfilePath: "docker/Dockerfile.eNB.rhel8.2" + output: + to: + kind: "ImageStreamTag" + name: "oai-enb:latest" diff --git a/openshift/oai-enb-is.yaml b/openshift/oai-enb-is.yaml new file mode 100644 index 0000000000..7e75af58d6 --- /dev/null +++ b/openshift/oai-enb-is.yaml @@ -0,0 +1,32 @@ +#/* +# * 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 +# */ +#--------------------------------------------------------------------- + +apiVersion: image.openshift.io/v1 +kind: ImageStream +metadata: + name: oai-enb + namespace: oaicicd-ran +spec: + lookupPolicy: + local: true +status: + tag: latest diff --git a/openshift/oai-gnb-bc.yaml b/openshift/oai-gnb-bc.yaml new file mode 100644 index 0000000000..78b9248f19 --- /dev/null +++ b/openshift/oai-gnb-bc.yaml @@ -0,0 +1,37 @@ +#/* +# * 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 +# */ +#--------------------------------------------------------------------- +# +kind: BuildConfig +apiVersion: build.openshift.io/v1 +metadata: + name: "oai-gnb" +spec: + runPolicy: "Serial" + source: + type: "Binary" + strategy: + dockerStrategy: + dockerfilePath: "docker/Dockerfile.gNB.rhel8.2" + output: + to: + kind: "ImageStreamTag" + name: "oai-gnb:latest" diff --git a/openshift/oai-gnb-is.yaml b/openshift/oai-gnb-is.yaml new file mode 100644 index 0000000000..996ad9fd1d --- /dev/null +++ b/openshift/oai-gnb-is.yaml @@ -0,0 +1,33 @@ +#/* +# * 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 +# */ +#--------------------------------------------------------------------- +# +apiVersion: image.openshift.io/v1 +kind: ImageStream +metadata: + name: oai-gnb + namespace: oaicicd-ran +spec: + lookupPolicy: + local: true +status: + tag: latest + diff --git a/openshift/oai-lte-ue-bc.yaml b/openshift/oai-lte-ue-bc.yaml new file mode 100644 index 0000000000..a0dd92e670 --- /dev/null +++ b/openshift/oai-lte-ue-bc.yaml @@ -0,0 +1,37 @@ +#/* +# * 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 +# */ +#--------------------------------------------------------------------- +# +kind: BuildConfig +apiVersion: build.openshift.io/v1 +metadata: + name: "oai-lte-ue" +spec: + runPolicy: "Serial" + source: + type: "Binary" + strategy: + dockerStrategy: + dockerfilePath: "docker/Dockerfile.lteUE.rhel8.2" + output: + to: + kind: "ImageStreamTag" + name: "oai-lte-ue:latest" diff --git a/openshift/oai-lte-ue-is.yaml b/openshift/oai-lte-ue-is.yaml new file mode 100644 index 0000000000..678b8e6cbf --- /dev/null +++ b/openshift/oai-lte-ue-is.yaml @@ -0,0 +1,32 @@ +#/* +# * 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 +# */ +#--------------------------------------------------------------------- + +apiVersion: image.openshift.io/v1 +kind: ImageStream +metadata: + name: oai-lte-ue + namespace: oaicicd-ran +spec: + lookupPolicy: + local: true +status: + tag: latest diff --git a/openshift/oai-nr-ue-bc.yaml b/openshift/oai-nr-ue-bc.yaml new file mode 100644 index 0000000000..da9a5e424c --- /dev/null +++ b/openshift/oai-nr-ue-bc.yaml @@ -0,0 +1,37 @@ +#/* +# * 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 +# */ +#--------------------------------------------------------------------- +# +kind: BuildConfig +apiVersion: build.openshift.io/v1 +metadata: + name: "oai-nr-ue" +spec: + runPolicy: "Serial" + source: + type: "Binary" + strategy: + dockerStrategy: + dockerfilePath: "docker/Dockerfile.nrUE.rhel8.2" + output: + to: + kind: "ImageStreamTag" + name: "oai-nr-ue:latest" diff --git a/openshift/oai-nr-ue-is.yaml b/openshift/oai-nr-ue-is.yaml new file mode 100644 index 0000000000..0afd7b9448 --- /dev/null +++ b/openshift/oai-nr-ue-is.yaml @@ -0,0 +1,32 @@ +#/* +# * 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 +# */ +#--------------------------------------------------------------------- + +apiVersion: image.openshift.io/v1 +kind: ImageStream +metadata: + name: oai-nr-ue + namespace: oaicicd-ran +spec: + lookupPolicy: + local: true +status: + tag: latest diff --git a/openshift/ran-base-bc.yaml b/openshift/ran-base-bc.yaml new file mode 100644 index 0000000000..85247813aa --- /dev/null +++ b/openshift/ran-base-bc.yaml @@ -0,0 +1,48 @@ +#/* +# * 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 +# */ +#--------------------------------------------------------------------- +# +kind: BuildConfig +apiVersion: build.openshift.io/v1 +metadata: + name: "ran-base" +spec: + runPolicy: "Serial" + source: + type: "Binary" + secrets: + - secret: + name: etc-pki-entitlement + destinationDir: etc-pki-entitlement + configMaps: + - configMap: + name: rhsm-conf + destinationDir: rhsm-conf + - configMap: + name: rhsm-ca + destinationDir: rhsm-ca + strategy: + dockerStrategy: + dockerfilePath: "docker/Dockerfile.base.rhel8.2" + output: + to: + kind: "ImageStreamTag" + name: "ran-base:latest" diff --git a/openshift/ran-base-is.yaml b/openshift/ran-base-is.yaml new file mode 100644 index 0000000000..edde0d700e --- /dev/null +++ b/openshift/ran-base-is.yaml @@ -0,0 +1,31 @@ +#/* +# * 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 +# */ + +apiVersion: image.openshift.io/v1 +kind: ImageStream +metadata: + name: ran-base + namespace: oaicicd-ran +spec: + lookupPolicy: + local: true +status: + tag: latest diff --git a/openshift/ran-build-bc.yaml b/openshift/ran-build-bc.yaml new file mode 100644 index 0000000000..db144569b6 --- /dev/null +++ b/openshift/ran-build-bc.yaml @@ -0,0 +1,41 @@ +#/* +# * 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 +# */ +#--------------------------------------------------------------------- +# +kind: BuildConfig +apiVersion: build.openshift.io/v1 +metadata: + name: "ran-build" +spec: + runPolicy: "Serial" + source: + type: "Binary" + strategy: + dockerStrategy: + dockerfilePath: "docker/Dockerfile.build.rhel8.2" + from: + kind: ImageStreamTag # Use an imagestream tag as 'FROM' + namespace: oaicicd-ran # Which project? + name: oai-ran-base:latest # Use the imagestream created above + output: + to: + kind: "ImageStreamTag" + name: "ran-build:latest" diff --git a/openshift/ran-build-is.yaml b/openshift/ran-build-is.yaml new file mode 100644 index 0000000000..4f38d0ab47 --- /dev/null +++ b/openshift/ran-build-is.yaml @@ -0,0 +1,33 @@ +#/* +# * 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 +# */ +#--------------------------------------------------------------------- +# +apiVersion: image.openshift.io/v1 +kind: ImageStream +metadata: + name: ran-build + namespace: oaicicd-ran +spec: + lookupPolicy: + local: true +status: + tag: latest + From 580b2f326339b1b77c81059e840175be7a620540 Mon Sep 17 00:00:00 2001 From: Robert Schmidt Date: Wed, 17 Aug 2022 20:08:28 +0200 Subject: [PATCH 39/88] Create physim BuildConfig and harmonize ImageStream filename --- ci-scripts/cls_physim1.py | 2 +- openshift/oai-physim-bc.yaml | 41 +++++++++++++++++++ ...im-image-stream.yml => oai-physim-is.yaml} | 3 ++ 3 files changed, 45 insertions(+), 1 deletion(-) create mode 100644 openshift/oai-physim-bc.yaml rename openshift/{oai-physim-image-stream.yml => oai-physim-is.yaml} (96%) diff --git a/ci-scripts/cls_physim1.py b/ci-scripts/cls_physim1.py index 0464681b1d..0f187a4633 100644 --- a/ci-scripts/cls_physim1.py +++ b/ci-scripts/cls_physim1.py @@ -173,7 +173,7 @@ class PhySim: else: logging.debug('\u001B[1m Podman Login to OC Cluster Registry Successfully\u001B[0m') time.sleep(2) - mySSH.command('oc create -f openshift/oai-physim-image-stream.yml || true', '\$', 30) + mySSH.command('oc create -f openshift/oai-physim-is.yml || true', '\$', 30) if mySSH.getBefore().count('(AlreadyExists):') == 0 and mySSH.getBefore().count('created') == 0: logging.error(f'\u001B[1m Image Stream "oai-physim" Creation Failed on OC Cluster {ocProjectName}\u001B[0m') mySSH.command('sudo podman logout https://default-route-openshift-image-registry.apps.oai.cs.eurecom.fr/', '\$', 6) diff --git a/openshift/oai-physim-bc.yaml b/openshift/oai-physim-bc.yaml new file mode 100644 index 0000000000..050dd8bca8 --- /dev/null +++ b/openshift/oai-physim-bc.yaml @@ -0,0 +1,41 @@ +#/* +# * 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 +# */ +#--------------------------------------------------------------------- + +kind: BuildConfig +apiVersion: build.openshift.io/v1 +metadata: + name: "oai-physim" +spec: + runPolicy: "Serial" + source: + type: "Binary" + strategy: + dockerStrategy: + dockerfilePath: "docker/Dockerfile.phySim.rhel8.2" + from: + kind: ImageStreamTag + namespace: oaicicd-ran + name: oai-ran-base:latest + output: + to: + kind: "ImageStreamTag" + name: "oai-physim:latest" diff --git a/openshift/oai-physim-image-stream.yml b/openshift/oai-physim-is.yaml similarity index 96% rename from openshift/oai-physim-image-stream.yml rename to openshift/oai-physim-is.yaml index 9ef338f139..f2c7853540 100644 --- a/openshift/oai-physim-image-stream.yml +++ b/openshift/oai-physim-is.yaml @@ -24,6 +24,9 @@ apiVersion: image.openshift.io/v1 kind: ImageStream metadata: name: oai-physim + namespace: oaicicd-ran spec: lookupPolicy: local: true +status: + tag: latest From f77bf443861c98ec556615458e771bcad4f89948 Mon Sep 17 00:00:00 2001 From: Robert Schmidt Date: Fri, 19 Aug 2022 15:44:20 +0200 Subject: [PATCH 40/88] Help function for copying RAN build logs to executor --- ci-scripts/cls_containerize.py | 53 ++++++++++++++++++++-------------- 1 file changed, 31 insertions(+), 22 deletions(-) diff --git a/ci-scripts/cls_containerize.py b/ci-scripts/cls_containerize.py index e3d5397eee..0978c0a7d3 100644 --- a/ci-scripts/cls_containerize.py +++ b/ci-scripts/cls_containerize.py @@ -48,6 +48,26 @@ import sshconnection as SSH import helpreadme as HELP import constants as CONST +#----------------------------------------------------------- +# Helper functions used here and in other classes +# (e.g., cls_cluster.py) +#----------------------------------------------------------- +def CopyLogsToExecutor(sshSession, sourcePath, log_name, scpIp, scpUser, scpPw): + sshSession.command(f'cd {sourcePath}/cmake_targets', '\$', 5) + sshSession.command(f'rm -f {log_name}.zip', '\$', 5) + sshSession.command(f'mkdir -p {log_name}', '\$', 5) + sshSession.command(f'mv log/* {log_name}', '\$', 5) + sshSession.command(f'zip -r -qq {log_name}.zip {log_name}', '\$', 5) + + # copy zip to executor for analysis + if (os.path.isfile(f'./{log_name}.zip')): + os.remove(f'./{log_name}.zip') + if (os.path.isdir(f'./{log_name}')): + shutil.rmtree(f'./{log_name}') + sshSession.copyin(scpIp, scpUser, scpPw, f'{sourcePath}/cmake_targets/{log_name}.zip', '.') + sshSession.command(f'rm -f {log_name}.zip','\$', 5) + ZipFile(f'{log_name}.zip').extractall('.') + #----------------------------------------------------------- # Class Declaration #----------------------------------------------------------- @@ -333,30 +353,19 @@ class Containerize(): # Now pruning dangling images in between target builds mySSH.command(self.cli + ' image prune --force', '\$', 30) - # Analyzing the logs - mySSH.command('cd ' + lSourcePath + '/cmake_targets', '\$', 5) - mySSH.command('mkdir -p build_log_' + self.testCase_id, '\$', 5) - mySSH.command('mv log/* ' + 'build_log_' + self.testCase_id, '\$', 5) - - mySSH.command('cd ' + lSourcePath + '/cmake_targets', '\$', 5) - mySSH.command('rm -f build_log_' + self.testCase_id + '.zip || true', '\$', 5) - if (os.path.isfile('./build_log_' + self.testCase_id + '.zip')): - os.remove('./build_log_' + self.testCase_id + '.zip') - if (os.path.isdir('./build_log_' + self.testCase_id)): - shutil.rmtree('./build_log_' + self.testCase_id) - mySSH.command('zip -r -qq build_log_' + self.testCase_id + '.zip build_log_' + self.testCase_id, '\$', 5) - mySSH.copyin(lIpAddr, lUserName, lPassWord, lSourcePath + '/cmake_targets/build_log_' + self.testCase_id + '.zip', '.') - mySSH.command('rm -f build_log_' + self.testCase_id + '.zip','\$', 5) - # Remove all intermediate build images + # Remove all intermediate build images and clean up if self.ranAllowMerge and forceBaseImageBuild: - mySSH.command(self.cli + ' image rm ' + baseImage + ':' + baseTag + ' || true', '\$', 30) - mySSH.command(self.cli + ' image rm ran-build:' + imageTag + ' || true','\$', 30) - # Cleaning any created tmp volume - mySSH.command(self.cli + ' volume prune --force || true','\$', 15) - mySSH.close() - ZipFile('build_log_' + self.testCase_id + '.zip').extractall('.') + mySSH.command(f'{self.cli} image rm {baseImage}:{baseTag} || true', '\$', 30) + mySSH.command(f'{self.cli} image rm ran-build:{imageTag}','\$', 30) + mySSH.command(f'{self.cli} volume prune --force','\$', 15) - #Trying to identify the errors and warnings for each built images + # create a zip with all logs + build_log_name = f'build_log_{self.testCase_id}' + CopyLogsToExecutor(mySSH, lSourcePath, build_log_name, lIpAddr, lUserName, lPassWord) + mySSH.close() + + # Analyzing the logs + # Trying to identify the errors and warnings for each built images imageNames1 = imageNames base = ('ran-base','ran') imageNames1.insert(0, base) From d78ccd64ca726c4209017ec7504484fb5c7d7137 Mon Sep 17 00:00:00 2001 From: Robert Schmidt Date: Fri, 19 Aug 2022 16:00:10 +0200 Subject: [PATCH 41/88] Help function for analyzing RAN build logs --- ci-scripts/cls_containerize.py | 121 ++++++++++++++++----------------- 1 file changed, 60 insertions(+), 61 deletions(-) diff --git a/ci-scripts/cls_containerize.py b/ci-scripts/cls_containerize.py index 0978c0a7d3..6d9b20bc68 100644 --- a/ci-scripts/cls_containerize.py +++ b/ci-scripts/cls_containerize.py @@ -68,6 +68,58 @@ def CopyLogsToExecutor(sshSession, sourcePath, log_name, scpIp, scpUser, scpPw): sshSession.command(f'rm -f {log_name}.zip','\$', 5) ZipFile(f'{log_name}.zip').extractall('.') +def AnalyzeBuildLogs(buildRoot, images, globalStatus): + collectInfo = {} + for image in images: + files = {} + file_list = [f for f in os.listdir(f'{buildRoot}/{image}') if os.path.isfile(os.path.join(f'{buildRoot}/{image}', f)) and f.endswith('.txt')] + # Analyze the "sub-logs" of every target image + for fil in file_list: + errorandwarnings = {} + warningsNo = 0 + errorsNo = 0 + with open(f'{buildRoot}/{image}/{fil}', mode='r') as inputfile: + for line in inputfile: + result = re.search(' ERROR ', str(line)) + if result is not None: + errorsNo += 1 + result = re.search(' error:', str(line)) + if result is not None: + errorsNo += 1 + result = re.search(' WARNING ', str(line)) + if result is not None: + warningsNo += 1 + result = re.search(' warning:', str(line)) + if result is not None: + warningsNo += 1 + errorandwarnings['errors'] = errorsNo + errorandwarnings['warnings'] = warningsNo + errorandwarnings['status'] = globalStatus + files[fil] = errorandwarnings + # Analyze the target image + if os.path.isfile(f'{buildRoot}/{image}.log'): + errorandwarnings = {} + committed = False + tagged = False + with open(f'{buildRoot}/{image}.log', mode='r') as inputfile: + startOfTargetImageCreation = False # check for tagged/committed only after image created + for line in inputfile: + result = re.search(f'FROM .* [aA][sS] {image}$', str(line)) + if result is not None: + startOfTargetImageCreation = True + if startOfTargetImageCreation: + lineHasTag = re.search(f'Successfully tagged {image}:', str(line)) is not None + tagged = tagged or lineHasTag + # the OpenShift Cluster builder prepends image registry URL + lineHasCommit = re.search(f'COMMIT [a-zA-Z0-9\.:/\-]*{image}', str(line)) is not None + committed = committed or lineHasCommit + errorandwarnings['errors'] = 0 if committed or tagged else 1 + errorandwarnings['warnings'] = 0 + errorandwarnings['status'] = committed or tagged + files['Target Image Creation'] = errorandwarnings + collectInfo[image] = files + return collectInfo + #----------------------------------------------------------- # Class Declaration #----------------------------------------------------------- @@ -112,7 +164,6 @@ class Containerize(): self.dockerfileprefix = '' self.host = '' self.allImagesSize = {} - self.collectInfo = {} self.deployedContainers = [] self.tsharkStarted = False @@ -364,71 +415,18 @@ class Containerize(): CopyLogsToExecutor(mySSH, lSourcePath, build_log_name, lIpAddr, lUserName, lPassWord) mySSH.close() - # Analyzing the logs - # Trying to identify the errors and warnings for each built images - imageNames1 = imageNames - base = ('ran-base','ran') - imageNames1.insert(0, base) - for image,pattern in imageNames1: - files = {} - file_list = [f for f in os.listdir('build_log_' + self.testCase_id + '/' + image) if os.path.isfile(os.path.join('build_log_' + self.testCase_id + '/' + image, f)) and f.endswith('.txt')] - for fil in file_list: - errorandwarnings = {} - warningsNo = 0 - errorsNo = 0 - with open('build_log_{}/{}/{}'.format(self.testCase_id,image,fil), mode='r') as inputfile: - for line in inputfile: - result = re.search(' ERROR ', str(line)) - if result is not None: - errorsNo += 1 - result = re.search(' error:', str(line)) - if result is not None: - errorsNo += 1 - result = re.search(' WARNING ', str(line)) - if result is not None: - warningsNo += 1 - result = re.search(' warning:', str(line)) - if result is not None: - warningsNo += 1 - errorandwarnings['errors'] = errorsNo - errorandwarnings['warnings'] = warningsNo - errorandwarnings['status'] = status - files[fil] = errorandwarnings - # Let analyze the target image creation part - if os.path.isfile('build_log_{}/{}.log'.format(self.testCase_id,image)): - errorandwarnings = {} - with open('build_log_{}/{}.log'.format(self.testCase_id,image), mode='r') as inputfile: - startOfTargetImageCreation = False - buildStatus = False - for line in inputfile: - result = re.search('FROM .* [aA][sS] ' + image + '$', str(line)) - if result is not None: - startOfTargetImageCreation = True - if startOfTargetImageCreation: - result = re.search('Successfully tagged ' + image + ':', str(line)) - if result is not None: - buildStatus = True - result = re.search('COMMIT ' + image + ':', str(line)) - if result is not None: - buildStatus = True - inputfile.close() - if buildStatus: - errorandwarnings['errors'] = 0 - else: - errorandwarnings['errors'] = 1 - errorandwarnings['warnings'] = 0 - errorandwarnings['status'] = buildStatus - files['Target Image Creation'] = errorandwarnings - self.collectInfo[image] = files + # Analyze the logs + images = ['ran-base'] + [tpl[0] for tpl in imageNames] + collectInfo = AnalyzeBuildLogs(build_log_name, images, status) if status: logging.info('\u001B[1m Building OAI Image(s) Pass\u001B[0m') HTML.CreateHtmlTestRow(self.imageKind, 'OK', CONST.ALL_PROCESSES_OK) - HTML.CreateHtmlNextTabHeaderTestRow(self.collectInfo, self.allImagesSize) + HTML.CreateHtmlNextTabHeaderTestRow(collectInfo, self.allImagesSize) else: logging.error('\u001B[1m Building OAI Images Failed\u001B[0m') HTML.CreateHtmlTestRow(self.imageKind, 'KO', CONST.ALL_PROCESSES_OK) - HTML.CreateHtmlNextTabHeaderTestRow(self.collectInfo, self.allImagesSize) + HTML.CreateHtmlNextTabHeaderTestRow(collectInfo, self.allImagesSize) HTML.CreateHtmlTabFooter(False) sys.exit(1) @@ -550,7 +548,8 @@ class Containerize(): errorandwarnings['warnings'] = 0 errorandwarnings['status'] = True files['Target Image Creation'] = errorandwarnings - self.collectInfo['proxy'] = files + collectInfo = {} + collectInfo['proxy'] = files mySSH.command('docker image inspect --format=\'Size = {{.Size}} bytes\' proxy:' + tag, '\$', 5) result = re.search('Size *= *(?P[0-9\-]+) *bytes', mySSH.getBefore()) if result is not None: @@ -567,7 +566,7 @@ class Containerize(): logging.info('\u001B[1m Building L2sim Proxy Image Pass\u001B[0m') HTML.CreateHtmlTestRow('commit ' + tag, 'OK', CONST.ALL_PROCESSES_OK) - HTML.CreateHtmlNextTabHeaderTestRow(self.collectInfo, self.allImagesSize) + HTML.CreateHtmlNextTabHeaderTestRow(collectInfo, self.allImagesSize) def Copy_Image_to_Test_Server(self, HTML): imageTag = 'develop' From 668d0865b8b08daa884bdde221ee4ef0ff4b7ca7 Mon Sep 17 00:00:00 2001 From: Robert Schmidt Date: Mon, 5 Sep 2022 15:27:36 +0200 Subject: [PATCH 42/88] Simplify cls_containerize.BuildImage() and drop allImagesSize class member --- ci-scripts/cls_containerize.py | 92 +++++++++++++--------------------- 1 file changed, 36 insertions(+), 56 deletions(-) diff --git a/ci-scripts/cls_containerize.py b/ci-scripts/cls_containerize.py index 6d9b20bc68..d083b69be8 100644 --- a/ci-scripts/cls_containerize.py +++ b/ci-scripts/cls_containerize.py @@ -163,7 +163,6 @@ class Containerize(): self.cliBuildOptions = '' self.dockerfileprefix = '' self.host = '' - self.allImagesSize = {} self.deployedContainers = [] self.tsharkStarted = False @@ -318,32 +317,10 @@ class Containerize(): if forceBaseImageBuild: mySSH.command(self.cli + ' build ' + self.cliBuildOptions + ' --target ' + baseImage + ' --tag ' + baseImage + ':' + baseTag + ' --file docker/Dockerfile.base' + self.dockerfileprefix + ' . > cmake_targets/log/ran-base.log 2>&1', '\$', 1600) # First verify if the base image was properly created. - status = True mySSH.command(self.cli + ' image inspect --format=\'Size = {{.Size}} bytes\' ' + baseImage + ':' + baseTag, '\$', 5) + allImagesSize = {} if mySSH.getBefore().count('o such image') != 0: logging.error('\u001B[1m Could not build properly ran-base\u001B[0m') - status = False - else: - result = re.search('Size *= *(?P[0-9\-]+) *bytes', mySSH.getBefore()) - if result is not None: - imageSize = float(result.group('size')) - imageSize = imageSize / 1000 - if imageSize < 1000: - logging.debug('\u001B[1m ran-base size is ' + ('%.0f' % imageSize) + ' kbytes\u001B[0m') - self.allImagesSize['ran-base'] = str(round(imageSize,1)) + ' kbytes' - else: - imageSize = imageSize / 1000 - if imageSize < 1000: - logging.debug('\u001B[1m ran-base size is ' + ('%.0f' % imageSize) + ' Mbytes\u001B[0m') - self.allImagesSize['ran-base'] = str(round(imageSize,1)) + ' Mbytes' - else: - imageSize = imageSize / 1000 - logging.debug('\u001B[1m ran-base size is ' + ('%.3f' % imageSize) + ' Gbytes\u001B[0m') - self.allImagesSize['ran-base'] = str(round(imageSize,1)) + ' Gbytes' - else: - logging.debug('ran-base size is unknown') - # If the base image failed, no need to continue - if not status: # Recover the name of the failed container? mySSH.command(self.cli + ' ps --quiet --filter "status=exited" -n1 | xargs ' + self.cli + ' rm -f', '\$', 5) mySSH.command(self.cli + ' image prune --force', '\$', 30) @@ -353,20 +330,32 @@ class Containerize(): HTML.CreateHtmlTabFooter(False) sys.exit(1) else: - # Recover build logs, for the moment only possible when build is successful - mySSH.command(self.cli + ' create --name test ' + baseImage + ':' + baseTag, '\$', 5) - mySSH.command('mkdir -p cmake_targets/log/ran-base', '\$', 5) - mySSH.command(self.cli + ' cp test:/oai-ran/cmake_targets/log/. cmake_targets/log/ran-base', '\$', 5) - mySSH.command(self.cli + ' rm -f test', '\$', 5) + result = re.search('Size *= *(?P[0-9\-]+) *bytes', mySSH.getBefore()) + if result is not None: + size = float(result.group("size")) / 1000000 + imageSizeStr = f'{size:.1f}' + logging.debug(f'\u001B[1m ran-base size is {imageSizeStr} Mbytes\u001B[0m') + allImagesSize['ran-base'] = f'{imageSizeStr} Mbytes' + else: + logging.debug('ran-base size is unknown') + + # Recover build logs, for the moment only possible when build is successful + mySSH.command(self.cli + ' create --name test ' + baseImage + ':' + baseTag, '\$', 5) + mySSH.command('mkdir -p cmake_targets/log/ran-base', '\$', 5) + mySSH.command(self.cli + ' cp test:/oai-ran/cmake_targets/log/. cmake_targets/log/ran-base', '\$', 5) + mySSH.command(self.cli + ' rm -f test', '\$', 5) # Build the target image(s) + status = True + attemptedImages = ['ran-base'] for image,pattern in imageNames: + attemptedImages += [image] # the archived Dockerfiles have "ran-base:latest" as base image # we need to update them with proper tag - mySSH.command('sed -i -e "s#' + baseImage + ':latest#' + baseImage + ':' + baseTag + '#" docker/Dockerfile.' + pattern + self.dockerfileprefix, '\$', 5) + mySSH.command(f'sed -i -e "s#{baseImage}:latest#{baseImage}:{baseTag}#" docker/Dockerfile.{pattern}{self.dockerfileprefix}', '\$', 5) if image != 'ran-build': - mySSH.command('sed -i -e "s#' + "ran-build" + ':latest#' + "ran-build" + ':' + imageTag + '#" docker/Dockerfile.' + pattern + self.dockerfileprefix, '\$', 5) - mySSH.command(self.cli + ' build ' + self.cliBuildOptions + ' --target ' + image + ' --tag ' + image + ':' + imageTag + ' --file docker/Dockerfile.' + pattern + self.dockerfileprefix + ' . > cmake_targets/log/' + image + '.log 2>&1', '\$', 1200) + mySSH.command(f'sed -i -e "s#ran-build:latest#ran-build:{imageTag}#" docker/Dockerfile.{pattern}{self.dockerfileprefix}', '\$', 5) + mySSH.command(f'{self.cli} build {self.cliBuildOptions} --target {image} --tag {image}:{imageTag} --file docker/Dockerfile.{pattern}{self.dockerfileprefix} . > cmake_targets/log/{image}.log 2>&1', '\$', 1200) # Flatten Image if image != 'ran-build': mySSH.command('python3 ./ci-scripts/flatten_image.py --tag ' + image + ':' + imageTag, '\$', 300) @@ -380,27 +369,18 @@ class Containerize(): status = False # Here we should check if the last container corresponds to a failed command and destroy it mySSH.command(self.cli + ' ps --quiet --filter "status=exited" -n1 | xargs ' + self.cli + ' rm -f', '\$', 5) - self.allImagesSize[image] = 'N/A -- Build Failed' + allImagesSize[image] = 'N/A -- Build Failed' + break else: result = re.search('Size *= *(?P[0-9\-]+) *bytes', mySSH.getBefore()) if result is not None: - imageSize = float(result.group('size')) - imageSize = imageSize / 1000 - if imageSize < 1000: - logging.debug('\u001B[1m ' + image + ' size is ' + ('%.0f' % imageSize) + ' kbytes\u001B[0m') - self.allImagesSize[image] = str(round(imageSize,1)) + ' kbytes' - else: - imageSize = imageSize / 1000 - if imageSize < 1000: - logging.debug('\u001B[1m ' + image + ' size is ' + ('%.0f' % imageSize) + ' Mbytes\u001B[0m') - self.allImagesSize[image] = str(round(imageSize,1)) + ' Mbytes' - else: - imageSize = imageSize / 1000 - logging.debug('\u001B[1m ' + image + ' size is ' + ('%.3f' % imageSize) + ' Gbytes\u001B[0m') - self.allImagesSize[image] = str(round(imageSize,1)) + ' Gbytes' + size = float(result.group("size")) / 1000000 + imageSizeStr = f'{size:.1f}' + logging.debug(f'\u001B[1m {image} size is {imageSizeStr} Mbytes\u001B[0m') + allImagesSize[image] = f'{imageSizeStr} Mbytes' else: - logging.debug('ran-base size is unknown') - self.allImagesSize[image] = 'unknown' + logging.debug(f'{image} size is unknown') + allImagesSize[image] = 'unknown' # Now pruning dangling images in between target builds mySSH.command(self.cli + ' image prune --force', '\$', 30) @@ -416,17 +396,16 @@ class Containerize(): mySSH.close() # Analyze the logs - images = ['ran-base'] + [tpl[0] for tpl in imageNames] - collectInfo = AnalyzeBuildLogs(build_log_name, images, status) + collectInfo = AnalyzeBuildLogs(build_log_name, attemptedImages, status) if status: logging.info('\u001B[1m Building OAI Image(s) Pass\u001B[0m') HTML.CreateHtmlTestRow(self.imageKind, 'OK', CONST.ALL_PROCESSES_OK) - HTML.CreateHtmlNextTabHeaderTestRow(collectInfo, self.allImagesSize) + HTML.CreateHtmlNextTabHeaderTestRow(collectInfo, allImagesSize) else: logging.error('\u001B[1m Building OAI Images Failed\u001B[0m') HTML.CreateHtmlTestRow(self.imageKind, 'KO', CONST.ALL_PROCESSES_OK) - HTML.CreateHtmlNextTabHeaderTestRow(collectInfo, self.allImagesSize) + HTML.CreateHtmlNextTabHeaderTestRow(collectInfo, allImagesSize) HTML.CreateHtmlTabFooter(False) sys.exit(1) @@ -552,13 +531,14 @@ class Containerize(): collectInfo['proxy'] = files mySSH.command('docker image inspect --format=\'Size = {{.Size}} bytes\' proxy:' + tag, '\$', 5) result = re.search('Size *= *(?P[0-9\-]+) *bytes', mySSH.getBefore()) + allImagesSize = {} if result is not None: imageSize = float(result.group('size')) / 1000000 logging.debug('\u001B[1m proxy size is ' + ('%.0f' % imageSize) + ' Mbytes\u001B[0m') - self.allImagesSize['proxy'] = str(round(imageSize,1)) + ' Mbytes' + allImagesSize['proxy'] = str(round(imageSize,1)) + ' Mbytes' else: logging.debug('proxy size is unknown') - self.allImagesSize['proxy'] = 'unknown' + allImagesSize['proxy'] = 'unknown' # Cleaning any created tmp volume mySSH.command(self.cli + ' volume prune --force || true','\$', 15) @@ -566,7 +546,7 @@ class Containerize(): logging.info('\u001B[1m Building L2sim Proxy Image Pass\u001B[0m') HTML.CreateHtmlTestRow('commit ' + tag, 'OK', CONST.ALL_PROCESSES_OK) - HTML.CreateHtmlNextTabHeaderTestRow(collectInfo, self.allImagesSize) + HTML.CreateHtmlNextTabHeaderTestRow(collectInfo, allImagesSize) def Copy_Image_to_Test_Server(self, HTML): imageTag = 'develop' From 01add24beeb150c2526eada0a684524d5215919b Mon Sep 17 00:00:00 2001 From: Robert Schmidt Date: Mon, 29 Aug 2022 13:31:41 +0200 Subject: [PATCH 43/88] GetParametersFromXML(): simplify forced_workspace_cleanup reading --- ci-scripts/main.py | 15 +++++---------- 1 file changed, 5 insertions(+), 10 deletions(-) diff --git a/ci-scripts/main.py b/ci-scripts/main.py index 9349a3decc..8b18989a26 100644 --- a/ci-scripts/main.py +++ b/ci-scripts/main.py @@ -106,16 +106,11 @@ def GetParametersFromXML(action): RAN.Build_eNB_args=test.findtext('Build_eNB_args') CONTAINERS.imageKind=test.findtext('kind') forced_workspace_cleanup = test.findtext('forced_workspace_cleanup') - if (forced_workspace_cleanup is None): - RAN.Build_eNB_forced_workspace_cleanup=False - CONTAINERS.forcedWorkspaceCleanup=False - else: - if re.match('true', forced_workspace_cleanup, re.IGNORECASE): - RAN.Build_eNB_forced_workspace_cleanup=True - CONTAINERS.forcedWorkspaceCleanup=True - else: - RAN.Build_eNB_forced_workspace_cleanup=True - CONTAINERS.forcedWorkspaceCleanup=False + RAN.Build_eNB_forced_workspace_cleanup=False + CONTAINERS.forcedWorkspaceCleanup=False + if forced_workspace_cleanup is not None and re.match('true', forced_workspace_cleanup, re.IGNORECASE): + RAN.Build_eNB_forced_workspace_cleanup = True + CONTAINERS.forcedWorkspaceCleanup = True eNB_instance=test.findtext('eNB_instance') if (eNB_instance is None): RAN.eNB_instance=0 From 0e9455b721906a6ebd487227e745e4b5db300345 Mon Sep 17 00:00:00 2001 From: Robert Schmidt Date: Mon, 8 Aug 2022 18:55:46 +0200 Subject: [PATCH 44/88] Update README.md --- openshift/README.md | 120 +++++++++++++------------ openshift/oai-enb-rh8-image-stream.yml | 30 ------- openshift/oai-ran-rh8-image-stream.yml | 30 ------- 3 files changed, 65 insertions(+), 115 deletions(-) delete mode 100644 openshift/oai-enb-rh8-image-stream.yml delete mode 100644 openshift/oai-ran-rh8-image-stream.yml diff --git a/openshift/README.md b/openshift/README.md index b7409ab945..8b904127cd 100644 --- a/openshift/README.md +++ b/openshift/README.md @@ -1,32 +1,27 @@ - - - - - -
- - - - - - OpenShift Build and Usage Procedures -
+# 1. Introduction ------ +## General -**CAUTION: this is experimental. Still a lot to be done.** +What follows is a tutorial on how to build images on an OpenShift cluster in a three-step process +(base image, build artifact image, target image). Note that all image +streams/build configs assume the OC project/namespace `oaicicd-ran`. ------ +If you want to regenerate images from modified sources, you have to rebuild +the ran-build image. If you reinstalled dependencies, you have to restart from +ran-base. -# 1. Build pre-requisites # +You first need to login. Do: +```bash +oc login -u -p --server +``` -To build our RAN images, we SHALL use the `codeready-builder-for-rhel-8-x86_64-rpms` repository with all the proper development libraries. +## RHEL8 Entitlements +To build the RAN images, we use the `codeready-builder-for-rhel-8-x86_64-rpms` repository with all the proper development libraries. This repository is not directly accessible from the UBI RHEL8 image (`registry.access.redhat.com/ubi8/ubi:latest`). +Therefore, we need to copy certificates and subscription manager configuration files from a registered RHEL8 machine. -So we need to copy from a register RHEL8 machine certificates and subsccription manager configuration files. - -SO on a `RHEL8` physical machine (or a virtual machine) connected to the OpenShift Cluster, recover the entitlement and the RH subscription manager configs: +on a `RHEL8` physical machine (or a virtual machine) connected to the OpenShift Cluster, recover the entitlement and the RH subscription manager configs: ```bash oc create configmap rhsm-conf --from-file /etc/rhsm/rhsm.conf @@ -35,9 +30,10 @@ oc create configmap rhsm-ca --from-file /etc/rhsm/ca/redhat-uep.pem oc create secret generic etc-pki-entitlement --from-file /etc/pki/entitlement/{NUMBER_ON_YOUR_COMPUTER}.pem --from-file /etc/pki/entitlement/{NUMBER_ON_YOUR_COMPUTER}-key.pem ``` -These configmaps and secret will be shared by all the build configs in your OC project. No need to do it each time. - -**CAUTION: these files expire every month or so. If you have done a build on your OC project and try again a few weeks later, you may need to re-copy them**. +These configmaps and secret will be shared by all the build configs in your OC +project. No need to do it each time. However, these files expire every month +or so. If you have done a build on your OC project and try again a few weeks +later, you may need to re-copy them. (The CI recopies them every time.) ```bash oc delete secret etc-pki-entitlement @@ -45,55 +41,69 @@ oc delete cm rhsm-conf oc delete cm rhsm-ca ``` -**LAST POINT: your OC project SHALL be `oai`.** +# 2. Build of `base` shared image -# 2. Build the Builder shared image # - -In our Eurecom/OSA environment we need to pass a GIT proxy. - -2 things are impacted by this situation: - -* In `openshift/oai-ran-rh8-build-config.yml` file - * `httpProxy: http://proxy.eurecom.fr:8080` - * `httpsProxy: https://proxy.eurecom.fr:8080` -* Add a environment variable to the build config +Create an image stream and build config that specify image properties and build parameters, then start the build: ```bash -oc apply -f openshift/oai-ran-rh8-image-stream.yml -oc apply -f openshift/oai-ran-rh8-build-config.yml -oc set env bc/oai-ran-rhel8-build-config NEEDED_GIT_PROXY=http://proxy.eurecom.fr:8080 -oc start-build oai-ran-rhel8-build-config --follow +oc create -f openshift/ran-base-is.yaml +oc create -f openshift/ran-base-bc.yaml +oc start-build ran-base --from-file= --follow ``` -In case you do NOT require a GIT proxy: **you SHALL remove the 2 lines in `openshift/oai-ran-rh8-build-config.yml` file.** +The `--from-file=` uploads the repository (from which the +build is done) as a binary blob. It is therefore possible to make +merges or other modifications and build an image. -And no need to add a `NEEDED_GIT_PROXY` variable to the build config. +# 3. Build of `build` shared image + +The same as for the `base` image. ```bash -oc apply -f openshift/oai-ran-rh8-image-stream.yml -oc apply -f openshift/modified-oai-ran-rh8-build-config.yml -oc start-build oai-ran-rhel8-build-config --follow +oc create -f openshift/ran-build-is.yaml +oc create -f openshift/ran-build-bc.yaml +oc start-build ran-build --from-file= --follow ``` -After a while it should be successful. +# 4. Build of a target image -# 3. Build an OAI target image # - -For the example the eNB: +The same as for the `base` image: ```bash -oc apply -f openshift/oai-enb-rh8-image-stream.yml -oc apply -f openshift/oai-enb-rh8-build-config.yml -oc start-build oai-enb-rh8-build-config --follow +oc create -f openshift/oai-gnb-is.yaml +oc create -f openshift/oai-gnb-bc.yaml +oc start-build oai-gnb --from-file= --follow ``` -**CAUTION: if you are pushing modifications to the branch you are using, it won't be taken into account besides the Dockerfile.** +# 5. Retrieval of Build Container Images and Build Artifacts -**Because the source files are copied during the shared image creation.** +Build artifacts, such as build logs, can be retrieved by checking the logs of +the individual build steps. For example, for the `ran-build` step, you can do: +```bash +oc logs ran-build-1-build +``` +where `ran-build-1-build` is the name of the `ran-build` build (type `oc get +pods` to get a list of all pods). -**Only way to regenerate images w/ modified source code is to re-start from step #2.** +It is also possible to retrieve the build logs from a running pod. Currently, +this is only used for the `ran-base` step (the others using a python script to +scrape it from stdout): +```bash +oc create -f openshift/ran-base-log-retrieval.yaml +oc rsync ran-base-log-retrieval:/oai-ran/cmake_targets/log cmake_targets/log/ran-base +oc delete -f openshift/ran-base-log-retrieval.yaml +``` -# 4. Deployment using HELM charts # +The images are uploaded into the OpenShift image registry. To download, login +using podman, then pull an image: +```bash +oc whoami -t | sudo podman login -u --password-stdin --tls-verify=false +sudo podman pull /oaicicd-ran/: --tls-verify=false +sudo podman logout +``` +The `` could be `oai-gnb`, and the `` `ci-temp`. + +# 6. Deployment using HELM Charts **CAUTION: even more experimental.** diff --git a/openshift/oai-enb-rh8-image-stream.yml b/openshift/oai-enb-rh8-image-stream.yml deleted file mode 100644 index 9d1cfebd54..0000000000 --- a/openshift/oai-enb-rh8-image-stream.yml +++ /dev/null @@ -1,30 +0,0 @@ -#/* -# * 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 -# */ -#--------------------------------------------------------------------- -# -apiVersion: v1 -kind: ImageStream -metadata: - name: oai-enb - namespace: oai -status: - tag: rhel8-latest - diff --git a/openshift/oai-ran-rh8-image-stream.yml b/openshift/oai-ran-rh8-image-stream.yml deleted file mode 100644 index f6f4f8614f..0000000000 --- a/openshift/oai-ran-rh8-image-stream.yml +++ /dev/null @@ -1,30 +0,0 @@ -#/* -# * 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 -# */ -#--------------------------------------------------------------------- -# -apiVersion: v1 -kind: ImageStream -metadata: - name: oai-ran - namespace: oai -status: - tag: rhel8-latest - From ebdbb1fc1386745334a63dfbff0c5ab468952943 Mon Sep 17 00:00:00 2001 From: Robert Schmidt Date: Mon, 29 Aug 2022 14:48:47 +0200 Subject: [PATCH 45/88] Physim: image is already on openshift image registry --- ci-scripts/cls_physim1.py | 73 --------------------------------------- 1 file changed, 73 deletions(-) diff --git a/ci-scripts/cls_physim1.py b/ci-scripts/cls_physim1.py index 0f187a4633..56934fcd22 100644 --- a/ci-scripts/cls_physim1.py +++ b/ci-scripts/cls_physim1.py @@ -115,30 +115,6 @@ class PhySim: mySSH.command('git merge --ff origin/' + self.ranTargetBranch + ' -m "Temporary merge for CI"', '\$', 5) else: imageTag = "develop" - # Check if image is exist on the Red Hat server, before pushing it to OC cluster - mySSH.command('sudo podman image inspect --format="Size = {{.Size}} bytes" oai-physim:' + imageTag, '\$', 60) - if mySSH.getBefore().count('no such image') != 0: - logging.error('\u001B[1m No such image oai-physim\u001B[0m') - mySSH.close() - HTML.CreateHtmlTestRow('N/A', 'KO', CONST.PHYSIM_IMAGE_ABSENT) - RAN.prematureExit = True - return - else: - result = re.search('Size *= *(?P[0-9\-]+) *bytes', mySSH.getBefore()) - if result is not None: - imageSize = float(result.group('size')) - imageSize = imageSize / 1000 - if imageSize < 1000: - logging.debug('\u001B[1m oai-physim size is ' + ('%.0f' % imageSize) + ' kbytes\u001B[0m') - else: - imageSize = imageSize / 1000 - if imageSize < 1000: - logging.debug('\u001B[1m oai-physim size is ' + ('%.0f' % imageSize) + ' Mbytes\u001B[0m') - else: - imageSize = imageSize / 1000 - logging.debug('\u001B[1m oai-physim is ' + ('%.3f' % imageSize) + ' Gbytes\u001B[0m') - else: - logging.debug('oai-physim size is unknown') # logging to OC Cluster and then switch to corresponding project mySSH.command(f'oc login -u {ocUserName} -p {ocPassword} --server https://api.oai.cs.eurecom.fr:6443', '\$', 30) @@ -161,46 +137,7 @@ class PhySim: else: logging.debug(f'\u001B[1m Now using project {ocProjectName}\u001B[0m') - # Tag the image and push to the OC cluster - mySSH.command('oc whoami -t | sudo podman login -u ' + ocUserName + ' --password-stdin https://default-route-openshift-image-registry.apps.oai.cs.eurecom.fr/ --tls-verify=false', '\$', 30) - if mySSH.getBefore().count('Login Succeeded!') == 0: - logging.error('\u001B[1m Podman Login to OC Cluster Registry Failed\u001B[0m') - mySSH.command('oc logout', '\$', 30) - mySSH.close() - HTML.CreateHtmlTestRow('N/A', 'KO', CONST.OC_LOGIN_FAIL) - RAN.prematureExit = True - return - else: - logging.debug('\u001B[1m Podman Login to OC Cluster Registry Successfully\u001B[0m') - time.sleep(2) - mySSH.command('oc create -f openshift/oai-physim-is.yml || true', '\$', 30) - if mySSH.getBefore().count('(AlreadyExists):') == 0 and mySSH.getBefore().count('created') == 0: - logging.error(f'\u001B[1m Image Stream "oai-physim" Creation Failed on OC Cluster {ocProjectName}\u001B[0m') - mySSH.command('sudo podman logout https://default-route-openshift-image-registry.apps.oai.cs.eurecom.fr/', '\$', 6) - mySSH.command('oc logout', '\$', 30) - mySSH.close() - HTML.CreateHtmlTestRow('N/A', 'KO', CONST.OC_IS_FAIL) - RAN.prematureExit = True - return - else: - logging.debug(f'\u001B[1m Image Stream "oai-physim" created on OC project {ocProjectName}\u001B[0m') - time.sleep(2) - mySSH.command(f'sudo podman tag oai-physim:{imageTag} default-route-openshift-image-registry.apps.oai.cs.eurecom.fr/{self.OCProjectName}/oai-physim:{imageTag}', '\$', 30) - time.sleep(2) - mySSH.command(f'sudo podman push default-route-openshift-image-registry.apps.oai.cs.eurecom.fr/{self.OCProjectName}/oai-physim:{imageTag} --tls-verify=false', '\$', 180) - if mySSH.getBefore().count('Storing signatures') == 0: - logging.error('\u001B[1m Image "oai-physim" push to OC Cluster Registry Failed\u001B[0m') - mySSH.command('sudo podman logout https://default-route-openshift-image-registry.apps.oai.cs.eurecom.fr/', '\$', 6) - mySSH.command('oc logout', '\$', 30) - mySSH.close() - HTML.CreateHtmlTestRow('N/A', 'KO', CONST.OC_IS_FAIL) - RAN.prematureExit = True - return - else: - logging.debug('\u001B[1m Image "oai-physim" push to OC Cluster Registry Successfully\u001B[0m') - # Using helm charts deployment - time.sleep(5) mySSH.command(f'grep -rl OAICICD_PROJECT ./charts/ | xargs sed -i -e "s#OAICICD_PROJECT#{ocProjectName}#"', '\$', 30) mySSH.command(f'sed -i -e "s#TAG#{imageTag}#g" ./charts/physims/values.yaml', '\$', 6) mySSH.command('helm install physim ./charts/physims/ 2>&1 | tee -a cmake_targets/log/physim_helm_summary.txt', '\$', 30) @@ -213,9 +150,6 @@ class PhySim: mySSH.command('oc get pods -l app.kubernetes.io/instance=physim', '\$', 6, resync=True) if re.search('No resources found', mySSH.getBefore()): isFinished1 = True - mySSH.command(f'sudo podman rmi default-route-openshift-image-registry.apps.oai.cs.eurecom.fr/{self.OCProjectName}/oai-physim:{imageTag}', '\$', 30) - mySSH.command('oc delete is oai-physim', '\$', 30) - mySSH.command('sudo podman logout https://default-route-openshift-image-registry.apps.oai.cs.eurecom.fr/', '\$', 6) mySSH.command('oc logout', '\$', 30) mySSH.close() self.AnalyzeLogFile_phySim(HTML) @@ -244,9 +178,6 @@ class PhySim: mySSH.command('oc get pods -l app.kubernetes.io/instance=physim', '\$', 6, resync=True) if re.search('No resources found', mySSH.getBefore()): isFinished1 = True - mySSH.command(f'sudo podman rmi default-route-openshift-image-registry.apps.oai.cs.eurecom.fr/{self.OCProjectName}/oai-physim:{imageTag}', '\$', 6) - mySSH.command('oc delete is oai-physim', '\$', 6) - mySSH.command('sudo podman logout https://default-route-openshift-image-registry.apps.oai.cs.eurecom.fr/', '\$', 6) mySSH.command('oc logout', '\$', 30) HTML.CreateHtmlTestRow('N/A', 'KO', CONST.OC_PHYSIM_DEPLOY_FAIL) HTML.CreateHtmlTestRowPhySimTestResult(self.testSummary,self.testResult) @@ -304,10 +235,6 @@ class PhySim: isFinished1 = True if isFinished1 == True: logging.debug('\u001B[1m UnDeployed PhySim Successfully on OC Cluster\u001B[0m') - mySSH.command(f'sudo podman rmi default-route-openshift-image-registry.apps.oai.cs.eurecom.fr/{self.OCProjectName}/oai-physim:{imageTag}', '\$', 6) - mySSH.command('oc delete is oai-physim', '\$', 6) - logging.debug('\u001B[1m Deleted the Image and ImageStream\u001B[0m') - mySSH.command('sudo podman logout https://default-route-openshift-image-registry.apps.oai.cs.eurecom.fr/', '\$', 6) mySSH.command('oc logout', '\$', 6) mySSH.close() self.AnalyzeLogFile_phySim(HTML) From 41a9ac1119699b1fcbcb18c497fa2967687ec339 Mon Sep 17 00:00:00 2001 From: Robert Schmidt Date: Wed, 20 Jul 2022 17:45:00 +0200 Subject: [PATCH 46/88] Python Class for Cluster Building and Deployment --- ci-scripts/args_parse.py | 20 +- ci-scripts/cls_cluster.py | 407 +++++++++++++++++++ ci-scripts/main.py | 11 +- ci-scripts/xml_class_list.yml | 1 + ci-scripts/xml_files/cluster_image_build.xml | 35 ++ openshift/oai-physim-bc.yaml | 4 - openshift/ran-base-log-retrieval.yaml | 13 + openshift/ran-build-bc.yaml | 4 - 8 files changed, 484 insertions(+), 11 deletions(-) create mode 100644 ci-scripts/cls_cluster.py create mode 100644 ci-scripts/xml_files/cluster_image_build.xml create mode 100644 openshift/ran-base-log-retrieval.yaml diff --git a/ci-scripts/args_parse.py b/ci-scripts/args_parse.py index c0203a4c98..01e3eba465 100644 --- a/ci-scripts/args_parse.py +++ b/ci-scripts/args_parse.py @@ -41,7 +41,7 @@ import constants as CONST #----------------------------------------------------------- -def ArgsParse(argvs,CiTestObj,RAN,HTML,EPC,ldpc,CONTAINERS,HELP,SCA,PHYSIM): +def ArgsParse(argvs,CiTestObj,RAN,HTML,EPC,ldpc,CONTAINERS,HELP,SCA,PHYSIM,CLUSTER): py_param_file_present = False @@ -82,6 +82,7 @@ def ArgsParse(argvs,CiTestObj,RAN,HTML,EPC,ldpc,CONTAINERS,HELP,SCA,PHYSIM): CONTAINERS.ranRepository=matchReg.group(1) SCA.ranRepository=matchReg.group(1) PHYSIM.ranRepository=matchReg.group(1) + CLUSTER.ranRepository=matchReg.group(1) elif re.match('^\-\-eNB_AllowMerge=(.+)$|^\-\-ranAllowMerge=(.+)$', myArgv, re.IGNORECASE): if re.match('^\-\-eNB_AllowMerge=(.+)$', myArgv, re.IGNORECASE): matchReg = re.match('^\-\-eNB_AllowMerge=(.+)$', myArgv, re.IGNORECASE) @@ -96,6 +97,7 @@ def ArgsParse(argvs,CiTestObj,RAN,HTML,EPC,ldpc,CONTAINERS,HELP,SCA,PHYSIM): CONTAINERS.ranAllowMerge=True SCA.ranAllowMerge=True PHYSIM.ranAllowMerge=True + CLUSTER.ranAllowMerge=True elif re.match('^\-\-eNBBranch=(.+)$|^\-\-ranBranch=(.+)$', myArgv, re.IGNORECASE): if re.match('^\-\-eNBBranch=(.+)$', myArgv, re.IGNORECASE): matchReg = re.match('^\-\-eNBBranch=(.+)$', myArgv, re.IGNORECASE) @@ -108,6 +110,7 @@ def ArgsParse(argvs,CiTestObj,RAN,HTML,EPC,ldpc,CONTAINERS,HELP,SCA,PHYSIM): CONTAINERS.ranBranch=matchReg.group(1) SCA.ranBranch=matchReg.group(1) PHYSIM.ranBranch=matchReg.group(1) + CLUSTER.ranBranch=matchReg.group(1) elif re.match('^\-\-eNBCommitID=(.*)$|^\-\-ranCommitID=(.*)$', myArgv, re.IGNORECASE): if re.match('^\-\-eNBCommitID=(.*)$', myArgv, re.IGNORECASE): matchReg = re.match('^\-\-eNBCommitID=(.*)$', myArgv, re.IGNORECASE) @@ -120,6 +123,7 @@ def ArgsParse(argvs,CiTestObj,RAN,HTML,EPC,ldpc,CONTAINERS,HELP,SCA,PHYSIM): CONTAINERS.ranCommitID=matchReg.group(1) SCA.ranCommitID=matchReg.group(1) PHYSIM.ranCommitID=matchReg.group(1) + CLUSTER.ranCommitID=matchReg.group(1) elif re.match('^\-\-eNBTargetBranch=(.*)$|^\-\-ranTargetBranch=(.*)$', myArgv, re.IGNORECASE): if re.match('^\-\-eNBTargetBranch=(.*)$', myArgv, re.IGNORECASE): matchReg = re.match('^\-\-eNBTargetBranch=(.*)$', myArgv, re.IGNORECASE) @@ -132,6 +136,7 @@ def ArgsParse(argvs,CiTestObj,RAN,HTML,EPC,ldpc,CONTAINERS,HELP,SCA,PHYSIM): CONTAINERS.ranTargetBranch=matchReg.group(1) SCA.ranTargetBranch=matchReg.group(1) PHYSIM.ranTargetBranch=matchReg.group(1) + CLUSTER.ranTargetBranch=matchReg.group(1) elif re.match('^\-\-eNBIPAddress=(.+)$|^\-\-eNB[1-2]IPAddress=(.+)$', myArgv, re.IGNORECASE): if re.match('^\-\-eNBIPAddress=(.+)$', myArgv, re.IGNORECASE): matchReg = re.match('^\-\-eNBIPAddress=(.+)$', myArgv, re.IGNORECASE) @@ -140,6 +145,7 @@ def ArgsParse(argvs,CiTestObj,RAN,HTML,EPC,ldpc,CONTAINERS,HELP,SCA,PHYSIM): CONTAINERS.eNBIPAddress=matchReg.group(1) SCA.eNBIPAddress=matchReg.group(1) PHYSIM.eNBIPAddress=matchReg.group(1) + CLUSTER.eNBIPAddress=matchReg.group(1) elif re.match('^\-\-eNB1IPAddress=(.+)$', myArgv, re.IGNORECASE): matchReg = re.match('^\-\-eNB1IPAddress=(.+)$', myArgv, re.IGNORECASE) RAN.eNB1IPAddress=matchReg.group(1) @@ -156,6 +162,7 @@ def ArgsParse(argvs,CiTestObj,RAN,HTML,EPC,ldpc,CONTAINERS,HELP,SCA,PHYSIM): CONTAINERS.eNBUserName=matchReg.group(1) SCA.eNBUserName=matchReg.group(1) PHYSIM.eNBUserName=matchReg.group(1) + CLUSTER.eNBUserName=matchReg.group(1) elif re.match('^\-\-eNB1UserName=(.+)$', myArgv, re.IGNORECASE): matchReg = re.match('^\-\-eNB1UserName=(.+)$', myArgv, re.IGNORECASE) RAN.eNB1UserName=matchReg.group(1) @@ -172,6 +179,7 @@ def ArgsParse(argvs,CiTestObj,RAN,HTML,EPC,ldpc,CONTAINERS,HELP,SCA,PHYSIM): CONTAINERS.eNBPassword=matchReg.group(1) SCA.eNBPassword=matchReg.group(1) PHYSIM.eNBPassword=matchReg.group(1) + CLUSTER.eNBPassword=matchReg.group(1) elif re.match('^\-\-eNB1Password=(.+)$', myArgv, re.IGNORECASE): matchReg = re.match('^\-\-eNB1Password=(.+)$', myArgv, re.IGNORECASE) RAN.eNB1Password=matchReg.group(1) @@ -188,6 +196,7 @@ def ArgsParse(argvs,CiTestObj,RAN,HTML,EPC,ldpc,CONTAINERS,HELP,SCA,PHYSIM): CONTAINERS.eNBSourceCodePath=matchReg.group(1) SCA.eNBSourceCodePath=matchReg.group(1) PHYSIM.eNBSourceCodePath=matchReg.group(1) + CLUSTER.eNBSourceCodePath=matchReg.group(1) elif re.match('^\-\-eNB1SourceCodePath=(.+)$', myArgv, re.IGNORECASE): matchReg = re.match('^\-\-eNB1SourceCodePath=(.+)$', myArgv, re.IGNORECASE) RAN.eNB1SourceCodePath=matchReg.group(1) @@ -260,12 +269,21 @@ def ArgsParse(argvs,CiTestObj,RAN,HTML,EPC,ldpc,CONTAINERS,HELP,SCA,PHYSIM): elif re.match('^\-\-OCUserName=(.+)$', myArgv, re.IGNORECASE): matchReg = re.match('^\-\-OCUserName=(.+)$', myArgv, re.IGNORECASE) PHYSIM.OCUserName = matchReg.group(1) + CLUSTER.OCUserName = matchReg.group(1) elif re.match('^\-\-OCPassword=(.+)$', myArgv, re.IGNORECASE): matchReg = re.match('^\-\-OCPassword=(.+)$', myArgv, re.IGNORECASE) PHYSIM.OCPassword = matchReg.group(1) + CLUSTER.OCPassword = matchReg.group(1) elif re.match('^\-\-OCProjectName=(.+)$', myArgv, re.IGNORECASE): matchReg = re.match('^\-\-OCProjectName=(.+)$', myArgv, re.IGNORECASE) PHYSIM.OCProjectName = matchReg.group(1) + CLUSTER.OCProjectName = matchReg.group(1) + elif re.match('^\-\-OCUrl=(.+)$', myArgv, re.IGNORECASE): + matchReg = re.match('^\-\-OCUrl=(.+)$', myArgv, re.IGNORECASE) + CLUSTER.OCUrl = matchReg.group(1) + elif re.match('^\-\-OCRegistry=(.+)$', myArgv, re.IGNORECASE): + matchReg = re.match('^\-\-OCRegistry=(.+)$', myArgv, re.IGNORECASE) + CLUSTER.OCRegistry = matchReg.group(1) elif re.match('^\-\-BuildId=(.+)$', myArgv, re.IGNORECASE): matchReg = re.match('^\-\-BuildId=(.+)$', myArgv, re.IGNORECASE) RAN.BuildId = matchReg.group(1) diff --git a/ci-scripts/cls_cluster.py b/ci-scripts/cls_cluster.py new file mode 100644 index 0000000000..864fb254ea --- /dev/null +++ b/ci-scripts/cls_cluster.py @@ -0,0 +1,407 @@ +#/* +# * 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 +# */ +#--------------------------------------------------------------------- +# Python for CI of OAI-eNB + COTS-UE +# +# Required Python Version +# Python 3.x +# +# Required Python Package +# pexpect +#--------------------------------------------------------------------- + +#----------------------------------------------------------- +# Import +#----------------------------------------------------------- +import logging +import sshconnection as SSH +import cls_oai_html +#import os +import re +import time +#import subprocess +import sys +import constants as CONST +import helpreadme as HELP +import cls_containerize + +class Cluster: + def __init__(self): + self.eNBIPAddress = "" + self.eNBSourceCodePath = "" + self.forcedWorkspaceCleanup = False + self.OCUserName = "" + self.OCPassword = "" + self.OCProjectName = "" + self.OCUrl = "https://api.oai.cs.eurecom.fr:6443" + self.OCRegistry = "default-route-openshift-image-registry.apps.oai.cs.eurecom.fr/" + self.ranRepository = "" + self.ranBranch = "" + self.ranCommitID = "" + self.ranAllowMerge = False + self.ranTargetBranch = "" + + def _createWorkspace(self, sshSession, password, sourcePath): + # on RedHat/CentOS .git extension is mandatory + result = re.search('([a-zA-Z0-9\:\-\.\/])+\.git', self.ranRepository) + if result is not None: + full_ran_repo_name = self.ranRepository.replace('git/', 'git') + else: + full_ran_repo_name = self.ranRepository + '.git' + sshSession.command('mkdir -p ' + sourcePath, '\$', 5) + sshSession.command('cd ' + sourcePath, '\$', 5) + sshSession.command('if [ ! -e .git ]; then stdbuf -o0 git clone ' + full_ran_repo_name + ' .; else stdbuf -o0 git fetch --prune; fi', '\$', 600) + # Raphael: here add a check if git clone or git fetch went smoothly + sshSession.command('git config user.email "jenkins@openairinterface.org"', '\$', 5) + sshSession.command('git config user.name "OAI Jenkins"', '\$', 5) + + sshSession.command('echo ' + password + ' | sudo -S git clean -x -d -ff', '\$', 30) + sshSession.command('mkdir -p cmake_targets/log', '\$', 5) + # if the commit ID is provided use it to point to it + if self.ranCommitID != '': + sshSession.command('git checkout -f ' + self.ranCommitID, '\$', 30) + # if the branch is not develop, then it is a merge request and we need to do + # the potential merge. Note that merge conflicts should already been checked earlier + if (self.ranAllowMerge): + if self.ranTargetBranch == '': + if (self.ranBranch != 'develop') and (self.ranBranch != 'origin/develop'): + sshSession.command('git merge --ff origin/develop -m "Temporary merge for CI"', '\$', 5) + else: + logging.debug('Merging with the target branch: ' + self.ranTargetBranch) + sshSession.command('git merge --ff origin/' + self.ranTargetBranch + ' -m "Temporary merge for CI"', '\$', 5) + + def _recreate_entitlements(self, sshSession): + # recreating entitlements, don't care if deletion fails + sshSession.command('oc delete secret etc-pki-entitlement', '\$', 5) + if re.search(r"not found", sshSession.getBefore()): + logging.warning("no secrets etc-pki-entitlement found, recreating") + sshSession.command('ls /etc/pki/entitlement/???????????????????.pem | tail -1', '\$', 5, silent=True) + regres1 = re.search(r"/etc/pki/entitlement/[0-9]+.pem", sshSession.getBefore()) + sshSession.command('ls /etc/pki/entitlement/???????????????????-key.pem | tail -1', '\$', 5, silent=True) + regres2 = re.search(r"/etc/pki/entitlement/[0-9]+-key.pem", sshSession.getBefore()) + if regres1 is None or regres2 is None: + logging.error("could not find entitlements") + return false + file1 = regres1.group(0) + file2 = regres2.group(0) + sshSession.command(f'oc create secret generic etc-pki-entitlement --from-file {file1} --from-file {file2}', '\$', 5) + regres = re.search(r"secret/etc-pki-entitlement created", sshSession.getBefore()) + if regres is None: + logging.error("could not create secret/etc-pki-entitlement") + return False + return True + + def _recreate_bc(self, sshSession, name, newTag, filename): + self._retag_image_statement(sshSession, name, name, newTag, filename) + sshSession.command(f'oc delete -f {filename}', '\$', 5) + sshSession.command(f'oc create -f {filename}', '\$', 5) + before = sshSession.getBefore() + if re.search('buildconfig.build.openshift.io/[a-zA-Z\-0-9]+ created', before) is not None: + return True + logging.error('error while creating buildconfig: ' + sshSession.getBefore()) + return False + + def _recreate_is(self, sshSession, name, newTag, filename): + sshSession.command(f'sed -i -e "s#tag: *latest#tag: {newTag}#" {filename}', '\$', 5) + sshSession.command(f'oc delete -f {filename}', '\$', 5) + sshSession.command(f'oc create -f {filename}', '\$', 5) + before = sshSession.getBefore() + if re.search('imagestream.image.openshift.io/[a-zA-Z\-0-9]+ created', before) is not None: + return True + logging.error('error while creating imagestream: ' + sshSession.getBefore()) + return False + + def _start_build(self, sshSession, name): + # will return "immediately" but build runs in background + # if multiple builds are started at the same time, this can take some time, however + ret = sshSession.command(f'oc start-build {name} --from-file={self.eNBSourceCodePath}', '\$', 300) + before = sshSession.getBefore() + regres = re.search(r'build.build.openshift.io/(?P[a-zA-Z0-9\-]+) started', str(before)) + if ret != 0 or before.count('Uploading finished') != 1 or regres is None: + logging.error("error during oc start-build: " + sshSession.getBefore()) + self._delete_pod(sshSession, name) + return None + return regres.group('jobname') + '-build' + + def _delete_pod(self, sshSession, shortName): + sshSession.command(f"oc get pods | grep {shortName}", '\$', 5) + regres = re.search(rf'{shortName}-[0-9]+-build', sshSession.getBefore()) + if regres is not None: + sshSession.command(f"oc delete pod {regres.group(0)}", '\$', 5) + else: + logging.warning(f"no pod found with name {shortName}") + + def _wait_build_end(self, sshSession, jobs, timeout_sec, check_interval_sec = 5): + logging.debug(f"waiting for jobs {jobs} to finish building") + while timeout_sec > 0: + # check status + for j in jobs: + sshSession.command(f'oc get pods | grep {j}', '\$', 5, silent = True) + if sshSession.getBefore().count('Completed') > 0: jobs.remove(j) + if sshSession.getBefore().count('Error') > 0: + logging.error(f'error for job {j}: ' + sshSession.getBefore()) + return False + if jobs == []: + logging.debug('all jobs completed') + return True + time.sleep(check_interval_sec) + timeout_sec -= check_interval_sec + logging.error(f"timeout while waiting for end of build of {jobs}") + return False + + def _retag_image_statement(self, sshSession, oldImage, newImage, newTag, filename): + sshSession.command(f'sed -i -e "s#{oldImage}:latest#{newImage}:{newTag}#" {filename}', '\$', 5) + + def _pull_image(self, sshSession, image, tag): + sshSession.command(f'oc whoami -t | sudo podman login -u oaicicd --password-stdin https://{self.OCRegistry} --tls-verify=false', '\$', 5, silent=True) + if sshSession.getBefore().count('Login Succeeded!') == 0: + return None + imageName = f'{self.OCRegistry}{self.OCProjectName}/{image}:{tag}' + sshSession.command(f'sudo podman pull {imageName} --tls-verify=false', '\$', 300) + pullResult = sshSession.getBefore() + sshSession.command(f'sudo podman logout https://{self.OCRegistry}', '\$', 10, silent=True) + if pullResult.count('Storing signatures') == 0: + return None + return imageName + + def _get_image_size(self, sshSession, image, tag): + # get the SHA of the image we built using the image name and its tag + sshSession.command(f'oc describe is {image} | grep -A4 {tag}', '\$', 5) + result = re.search(f'image-registry.openshift-image-registry.svc:5000/oaicicd-ran/(?P{image}@sha256:[a-f0-9]+)', sshSession.getBefore()) + if result is None: + return -1 + imageSha = result.group("imageSha") + + # retrieve the size + sshSession.command(f'oc get -o json isimage {imageSha} | jq -Mc "{{dockerImageSize: .image.dockerImageMetadata.Size}}"', '\$', 5) + result = re.search('{"dockerImageSize":(?P[0-9]+)}', str(sshSession.getBefore())) + if result is None: + return -1 + return int(result.group("size")) + + def _deploy_pod(self, sshSession, filename, timeout = 30): + sshSession.command(f'oc create -f {filename}', '\$', 10) + result = re.search(f'pod/(?P[a-zA-Z0-9_\-]+) created', sshSession.getBefore()) + if result is None: + logging.error(f'could not deploy pod: {sshSession.getBefore()}') + return None + pod = result.group("pod") + logging.debug(f'checking if pod {pod} is in Running state') + while timeout > 0: + sshSession.command(f'oc get pod {pod} -o json | jq -Mc .status.phase', '\$', 5, silent=True) + if re.search('"Running"', sshSession.getBefore()) is not None: return pod + timeout -= 1 + time.sleep(1) + logging.error(f'pod {pod} did not reach Running state') + self._undeploy_pod(sshSession, filename) + return None + + def _undeploy_pod(self, sshSession, filename): + # to save time we start this in the background and trust that oc stops correctly + sshSession.command(f'oc delete -f {filename} &', '\$', 5) + + def BuildClusterImage(self, HTML): + if self.ranRepository == '' or self.ranBranch == '' or self.ranCommitID == '': + HELP.GenericHelp(CONST.Version) + sys.exit(f'Insufficient Parameter: ranRepository {self.ranRepository} ranBranch {ranBranch} ranCommitID {self.ranCommitID}') + + lIpAddr = self.eNBIPAddress + lSourcePath = self.eNBSourceCodePath + if lIpAddr == '' or lSourcePath == '': + HELP.GenericHelp(CONST.Version) + sys.exit('Insufficient Parameter: no SSH Credentials') + ocUserName = self.OCUserName + ocPassword = self.OCPassword + ocProjectName = self.OCProjectName + if ocUserName == '' or ocPassword == '' or ocProjectName == '': + HELP.GenericHelp(CONST.Version) + sys.exit('Insufficient Parameter: no OC Credentials') + if self.OCRegistry.startswith("http") and not self.OCRegistry.endswith("/"): + sys.exit(f'ocRegistry {self.OCRegistry} should not start with http:// or https:// and end on a slash /') + + logging.debug(f'Building on cluster triggered from server: {lIpAddr}') + mySSH = SSH.SSHConnection() + mySSH.open(lIpAddr, "oaicicd", "SHOULD NOT BE NECESSARY") + + self.testCase_id = HTML.testCase_id + + # Workaround for some servers, we need to erase completely the workspace + if self.forcedWorkspaceCleanup: + mySSH.command(f'sudo rm -Rf {lSourcePath}', '\$', 15) + self._createWorkspace(mySSH, "SHOULD NOT BE NECESSARY", lSourcePath) + + # we don't necessarily need a forced workspace cleanup, but in + # order to reduce the amount of data send to OpenShift, we + # manually delete all generated files in the workspace + mySSH.command(f'rm -rf {lSourcePath}/cmake_targets/ran_build', '\$', 30); + + baseTag = 'develop' + forceBaseImageBuild = False + imageTag = 'develop' + if self.ranAllowMerge: # merging MR branch into develop -> temporary image + imageTag = 'ci-temp' + if self.ranTargetBranch == 'develop': + # TODO IMPORTANT: delete next line, uncomment following + mySSH.command(f'git diff HEAD..origin/develop -- cmake_targets/build_oai cmake_targets/tools/build_helper | grep --colour=never -i INDEX', '\$', 5) + #mySSH.command(f'git diff HEAD..origin/develop -- cmake_targets/build_oai cmake_targets/tools/build_helper docker/Dockerfile.base.rhel8.2 | grep --colour=never -i INDEX', '\$', 5) + result = re.search('index', mySSH.getBefore()) + if result is not None: + forceBaseImageBuild = True + baseTag = 'ci-temp' + else: + forceBaseImageBuild = True + + # logging to OC Cluster and then switch to corresponding project + mySSH.command(f'oc login -u {ocUserName} -p {ocPassword} --server {self.OCUrl}', '\$', 31) + if mySSH.getBefore().count('Login successful.') == 0: + logging.error('\u001B[1m OC Cluster Login Failed\u001B[0m') + mySSH.close() + HTML.CreateHtmlTestRow('N/A', 'KO', CONST.OC_LOGIN_FAIL) + return False + + mySSH.command(f'oc project {ocProjectName}', '\$', 30) + if mySSH.getBefore().count(f'Already on project "{ocProjectName}"') == 0 and mySSH.getBefore().count(f'Now using project "{self.OCProjectName}"') == 0: + logging.error(f'\u001B[1mUnable to access OC project {ocProjectName}\u001B[0m') + mySSH.command('oc logout', '\$', 30) + mySSH.close() + HTML.CreateHtmlTestRow('N/A', 'KO', CONST.OC_PROJECT_FAIL) + return False + + self._recreate_entitlements(mySSH) + + status = True # flag to abandon compiling if any image fails + attemptedImages = [] + if forceBaseImageBuild: + self._recreate_is(mySSH, 'ran-base', baseTag, 'openshift/ran-base-is.yaml') + self._recreate_bc(mySSH, 'ran-base', baseTag, 'openshift/ran-base-bc.yaml') + ranbase_job = self._start_build(mySSH, 'ran-base') + attemptedImages += ['ran-base'] + status = ranbase_job is not None and self._wait_build_end(mySSH, [ranbase_job], 600) + if not status: logging.error('failure during build of ran-base') + mySSH.command(f'oc logs {ranbase_job} > cmake_targets/log/ran-base.log', '\$', 10) + # recover logs by mounting image + self._retag_image_statement(mySSH, 'ran-base', 'ran-base', baseTag, 'openshift/ran-base-log-retrieval.yaml') + pod = self._deploy_pod(mySSH, 'openshift/ran-base-log-retrieval.yaml') + if pod is not None: + mySSH.command(f'mkdir -p cmake_targets/log/ran-base', '\$', 5) + mySSH.command(f'oc rsync {pod}:/oai-ran/cmake_targets/log cmake_targets/log/ran-base', '\$', 5) + self._undeploy_pod(mySSH, 'openshift/ran-base-log-retrieval.yaml') + else: + status = False + + if status: + self._recreate_is(mySSH, 'oai-physim', imageTag, 'openshift/oai-physim-is.yaml') + self._recreate_bc(mySSH, 'oai-physim', imageTag, 'openshift/oai-physim-bc.yaml') + self._retag_image_statement(mySSH, 'ran-base', 'image-registry.openshift-image-registry.svc:5000/oaicicd-ran/ran-base', baseTag, 'docker/Dockerfile.phySim.rhel8.2') + physim_job = self._start_build(mySSH, 'oai-physim') + attemptedImages += ['oai-physim'] + + self._recreate_is(mySSH, 'ran-build', imageTag, 'openshift/ran-build-is.yaml') + self._recreate_bc(mySSH, 'ran-build', imageTag, 'openshift/ran-build-bc.yaml') + self._retag_image_statement(mySSH, 'ran-base', 'image-registry.openshift-image-registry.svc:5000/oaicicd-ran/ran-base', baseTag, 'docker/Dockerfile.build.rhel8.2') + ranbuild_job = self._start_build(mySSH, 'ran-build') + attemptedImages += ['ran-build'] + + wait = ranbuild_job is not None and physim_job is not None and self._wait_build_end(mySSH, [ranbuild_job, physim_job], 1200) + if not wait: logging.error('error during build of ranbuild_job or physim_job') + status = status and wait + mySSH.command(f'oc logs {ranbuild_job} > cmake_targets/log/ran-build.log', '\$', 10) + mySSH.command(f'oc logs {physim_job} > cmake_targets/log/oai-physim.log', '\$', 10) + + if status: + self._recreate_is(mySSH, 'oai-enb', imageTag, 'openshift/oai-enb-is.yaml') + self._recreate_bc(mySSH, 'oai-enb', imageTag, 'openshift/oai-enb-bc.yaml') + self._retag_image_statement(mySSH, 'ran-base', 'image-registry.openshift-image-registry.svc:5000/oaicicd-ran/ran-base', baseTag, 'docker/Dockerfile.eNB.rhel8.2') + self._retag_image_statement(mySSH, 'ran-build', 'image-registry.openshift-image-registry.svc:5000/oaicicd-ran/ran-build', imageTag, 'docker/Dockerfile.eNB.rhel8.2') + enb_job = self._start_build(mySSH, 'oai-enb') + attemptedImages += ['oai-enb'] + + self._recreate_is(mySSH, 'oai-gnb', imageTag, 'openshift/oai-gnb-is.yaml') + self._recreate_bc(mySSH, 'oai-gnb', imageTag, 'openshift/oai-gnb-bc.yaml') + self._retag_image_statement(mySSH, 'ran-base', 'image-registry.openshift-image-registry.svc:5000/oaicicd-ran/ran-base', baseTag, 'docker/Dockerfile.gNB.rhel8.2') + self._retag_image_statement(mySSH, 'ran-build', 'image-registry.openshift-image-registry.svc:5000/oaicicd-ran/ran-build', imageTag, 'docker/Dockerfile.gNB.rhel8.2') + gnb_job = self._start_build(mySSH, 'oai-gnb') + attemptedImages += ['oai-gnb'] + + self._recreate_is(mySSH, 'oai-lte-ue', imageTag, 'openshift/oai-lte-ue-is.yaml') + self._recreate_bc(mySSH, 'oai-lte-ue', imageTag, 'openshift/oai-lte-ue-bc.yaml') + self._retag_image_statement(mySSH, 'ran-base', 'image-registry.openshift-image-registry.svc:5000/oaicicd-ran/ran-base', baseTag, 'docker/Dockerfile.lteUE.rhel8.2') + self._retag_image_statement(mySSH, 'ran-build', 'image-registry.openshift-image-registry.svc:5000/oaicicd-ran/ran-build', imageTag, 'docker/Dockerfile.lteUE.rhel8.2') + lteue_job = self._start_build(mySSH, 'oai-lte-ue') + attemptedImages += ['oai-lte-ue'] + + self._recreate_is(mySSH, 'oai-nr-ue', imageTag, 'openshift/oai-nr-ue-is.yaml') + self._recreate_bc(mySSH, 'oai-nr-ue', imageTag, 'openshift/oai-nr-ue-bc.yaml') + self._retag_image_statement(mySSH, 'ran-base', 'image-registry.openshift-image-registry.svc:5000/oaicicd-ran/ran-base', baseTag, 'docker/Dockerfile.nrUE.rhel8.2') + self._retag_image_statement(mySSH, 'ran-build', 'image-registry.openshift-image-registry.svc:5000/oaicicd-ran/ran-build', imageTag, 'docker/Dockerfile.nrUE.rhel8.2') + nrue_job = self._start_build(mySSH, 'oai-nr-ue') + attemptedImages += ['oai-nr-ue'] + + wait = enb_job is not None and gnb_job is not None and lteue_job is not None and nrue_job is not None and self._wait_build_end(mySSH, [enb_job, gnb_job, lteue_job, nrue_job], 600) + if not wait: logging.error('error during build of eNB/gNB/lteUE/nrUE') + status = status and wait + # recover logs + mySSH.command(f'oc logs {enb_job} > cmake_targets/log/oai-enb.log', '\$', 10) + mySSH.command(f'oc logs {gnb_job} > cmake_targets/log/oai-gnb.log', '\$', 10) + mySSH.command(f'oc logs {lteue_job} > cmake_targets/log/oai-lte-ue.log', '\$', 10) + mySSH.command(f'oc logs {nrue_job} > cmake_targets/log/oai-nr-ue.log', '\$', 10) + + # split and analyze logs + imageSize = {} + for image in attemptedImages: + mySSH.command(f'mkdir -p cmake_targets/log/{image}', '\$', 5) + mySSH.command(f'python3 ci-scripts/docker_log_split.py --logfilename=cmake_targets/log/{image}.log', '\$', 5) + tag = imageTag if image != 'ran-base' else baseTag + size = self._get_image_size(mySSH, image, tag) + if size <= 0: + imageSize[image] = 'unknown -- BUILD FAILED' + status = False + else: + sizeMb = float(size) / 1000000 + imageSize[image] = f'{sizeMb:.1f} Mbytes (uncompressed: ~{sizeMb*2.5:.1f} Mbytes)' + logging.info(f'\u001B[1m{image} size is {imageSize[image]}\u001B[0m') + + build_log_name = f'build_log_{self.testCase_id}' + cls_containerize.CopyLogsToExecutor(mySSH, lSourcePath, build_log_name, lIpAddr, 'oaicicd', 'SHOULD NOT MATTER') + + mySSH.command('for pod in $(oc get pods | tail -n +2 | awk \'{print $1}\'); do oc delete pod ${pod}; done', '\$', 60) + + mySSH.command('oc logout', '\$', 30) + mySSH.close() + + # Analyze the logs + collectInfo = cls_containerize.AnalyzeBuildLogs(build_log_name, attemptedImages, status) + for img in collectInfo: + for f in collectInfo[img]: + status = status and collectInfo[img][f]['status'] + if not status: + logging.debug(collectInfo) + + if status: + logging.info('\u001B[1m Building OAI Image(s) Pass\u001B[0m') + HTML.CreateHtmlTestRow('all', 'OK', CONST.ALL_PROCESSES_OK) + else: + logging.error('\u001B[1m Building OAI Images Failed\u001B[0m') + HTML.CreateHtmlTestRow('all', 'KO', CONST.ALL_PROCESSES_OK) + + HTML.CreateHtmlNextTabHeaderTestRow(collectInfo, imageSize) + + return status diff --git a/ci-scripts/main.py b/ci-scripts/main.py index 8b18989a26..b5d0ef2d97 100644 --- a/ci-scripts/main.py +++ b/ci-scripts/main.py @@ -45,6 +45,7 @@ import cls_containerize #class Containerize for all container-based oper import cls_static_code_analysis #class for static code analysis import cls_ci_ueinfra #class defining the multi Ue infrastrucure import cls_physim1 #class PhySim for physical simulators deploy and run +import cls_cluster # class for building/deploying on cluster import sshconnection import epc @@ -102,15 +103,17 @@ def AssignParams(params_dict): def GetParametersFromXML(action): - if action == 'Build_eNB' or action == 'Build_Image' or action == 'Build_Proxy': + if action == 'Build_eNB' or action == 'Build_Image' or action == 'Build_Proxy' or action == "Build_Cluster_Image": RAN.Build_eNB_args=test.findtext('Build_eNB_args') CONTAINERS.imageKind=test.findtext('kind') forced_workspace_cleanup = test.findtext('forced_workspace_cleanup') RAN.Build_eNB_forced_workspace_cleanup=False CONTAINERS.forcedWorkspaceCleanup=False + CLUSTER.forcedWorkspaceCleanup = False if forced_workspace_cleanup is not None and re.match('true', forced_workspace_cleanup, re.IGNORECASE): RAN.Build_eNB_forced_workspace_cleanup = True CONTAINERS.forcedWorkspaceCleanup = True + CLUSTER.forcedWorkspaceCleanup = True eNB_instance=test.findtext('eNB_instance') if (eNB_instance is None): RAN.eNB_instance=0 @@ -529,6 +532,7 @@ HTML = cls_oai_html.HTMLManagement() CONTAINERS = cls_containerize.Containerize() SCA = cls_static_code_analysis.StaticCodeAnalysis() PHYSIM = cls_physim1.PhySim() +CLUSTER = cls_cluster.Cluster() ldpc=cls_physim.PhySim() #create an instance for LDPC test using GPU or CPU build @@ -538,7 +542,7 @@ ldpc=cls_physim.PhySim() #create an instance for LDPC test using GPU or CPU b #----------------------------------------------------------- import args_parse -py_param_file_present, py_params, mode = args_parse.ArgsParse(sys.argv,CiTestObj,RAN,HTML,EPC,ldpc,CONTAINERS,HELP,SCA,PHYSIM) +py_param_file_present, py_params, mode = args_parse.ArgsParse(sys.argv,CiTestObj,RAN,HTML,EPC,ldpc,CONTAINERS,HELP,SCA,PHYSIM,CLUSTER) @@ -926,6 +930,9 @@ elif re.match('^TesteNB$', mode, re.IGNORECASE) or re.match('^TestUE$', mode, re HTML=ldpc.Run_NRulsimTest(HTML,CONST,id) if ldpc.exitStatus==1: RAN.prematureExit = True + elif action == 'Build_Cluster_Image': + if not CLUSTER.BuildClusterImage(HTML): + RAN.prematureExit = True elif action == 'Build_Image': CONTAINERS.BuildImage(HTML) elif action == 'Build_Proxy': diff --git a/ci-scripts/xml_class_list.yml b/ci-scripts/xml_class_list.yml index f9894d501f..6497fd3020 100755 --- a/ci-scripts/xml_class_list.yml +++ b/ci-scripts/xml_class_list.yml @@ -1,4 +1,5 @@ - Build_Proxy + - Build_Cluster_Image - Build_PhySim - Run_LDPCTest - Run_NRulsimTest diff --git a/ci-scripts/xml_files/cluster_image_build.xml b/ci-scripts/xml_files/cluster_image_build.xml new file mode 100644 index 0000000000..057d49da86 --- /dev/null +++ b/ci-scripts/xml_files/cluster_image_build.xml @@ -0,0 +1,35 @@ + + + + build-tab + Build Images on Cluster + wrench + 000001 + + + + Build_Cluster_Image + Build Images on OpenShift Cluster + + + diff --git a/openshift/oai-physim-bc.yaml b/openshift/oai-physim-bc.yaml index 050dd8bca8..e013a20fd3 100644 --- a/openshift/oai-physim-bc.yaml +++ b/openshift/oai-physim-bc.yaml @@ -31,10 +31,6 @@ spec: strategy: dockerStrategy: dockerfilePath: "docker/Dockerfile.phySim.rhel8.2" - from: - kind: ImageStreamTag - namespace: oaicicd-ran - name: oai-ran-base:latest output: to: kind: "ImageStreamTag" diff --git a/openshift/ran-base-log-retrieval.yaml b/openshift/ran-base-log-retrieval.yaml new file mode 100644 index 0000000000..7fc1d78cc6 --- /dev/null +++ b/openshift/ran-base-log-retrieval.yaml @@ -0,0 +1,13 @@ +# Creating a pod to retrieve ran-base logs +apiVersion: v1 +kind: Pod +metadata: + name: ran-base-log-retrieval + namespace: oaicicd-ran +spec: + containers: + - name: logcontainer + image: ran-base:latest + command: ["/bin/sh", "-c"] + args: + ["sleep inf"] diff --git a/openshift/ran-build-bc.yaml b/openshift/ran-build-bc.yaml index db144569b6..84b0f9e589 100644 --- a/openshift/ran-build-bc.yaml +++ b/openshift/ran-build-bc.yaml @@ -31,10 +31,6 @@ spec: strategy: dockerStrategy: dockerfilePath: "docker/Dockerfile.build.rhel8.2" - from: - kind: ImageStreamTag # Use an imagestream tag as 'FROM' - namespace: oaicicd-ran # Which project? - name: oai-ran-base:latest # Use the imagestream created above output: to: kind: "ImageStreamTag" From 07783676339325c394fbe1dbc6e0be836ff3ec87 Mon Sep 17 00:00:00 2001 From: Robert Schmidt Date: Fri, 2 Sep 2022 13:21:04 +0200 Subject: [PATCH 47/88] Add Jenkinsfile for cluster jobs --- ci-scripts/Jenkinsfile-cluster | 254 +++++++++++++++++++++++++++++++++ 1 file changed, 254 insertions(+) create mode 100644 ci-scripts/Jenkinsfile-cluster diff --git a/ci-scripts/Jenkinsfile-cluster b/ci-scripts/Jenkinsfile-cluster new file mode 100644 index 0000000000..e3f7da6141 --- /dev/null +++ b/ci-scripts/Jenkinsfile-cluster @@ -0,0 +1,254 @@ +#!/bin/groovy +/* + * 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 + */ + +// Location of the executor node +def pythonExecutor = params.pythonExecutor + +// Location of the test XML file to be run +def testXMLFile = params.pythonTestXmlFile +def mainPythonAllXmlFiles = "" +def buildStageStatus = true + +// Name of the test stage +def testStageName = params.pipelineTestStageName + +// Name of the resource +def lockResources = [] +if (params.LockResources != null && params.LockResources.trim().length() > 0) + params.LockResources.trim().split(",").each{lockResources += [resource: it.trim()]} + +// Global Parameters. Normally they should be populated when the master job +// triggers the slave job with parameters +def eNB_Repository +def eNB_Branch +def eNB_CommitID +def eNB_AllowMergeRequestProcess = false +def eNB_TargetBranch + +def directoryExistsGlob(fileNameWithGlob) { + /* if multiple directories match, will join their names and call fileExists() on that */ + def dir = sh returnStdout: true, script: 'find . -name \'' + fileNameWithGlob + '\' -type d' + dir = dir.replaceAll("\n", "").trim() + echo "matching '" + fileNameWithGlob + "' found: '" + dir + "'" + if (dir == "") + return false + return fileExists(dir) +} + +//------------------------------------------------------------------------------- +// Pipeline start +pipeline { + agent { + label pythonExecutor + } + options { + disableConcurrentBuilds() + timestamps() + ansiColor('xterm') + lock(extra: lockResources) + } + + stages { + stage ('Verify Parameters') { + steps { + script { + echo '\u2705 \u001B[32mVerify Parameters\u001B[0m' + + JOB_TIMESTAMP = sh returnStdout: true, script: 'date --utc --rfc-3339=seconds | sed -e "s#+00:00##"' + JOB_TIMESTAMP = JOB_TIMESTAMP.trim() + + def allParametersPresent = true + + // It is already to late to check it + if (params.pythonExecutor != null) { + echo "eNB CI executor node : ${pythonExecutor}" + } + // If not present picking a default Stage Name + if (params.pipelineTestStageName == null) { + // picking default + testStageName = 'Template Test Stage' + } + + if (params.LockResources == null) { + echo "no LockResources given" + allParametersPresent = false + } + if (params.eNB_IPAddress == null) { + echo "no eNB_IPAddress given" + allParametersPresent = false + } + if (params.eNB_SourceCodePath == null) { + echo "no eNB_SourceCodePath given" + allParametersPresent = false + } + if (params.eNB_Credentials == null) { + echo "no eNB_Credentials given" + allParametersPresent = false + } + // the following 4 parameters should be pushed by the master trigger + // if not present, take the job GIT variables (used for developing) + if (params.eNB_Repository == null) { + eNB_Repository = env.GIT_URL + } else { + eNB_Repository = params.eNB_Repository + } + echo "eNB_Repository : ${eNB_Repository}" + if (params.eNB_Branch == null) { + eNB_Branch = env.GIT_BRANCH + } else { + eNB_Branch = params.eNB_Branch + } + echo "eNB_Branch : ${eNB_Branch}" + if (params.eNB_CommitID == null) { + eNB_CommitID = env.GIT_COMMIT + } else { + eNB_CommitID = params.eNB_CommitID + } + echo "eNB_CommitID : ${eNB_CommitID}" + if (params.eNB_mergeRequest != null) { + eNB_AllowMergeRequestProcess = params.eNB_mergeRequest + if (eNB_AllowMergeRequestProcess) { + if (params.eNB_TargetBranch != null) { + eNB_TargetBranch = params.eNB_TargetBranch + } else { + eNB_TargetBranch = 'develop' + } + echo "eNB_TargetBranch : ${eNB_TargetBranch}" + } + } else { + echo "no eNB_mergeRequest given - not merging develop" + } + + if (params.EPC_IPAddress == null) { + echo "no EPC_IPAddress given" + allParametersPresent = false + } + if (params.EPC_Type == null) { + echo "no EPC_Type given" + allParametersPresent = false + } + if (params.EPC_SourceCodePath == null) { + echo "no EPC_SourceCodePath given" + allParametersPresent = false + } + if (params.EPC_Credentials == null) { + echo "no EPC_Credentials given" + allParametersPresent = false + } + + if (params.ADB_IPAddress == null) { + echo "no ADB_IPAddress given" + allParametersPresent = false + } + if (params.ADB_Credentials == null) { + echo "no ADB_IPAddress given" + allParametersPresent = false + } + if (params.OC_Credentials == null) { + echo "no OC_Credentials given" + allParametersPresent = false + } + if (params.OC_ProjectName == null) { + echo "no OC_ProjectName given" + allParametersPresent = false + } + if (params.pythonTestXmlFile == null) { + echo "no pythonTestXmlFile given" + allParametersPresent = false + } + if (allParametersPresent) { + echo "All parameters are present" + if (eNB_AllowMergeRequestProcess) { + sh "git fetch" + sh "./ci-scripts/doGitLabMerge.sh --src-branch ${eNB_Branch} --src-commit ${eNB_CommitID} --target-branch ${eNB_TargetBranch} --target-commit latest" + } else { + sh "git fetch" + sh "git checkout -f ${eNB_CommitID}" + } + } else { + echo "Some parameters are missing" + sh "./ci-scripts/fail.sh" + } + } + } + } + + stage ("Deploy and Test") { + steps { + script { + dir ('ci-scripts') { + echo "\u2705 \u001B[32m${testStageName}\u001B[0m" + String[] myXmlTestSuite = testXMLFile.split("\\r?\\n") + for (xmlFile in myXmlTestSuite) { + if (fileExists(xmlFile)) { + mainPythonAllXmlFiles += "--XMLTestFile=" + xmlFile + " " + echo "Test XML file : ${xmlFile}" + } + } + withCredentials([ + [$class: 'UsernamePasswordMultiBinding', credentialsId: "${params.eNB_Credentials}", usernameVariable: 'eNB_Username', passwordVariable: 'eNB_Password'], + [$class: 'UsernamePasswordMultiBinding', credentialsId: "${params.EPC_Credentials}", usernameVariable: 'EPC_Username', passwordVariable: 'EPC_Password'], + [$class: 'UsernamePasswordMultiBinding', credentialsId: "${params.ADB_Credentials}", usernameVariable: 'ADB_Username', passwordVariable: 'ADB_Password'], + [$class: 'UsernamePasswordMultiBinding', credentialsId: "${params.OC_Credentials}", usernameVariable: 'OC_Username', passwordVariable: 'OC_Password'] + ]) { + sh "python3 main.py --mode=InitiateHtml --ranRepository=${eNB_Repository} --ranBranch=${eNB_Branch} --ranCommitID=${eNB_CommitID} --ranAllowMerge=${eNB_AllowMergeRequestProcess} --ranTargetBranch=${eNB_TargetBranch} --ADBIPAddress=${params.ADB_IPAddress} --ADBUserName=${ADB_Username} --ADBPassword=${ADB_Password} ${mainPythonAllXmlFiles}" + for (xmlFile in myXmlTestSuite) { + if (fileExists(xmlFile)) { + try { + sh "python3 main.py --mode=TesteNB --eNBIPAddress=${params.eNB_IPAddress} --ranRepository=${eNB_Repository} --ranBranch=${eNB_Branch} --ranCommitID=${eNB_CommitID} --ranAllowMerge=${eNB_AllowMergeRequestProcess} --ranTargetBranch=${eNB_TargetBranch} --eNBUserName=${eNB_Username} --eNBPassword=${eNB_Password} --eNBSourceCodePath=${params.eNB_SourceCodePath} --EPCIPAddress=${params.EPC_IPAddress} --EPCType=${params.EPC_Type} --EPCUserName=${EPC_Username} --EPCPassword=${EPC_Password} --EPCSourceCodePath=${params.EPC_SourceCodePath} --ADBIPAddress=${params.ADB_IPAddress} --ADBUserName=${ADB_Username} --ADBPassword=${ADB_Password} --XMLTestFile=${xmlFile} --OCUserName=${OC_Username} --OCPassword=${OC_Password} --OCProjectName=${OC_ProjectName}" + } catch (Exception e) { + currentBuild.result = 'FAILURE' + buildStageStatus = false + } + } + } + sh "python3 main.py --mode=FinalizeHtml --finalStatus=${buildStageStatus} --eNBIPAddress=${params.eNB_IPAddress} --eNBUserName=${eNB_Username} --eNBPassword=${eNB_Password}" + } + } + } + } + } + stage ("Log Collection") { + steps { + script { + dir ('ci-scripts') { + if (directoryExistsGlob("build_log_*")) { + sh "zip -r -qq build_log_${env.BUILD_ID}.zip build_log_*/*" + sh "rm -rf build_log_*/" + archiveArtifacts artifacts: "build_log_${env.BUILD_ID}.zip" + } + if (directoryExistsGlob("test_log_*")) { + sh "zip -r -qq test_log_${env.BUILD_ID}.zip test_log_*/*" + sh "rm -rf test_log_*/" + archiveArtifacts artifacts: "test_log_${env.BUILD_ID}.zip" + } + if (fileExists("test_results.html")) { + sh "mv test_results.html test_results-${env.JOB_NAME}.html" + sh "sed -i -e 's#TEMPLATE_JOB_NAME#${JOB_NAME}#' -e 's@build #TEMPLATE_BUILD_ID@build #${BUILD_ID}@' -e 's#Build-ID: TEMPLATE_BUILD_ID#Build-ID: ${BUILD_ID}#' -e 's#TEMPLATE_STAGE_NAME#${testStageName}#' test_results-${JOB_NAME}.html" + archiveArtifacts artifacts: "test_results-${env.JOB_NAME}.html" + } + } + } + } + } + } +} From 5008eb4e38b448a792582583a8a2d398b38386f7 Mon Sep 17 00:00:00 2001 From: Robert Schmidt Date: Mon, 5 Sep 2022 15:11:33 +0200 Subject: [PATCH 48/88] Switch to RHEL8-Cluster-Image-Builder in RAN-Container-Parent --- ci-scripts/Jenkinsfile-GitLab-Container | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/ci-scripts/Jenkinsfile-GitLab-Container b/ci-scripts/Jenkinsfile-GitLab-Container index 89665f292f..c8fb565488 100644 --- a/ci-scripts/Jenkinsfile-GitLab-Container +++ b/ci-scripts/Jenkinsfile-GitLab-Container @@ -136,16 +136,16 @@ pipeline { } } } - stage ("RHEL8 Build") { + stage ("RHEL8-Cluster-Image-Builder") { steps { script { - triggerSlaveJob ('RAN-RHEL8-Image-Builder', 'RHEL8-Images-Build') + triggerSlaveJob ('RAN-RHEL8-Cluster-Image-Builder', 'RHEL8-Cluster-Image-Builder') } } post { always { script { - finalizeSlaveJob('RAN-RHEL8-Image-Builder') + finalizeSlaveJob('RAN-RHEL8-Cluster-Image-Builder') } } failure { From 6ac9296a12f7a749824a2818f8821d17d5325d8d Mon Sep 17 00:00:00 2001 From: Robert Schmidt Date: Mon, 5 Sep 2022 15:39:23 +0200 Subject: [PATCH 49/88] Update TESTBenches.doc --- doc/TESTBenches.md | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/doc/TESTBenches.md b/doc/TESTBenches.md index c9a9870953..dd14817863 100644 --- a/doc/TESTBenches.md +++ b/doc/TESTBenches.md @@ -105,8 +105,9 @@ Webhook - [RAN-RF-Sim-Test-5G](https://jenkins-oai.eurecom.fr/job/RAN-RF-Sim-Test-5G/) - obelix (gNB, 2x UE, OAI 5GC) - uses RFsimulator, TDD 40MHz, FDD 40MHz, F1 split -- [RAN-RHEL8-Image-Builder](https://jenkins-oai.eurecom.fr/job/RAN-RHEL8-Image-Builder/) - - asterix: RHEL 8 image build using podman +- [RAN-RHEL8-Cluster-Image-Builder](https://jenkins-oai.eurecom.fr/job/RAN-RHEL8-Cluster-Image-Builder/) + - asterix (`Asterix-OC-oaicicd-session` resource): RHEL 8 image build using + the OpenShift in Eurecom - [RAN-Ubuntu18-Image-Builder](https://jenkins-oai.eurecom.fr/job/RAN-Ubuntu18-Image-Builder/) - obelix: Ubuntu 18 image build using docker From bf853fe3f19bef76bd55ddb382bac03c421575af Mon Sep 17 00:00:00 2001 From: Robert Schmidt Date: Sat, 18 Jun 2022 16:11:23 +0200 Subject: [PATCH 50/88] Sanitize NSSAI configuration Following changes included: - SD is optional: when value is 0xffffff or not present in config (previously: needed to be set to 0) - Checks SSTs in range [0,255] - Checks SDs in range [0,0xffffff] - Correct typo SST defines --- openair2/GNB_APP/gnb_config.c | 5 +++-- openair2/GNB_APP/gnb_paramdef.h | 17 +++++++++-------- 2 files changed, 12 insertions(+), 10 deletions(-) diff --git a/openair2/GNB_APP/gnb_config.c b/openair2/GNB_APP/gnb_config.c index 88f74cd1c9..25df321b3a 100644 --- a/openair2/GNB_APP/gnb_config.c +++ b/openair2/GNB_APP/gnb_config.c @@ -1465,9 +1465,10 @@ int RCconfig_NR_NG(MessageDef *msg_p, uint32_t i) { NGAP_REGISTER_GNB_REQ (msg_p).num_nssai[l] = SNSSAIParamList.numelt; for (int s = 0; s < SNSSAIParamList.numelt; ++s) { - NGAP_REGISTER_GNB_REQ (msg_p).s_nssai[l][s].sST = *SNSSAIParamList.paramarray[s][GNB_SLICE_SERIVE_TYPE_IDX].uptr; + NGAP_REGISTER_GNB_REQ (msg_p).s_nssai[l][s].sST = *SNSSAIParamList.paramarray[s][GNB_SLICE_SERVICE_TYPE_IDX].uptr; NGAP_REGISTER_GNB_REQ (msg_p).s_nssai[l][s].sD_flag = 0; - if(*SNSSAIParamList.paramarray[s][GNB_SLICE_DIFFERENTIATOR_IDX].uptr != 0) { + if(SNSSAIParamList.paramarray[s][GNB_SLICE_DIFFERENTIATOR_IDX].uptr != 0 // SD is optional + && *SNSSAIParamList.paramarray[s][GNB_SLICE_DIFFERENTIATOR_IDX].uptr != 0xffffff) { // 0xffffff is "no SD", see 23.003 Sec 28.4.2 NGAP_REGISTER_GNB_REQ (msg_p).s_nssai[l][s].sD_flag = 1; NGAP_REGISTER_GNB_REQ (msg_p).s_nssai[l][s].sD[0] = (*SNSSAIParamList.paramarray[s][GNB_SLICE_DIFFERENTIATOR_IDX].uptr & 0xFF0000) >> 16; NGAP_REGISTER_GNB_REQ (msg_p).s_nssai[l][s].sD[1] = (*SNSSAIParamList.paramarray[s][GNB_SLICE_DIFFERENTIATOR_IDX].uptr & 0x00FF00) >> 8; diff --git a/openair2/GNB_APP/gnb_paramdef.h b/openair2/GNB_APP/gnb_paramdef.h index 1298434679..9572d16d8f 100644 --- a/openair2/GNB_APP/gnb_paramdef.h +++ b/openair2/GNB_APP/gnb_paramdef.h @@ -245,23 +245,24 @@ typedef enum { #define GNB_CONFIG_STRING_SNSSAI_LIST "snssaiList" -#define GNB_CONFIG_STRING_SLICE_SERIVE_TYPE "sst" +#define GNB_CONFIG_STRING_SLICE_SERVICE_TYPE "sst" #define GNB_CONFIG_STRING_SLICE_DIFFERENTIATOR "sd" -#define GNB_SLICE_SERIVE_TYPE_IDX 0 +#define GNB_SLICE_SERVICE_TYPE_IDX 0 #define GNB_SLICE_DIFFERENTIATOR_IDX 1 #define GNBSNSSAIPARAMS_DESC { \ -/* optname helpstr paramflags XXXptr def val type numelt */ \ - {GNB_CONFIG_STRING_SLICE_SERIVE_TYPE, "slice serive type", 0, uptr:NULL, defuintval:1, TYPE_UINT, 0}, \ - {GNB_CONFIG_STRING_SLICE_DIFFERENTIATOR, "slice differentiator", 0, uptr:NULL, defuintval:0, TYPE_UINT, 0}, \ +/* optname helpstr paramflags XXXptr def val type numelt */ \ + {GNB_CONFIG_STRING_SLICE_SERVICE_TYPE, "slice service type", 0, uptr:NULL, defuintval:1, TYPE_UINT, 0}, \ + {GNB_CONFIG_STRING_SLICE_DIFFERENTIATOR, "slice differentiator", 0, uptr:NULL, defuintval:0xffffff, TYPE_UINT, 0}, \ } -#define SLICE_SERIVE_TYPE_OKRANGES {1,2,3,4} +#define SLICE_SERVICE_TYPE_OKRANGE {0, 255} +#define SLICE_DIFFERENTIATOR_TYPE_OKRANGE {0, 0xffffff} #define SNSSAIPARAMS_CHECK { \ - { .s1 = { config_check_intval, SLICE_SERIVE_TYPE_OKRANGES, 4 } }, \ - { .s5 = { NULL } }, \ + { .s2 = { config_check_intrange, SLICE_SERVICE_TYPE_OKRANGE } }, \ + { .s2 = { config_check_intrange, SLICE_DIFFERENTIATOR_TYPE_OKRANGE } }, \ } /* AMF configuration parameters section name */ From c859c233f73e41958629895f0c5ea6d451d4fd45 Mon Sep 17 00:00:00 2001 From: Robert Schmidt Date: Mon, 20 Jun 2022 17:08:08 +0200 Subject: [PATCH 51/88] Simplify NSSAI configuration in all configuration files --- ...sci_gnb.band78.sa.fr1.106PRB.usrpn310.conf | 17 +--------------- ...oxy_gnb.band78.sa.fr1.106PRB.usrpn310.conf | 17 +--------------- ci-scripts/conf_files/gNB_SA_CU.conf | 17 +--------------- ci-scripts/conf_files/gNB_SA_DU.conf | 17 +--------------- .../gNB_SA_n78_106PRB.2x2_usrpn310.conf | 16 +-------------- .../gNB_SA_n78_133PRB.2x2_usrpn310.conf | 16 +-------------- ...and78.sa.fr1.106PRB.2x2.usrpn310.asue.conf | 20 +------------------ ...gnb.band78.sa.fr1.106PRB.2x2.usrpn310.conf | 16 +-------------- ...nd78.sa.fr1.106PRB.ddsuu.2x2.usrpn310.conf | 16 +-------------- .../gnb.band78.sa.fr1.106PRB.usrpn310.conf | 16 +-------------- ...gnb.band78.sa.fr1.162PRB.2x2.usrpn310.conf | 16 +-------------- .../gnb.sa.band66.fr1.106PRB.usrpn300.conf | 17 +--------------- .../gnb.sa.band78.fr1.106PRB.usrpb210.conf | 13 +----------- .../gnb.sa.band78.fr1.24PRB.usrpb210.conf | 17 +--------------- doc/TESTING_5GSA_setup.md | 16 +-------------- .../PROJECTS/GENERIC-NR-5GC/CONF/cu_gnb.conf | 18 +---------------- .../PROJECTS/GENERIC-NR-5GC/CONF/du_gnb.conf | 18 +---------------- ...b.band78.tm1.106PRB.usrpn300.gtp-itti.conf | 19 ++---------------- .../gnb.sa.band41.fr1.106PRB.usrpb210.conf | 13 +----------- .../gnb.sa.band66.fr1.106PRB.usrpn300.conf | 17 +--------------- ...gnb.sa.band77.fr1.273PRB.2x2.usrpn300.conf | 12 +---------- ...gnb.sa.band78.fr1.106PRB.2x2.usrpn300.conf | 13 +----------- ....sa.band78.fr1.106PRB.usrpb210.4layer.conf | 17 +--------------- .../gnb.sa.band78.fr1.106PRB.usrpb210.conf | 13 +----------- ...b.sa.band78.fr1.106PRB.usrpb210.sabox.conf | 13 +----------- ...gnb.sa.band78.fr1.162PRB.2x2.usrpn300.conf | 12 +---------- ...gnb.sa.band78.fr1.217PRB.2x2.usrpn300.conf | 12 +---------- .../gnb.sa.band78.fr1.24PRB.usrpb210.conf | 17 +--------------- 28 files changed, 29 insertions(+), 412 deletions(-) diff --git a/ci-scripts/conf_files/episci/episci_gnb.band78.sa.fr1.106PRB.usrpn310.conf b/ci-scripts/conf_files/episci/episci_gnb.band78.sa.fr1.106PRB.usrpn310.conf index e92585b5fe..016f1e9b1f 100644 --- a/ci-scripts/conf_files/episci/episci_gnb.band78.sa.fr1.106PRB.usrpn310.conf +++ b/ci-scripts/conf_files/episci/episci_gnb.band78.sa.fr1.106PRB.usrpn310.conf @@ -11,22 +11,7 @@ gNBs = // Tracking area code, 0x0000 and 0xfffe are reserved values tracking_area_code = 40960; - plmn_list = ({ - mcc = 208; - mnc = 95; - mnc_length = 2; - snssaiList = ( - { - sst = 1; - sd = 0x1; // 0 false, else true - }, - { - sst = 1; - sd = 0x112233; // 0 false, else true - } - ); - - }); + plmn_list = ({ mcc = 208; mnc = 95; mnc_length = 2; snssaiList = ({ sst = 1 }) }); nr_cellid = 12345678L; diff --git a/ci-scripts/conf_files/episci/proxy_gnb.band78.sa.fr1.106PRB.usrpn310.conf b/ci-scripts/conf_files/episci/proxy_gnb.band78.sa.fr1.106PRB.usrpn310.conf index 7b6e045ffc..50dba38a51 100644 --- a/ci-scripts/conf_files/episci/proxy_gnb.band78.sa.fr1.106PRB.usrpn310.conf +++ b/ci-scripts/conf_files/episci/proxy_gnb.band78.sa.fr1.106PRB.usrpn310.conf @@ -11,22 +11,7 @@ gNBs = // Tracking area code, 0x0000 and 0xfffe are reserved values tracking_area_code = 1; - plmn_list = ({ - mcc = 208; - mnc = 99; - mnc_length = 2; - snssaiList = ( - { - sst = 1; - sd = 0x1; // 0 false, else true - }, - { - sst = 1; - sd = 0x112233; // 0 false, else true - } - ); - - }); + plmn_list = ({ mcc = 208; mnc = 99; mnc_length = 2; snssaiList = ({ sst = 1 }) }); nr_cellid = 12345678L; diff --git a/ci-scripts/conf_files/gNB_SA_CU.conf b/ci-scripts/conf_files/gNB_SA_CU.conf index f6d3e8575a..27b079d026 100644 --- a/ci-scripts/conf_files/gNB_SA_CU.conf +++ b/ci-scripts/conf_files/gNB_SA_CU.conf @@ -15,22 +15,7 @@ gNBs = // Tracking area code, 0x0000 and 0xfffe are reserved values tracking_area_code = 1; - plmn_list = ({ - mcc = 208; - mnc = 99; - mnc_length = 2; - snssaiList = ( - { - sst = 1; - sd = 0x010203; // 0 false, else true - }, - { - sst = 1; - sd = 0x112233; // 0 false, else true - } - ); - - }); + plmn_list = ({ mcc = 208; mnc = 99; mnc_length = 2; snssaiList = ({ sst = 1 }) }); nr_cellid = 12345678L; diff --git a/ci-scripts/conf_files/gNB_SA_DU.conf b/ci-scripts/conf_files/gNB_SA_DU.conf index 0c1555e92a..5a96090b36 100644 --- a/ci-scripts/conf_files/gNB_SA_DU.conf +++ b/ci-scripts/conf_files/gNB_SA_DU.conf @@ -14,22 +14,7 @@ gNBs = // Tracking area code, 0x0000 and 0xfffe are reserved values tracking_area_code = 1; - plmn_list = ({ - mcc = 208; - mnc = 99; - mnc_length = 2; - snssaiList = ( - { - sst = 1; - sd = 0x010203; // 0 false, else true - }, - { - sst = 1; - sd = 0x112233; // 0 false, else true - } - ); - - }); + plmn_list = ({ mcc = 208; mnc = 99; mnc_length = 2; snssaiList = ({ sst = 1 }) }); nr_cellid = 12345678L; diff --git a/ci-scripts/conf_files/gNB_SA_n78_106PRB.2x2_usrpn310.conf b/ci-scripts/conf_files/gNB_SA_n78_106PRB.2x2_usrpn310.conf index 59358b9f7c..f0dbbcaf06 100644 --- a/ci-scripts/conf_files/gNB_SA_n78_106PRB.2x2_usrpn310.conf +++ b/ci-scripts/conf_files/gNB_SA_n78_106PRB.2x2_usrpn310.conf @@ -15,21 +15,7 @@ gNBs = // Tracking area code, 0x0000 and 0xfffe are reserved values tracking_area_code = 1; - plmn_list = ({ - mcc = 208; - mnc = 99; - mnc_length = 2; - snssaiList = ( - { - sst = 1; - sd = 0x010203; // 0 false, else true - }, - { - sst = 1; - sd = 0x112233; // 0 false, else true - } - ); - }); + plmn_list = ({ mcc = 208; mnc = 99; mnc_length = 2; snssaiList = ({ sst = 1 }) }); nr_cellid = 12345678L diff --git a/ci-scripts/conf_files/gNB_SA_n78_133PRB.2x2_usrpn310.conf b/ci-scripts/conf_files/gNB_SA_n78_133PRB.2x2_usrpn310.conf index 822e42cf1f..ff5e804f19 100644 --- a/ci-scripts/conf_files/gNB_SA_n78_133PRB.2x2_usrpn310.conf +++ b/ci-scripts/conf_files/gNB_SA_n78_133PRB.2x2_usrpn310.conf @@ -16,21 +16,7 @@ gNBs = // Tracking area code, 0x0000 and 0xfffe are reserved values tracking_area_code = 1; - plmn_list = ({ - mcc = 208; - mnc = 99; - mnc_length = 2; - snssaiList = ( - { - sst = 1; - sd = 0x010203; // 0 false, else true - }, - { - sst = 1; - sd = 0x112233; // 0 false, else true - } - ); - }); + plmn_list = ({ mcc = 208; mnc = 99; mnc_length = 2; snssaiList = ({ sst = 1 }) }); nr_cellid = 12345678L diff --git a/ci-scripts/conf_files/gnb.band78.sa.fr1.106PRB.2x2.usrpn310.asue.conf b/ci-scripts/conf_files/gnb.band78.sa.fr1.106PRB.2x2.usrpn310.asue.conf index 6971c5d818..0412c1ef9a 100644 --- a/ci-scripts/conf_files/gnb.band78.sa.fr1.106PRB.2x2.usrpn310.asue.conf +++ b/ci-scripts/conf_files/gnb.band78.sa.fr1.106PRB.2x2.usrpn310.asue.conf @@ -15,25 +15,7 @@ gNBs = // Tracking area code, 0x0000 and 0xfffe are reserved values tracking_area_code = 1; - plmn_list = ({ - mcc = 208; - mnc = 97; - mnc_length = 2; - snssaiList = ( - { - sst = 1; - sd = 0x1; // 0 false, else true - }, - { - sst = 1; - sd = 0x010203; // 0 false, else true - }, - { - sst = 1; - sd = 0x112233; // 0 false, else true - } - ); - }); + plmn_list = ({ mcc = 208; mnc = 97; mnc_length = 2; snssaiList = ({ sst = 1 }) }); nr_cellid = 12345678L diff --git a/ci-scripts/conf_files/gnb.band78.sa.fr1.106PRB.2x2.usrpn310.conf b/ci-scripts/conf_files/gnb.band78.sa.fr1.106PRB.2x2.usrpn310.conf index 0dd264a6c5..ffe5234a21 100644 --- a/ci-scripts/conf_files/gnb.band78.sa.fr1.106PRB.2x2.usrpn310.conf +++ b/ci-scripts/conf_files/gnb.band78.sa.fr1.106PRB.2x2.usrpn310.conf @@ -15,21 +15,7 @@ gNBs = // Tracking area code, 0x0000 and 0xfffe are reserved values tracking_area_code = 1; - plmn_list = ({ - mcc = 208; - mnc = 97; - mnc_length = 2; - snssaiList = ( - { - sst = 1; - sd = 0x010203; // 0 false, else true - }, - { - sst = 1; - sd = 0x112233; // 0 false, else true - } - ); - }); + plmn_list = ({ mcc = 208; mnc = 97; mnc_length = 2; snssaiList = ({ sst = 1 }) }); nr_cellid = 12345678L diff --git a/ci-scripts/conf_files/gnb.band78.sa.fr1.106PRB.ddsuu.2x2.usrpn310.conf b/ci-scripts/conf_files/gnb.band78.sa.fr1.106PRB.ddsuu.2x2.usrpn310.conf index 1d7f9c499e..e0f8e50555 100644 --- a/ci-scripts/conf_files/gnb.band78.sa.fr1.106PRB.ddsuu.2x2.usrpn310.conf +++ b/ci-scripts/conf_files/gnb.band78.sa.fr1.106PRB.ddsuu.2x2.usrpn310.conf @@ -15,21 +15,7 @@ gNBs = // Tracking area code, 0x0000 and 0xfffe are reserved values tracking_area_code = 1; - plmn_list = ({ - mcc = 208; - mnc = 97; - mnc_length = 2; - snssaiList = ( - { - sst = 1; - sd = 0x010203; // 0 false, else true - }, - { - sst = 1; - sd = 0x112233; // 0 false, else true - } - ); - }); + plmn_list = ({ mcc = 208; mnc = 97; mnc_length = 2; snssaiList = ({ sst = 1 }) }); nr_cellid = 12345678L diff --git a/ci-scripts/conf_files/gnb.band78.sa.fr1.106PRB.usrpn310.conf b/ci-scripts/conf_files/gnb.band78.sa.fr1.106PRB.usrpn310.conf index c3f382c79a..3b2226eb6b 100644 --- a/ci-scripts/conf_files/gnb.band78.sa.fr1.106PRB.usrpn310.conf +++ b/ci-scripts/conf_files/gnb.band78.sa.fr1.106PRB.usrpn310.conf @@ -15,21 +15,7 @@ gNBs = // Tracking area code, 0x0000 and 0xfffe are reserved values tracking_area_code = 1; - plmn_list = ({ - mcc = 208; - mnc = 97; - mnc_length = 2; - snssaiList = ( - { - sst = 1; - sd = 0x010203; // 0 false, else true - }, - { - sst = 1; - sd = 0x112233; // 0 false, else true - } - ); - }); + plmn_list = ({ mcc = 208; mnc = 97; mnc_length = 2; snssaiList = ({ sst = 1 }) }); nr_cellid = 12345678L diff --git a/ci-scripts/conf_files/gnb.band78.sa.fr1.162PRB.2x2.usrpn310.conf b/ci-scripts/conf_files/gnb.band78.sa.fr1.162PRB.2x2.usrpn310.conf index 1086badc0b..63048987eb 100644 --- a/ci-scripts/conf_files/gnb.band78.sa.fr1.162PRB.2x2.usrpn310.conf +++ b/ci-scripts/conf_files/gnb.band78.sa.fr1.162PRB.2x2.usrpn310.conf @@ -15,21 +15,7 @@ gNBs = // Tracking area code, 0x0000 and 0xfffe are reserved values tracking_area_code = 1; - plmn_list = ({ - mcc = 208; - mnc = 97; - mnc_length = 2; - snssaiList = ( - { - sst = 1; - sd = 0x010203; // 0 false, else true - }, - { - sst = 1; - sd = 0x112233; // 0 false, else true - } - ); - }); + plmn_list = ({ mcc = 208; mnc = 97; mnc_length = 2; snssaiList = ({ sst = 1 }) }); nr_cellid = 12345678L diff --git a/ci-scripts/conf_files/gnb.sa.band66.fr1.106PRB.usrpn300.conf b/ci-scripts/conf_files/gnb.sa.band66.fr1.106PRB.usrpn300.conf index ee31a01f1a..787701fc9c 100644 --- a/ci-scripts/conf_files/gnb.sa.band66.fr1.106PRB.usrpn300.conf +++ b/ci-scripts/conf_files/gnb.sa.band66.fr1.106PRB.usrpn300.conf @@ -11,22 +11,7 @@ gNBs = // Tracking area code, 0x0000 and 0xfffe are reserved values tracking_area_code = 1; - plmn_list = ({ - mcc = 208; - mnc = 95; - mnc_length = 2; - snssaiList = ( - { - sst = 1; - sd = 0x1; // 0 false, else true - }, - { - sst = 2; - sd = 2; // 0 false, else true - } - ); - - }); + plmn_list = ({ mcc = 208; mnc = 95; mnc_length = 2; snssaiList = ({ sst = 1 }) }); nr_cellid = 12345678L; diff --git a/ci-scripts/conf_files/gnb.sa.band78.fr1.106PRB.usrpb210.conf b/ci-scripts/conf_files/gnb.sa.band78.fr1.106PRB.usrpb210.conf index 2a6053ab46..3ec265f12c 100644 --- a/ci-scripts/conf_files/gnb.sa.band78.fr1.106PRB.usrpb210.conf +++ b/ci-scripts/conf_files/gnb.sa.band78.fr1.106PRB.usrpb210.conf @@ -11,18 +11,7 @@ gNBs = // Tracking area code, 0x0000 and 0xfffe are reserved values tracking_area_code = 1; - plmn_list = ({ - mcc = 222; - mnc = 01; - mnc_length = 2; - snssaiList = ( - { - sst = 1; - #sd = 0x1; // 0 false, else true - } - ); - - }); + plmn_list = ({ mcc = 222; mnc = 01; mnc_length = 2; snssaiList = ({ sst = 1; }) }); nr_cellid = 12345678L; diff --git a/ci-scripts/conf_files/gnb.sa.band78.fr1.24PRB.usrpb210.conf b/ci-scripts/conf_files/gnb.sa.band78.fr1.24PRB.usrpb210.conf index ad1471339a..1defbf91ed 100644 --- a/ci-scripts/conf_files/gnb.sa.band78.fr1.24PRB.usrpb210.conf +++ b/ci-scripts/conf_files/gnb.sa.band78.fr1.24PRB.usrpb210.conf @@ -11,22 +11,7 @@ gNBs = // Tracking area code, 0x0000 and 0xfffe are reserved values tracking_area_code = 1; - plmn_list = ({ - mcc = 208; - mnc = 99; - mnc_length = 2; - snssaiList = ( - { - sst = 1; - sd = 0x1; // 0 false, else true - }, - { - sst = 1; - sd = 0x112233; // 0 false, else true - } - ); - - }); + plmn_list = ({ mcc = 208; mnc = 99; mnc_length = 2; snssaiList = ({ sst = 1 }) }); nr_cellid = 12345678L; diff --git a/doc/TESTING_5GSA_setup.md b/doc/TESTING_5GSA_setup.md index 5251d82eb7..1e27e1616d 100644 --- a/doc/TESTING_5GSA_setup.md +++ b/doc/TESTING_5GSA_setup.md @@ -68,21 +68,7 @@ In the following, we highlight the fields of the file that have to be configured ```bash // Tracking area code, 0x0000 and 0xfffe are reserved values tracking_area_code = 1; - plmn_list = ({ - mcc = 208; - mnc = 99; - mnc_length = 2; - snssaiList = ( - { - sst = 1; - sd = 0x1; // 0 false, else true - }, - { - sst = 1; - sd = 0x112233; // 0 false, else true - } - ); - }); + plmn_list = ({ mcc = 208; mnc = 99; mnc_length = 2; snssaiList = ({ sst = 1 }) }); ``` Then, the source and destination IP interfaces for the communication with the Core Network also need to be set as shown below. diff --git a/targets/PROJECTS/GENERIC-NR-5GC/CONF/cu_gnb.conf b/targets/PROJECTS/GENERIC-NR-5GC/CONF/cu_gnb.conf index a64a4c6022..f0f546208e 100644 --- a/targets/PROJECTS/GENERIC-NR-5GC/CONF/cu_gnb.conf +++ b/targets/PROJECTS/GENERIC-NR-5GC/CONF/cu_gnb.conf @@ -15,23 +15,7 @@ gNBs = // Tracking area code, 0x0000 and 0xfffe are reserved values tracking_area_code = 1; - plmn_list = ({ - mcc = 208; - mnc = 99; - mnc_length = 2; - snssaiList = ( - { - sst = 1; - sd = 0x010203; // 0 false, else true - }, - { - sst = 1; - sd = 0x112233; // 0 false, else true - } - ); - - }); - + plmn_list = ({ mcc = 208; mnc = 99; mnc_length = 2; snssaiList = ({ sst = 1 }) }); nr_cellid = 12345678L; diff --git a/targets/PROJECTS/GENERIC-NR-5GC/CONF/du_gnb.conf b/targets/PROJECTS/GENERIC-NR-5GC/CONF/du_gnb.conf index a371380e6e..be42f67d44 100644 --- a/targets/PROJECTS/GENERIC-NR-5GC/CONF/du_gnb.conf +++ b/targets/PROJECTS/GENERIC-NR-5GC/CONF/du_gnb.conf @@ -14,23 +14,7 @@ gNBs = // Tracking area code, 0x0000 and 0xfffe are reserved values tracking_area_code = 1; - plmn_list = ({ - mcc = 208; - mnc = 99; - mnc_length = 2; - snssaiList = ( - { - sst = 1; - sd = 0x010203; // 0 false, else true - }, - { - sst = 1; - sd = 0x112233; // 0 false, else true - } - ); - - }); - + plmn_list = ({ mcc = 208; mnc = 99; mnc_length = 2; snssaiList = ({ sst = 1 }) }); nr_cellid = 12345678L; diff --git a/targets/PROJECTS/GENERIC-NR-5GC/CONF/gnb.band78.tm1.106PRB.usrpn300.gtp-itti.conf b/targets/PROJECTS/GENERIC-NR-5GC/CONF/gnb.band78.tm1.106PRB.usrpn300.gtp-itti.conf index cb90889b52..66051ef9bc 100644 --- a/targets/PROJECTS/GENERIC-NR-5GC/CONF/gnb.band78.tm1.106PRB.usrpn300.gtp-itti.conf +++ b/targets/PROJECTS/GENERIC-NR-5GC/CONF/gnb.band78.tm1.106PRB.usrpn300.gtp-itti.conf @@ -15,23 +15,8 @@ gNBs = // Tracking area code, 0x0000 and 0xfffe are reserved values tracking_area_code = 100; - plmn_list = ({ - mcc = 208; - mnc = 93; - mnc_length = 2; - snssaiList = ( - { - sst = 1; - sd = 0x010203; // 0 false, else true - }, - { - sst = 1; - sd = 0x112233; // 0 false, else true - } - ); - - }); - + plmn_list = ({ mcc = 208; mnc = 93; mnc_length = 2; snssaiList = ({ sst = 1 }) }); + tr_s_preference = "local_mac" ////////// Physical parameters: diff --git a/targets/PROJECTS/GENERIC-NR-5GC/CONF/gnb.sa.band41.fr1.106PRB.usrpb210.conf b/targets/PROJECTS/GENERIC-NR-5GC/CONF/gnb.sa.band41.fr1.106PRB.usrpb210.conf index 42aa555771..2bb099ccfa 100644 --- a/targets/PROJECTS/GENERIC-NR-5GC/CONF/gnb.sa.band41.fr1.106PRB.usrpb210.conf +++ b/targets/PROJECTS/GENERIC-NR-5GC/CONF/gnb.sa.band41.fr1.106PRB.usrpb210.conf @@ -11,18 +11,7 @@ gNBs = // Tracking area code, 0x0000 and 0xfffe are reserved values tracking_area_code = 1; - plmn_list = ({ - mcc = 208; - mnc = 99; - mnc_length = 2; - snssaiList = ( - { - sst = 1; - sd = 0x1; // 0 false, else true - } - ); - - }); + plmn_list = ({ mcc = 208; mnc = 99; mnc_length = 2; snssaiList = ({ sst = 1 }) }); nr_cellid = 12345678L; diff --git a/targets/PROJECTS/GENERIC-NR-5GC/CONF/gnb.sa.band66.fr1.106PRB.usrpn300.conf b/targets/PROJECTS/GENERIC-NR-5GC/CONF/gnb.sa.band66.fr1.106PRB.usrpn300.conf index 6abf2c19cc..30742d88f4 100644 --- a/targets/PROJECTS/GENERIC-NR-5GC/CONF/gnb.sa.band66.fr1.106PRB.usrpn300.conf +++ b/targets/PROJECTS/GENERIC-NR-5GC/CONF/gnb.sa.band66.fr1.106PRB.usrpn300.conf @@ -11,22 +11,7 @@ gNBs = // Tracking area code, 0x0000 and 0xfffe are reserved values tracking_area_code = 1; - plmn_list = ({ - mcc = 208; - mnc = 99; - mnc_length = 2; - snssaiList = ( - { - sst = 1; - sd = 0x1; // 0 false, else true - }, - { - sst = 1; - sd = 0x112233; // 0 false, else true - } - ); - - }); + plmn_list = ({ mcc = 208; mnc = 99; mnc_length = 2; snssaiList = ({ sst = 1 }) }); nr_cellid = 12345678L; diff --git a/targets/PROJECTS/GENERIC-NR-5GC/CONF/gnb.sa.band77.fr1.273PRB.2x2.usrpn300.conf b/targets/PROJECTS/GENERIC-NR-5GC/CONF/gnb.sa.band77.fr1.273PRB.2x2.usrpn300.conf index 730198653e..98d901c35e 100644 --- a/targets/PROJECTS/GENERIC-NR-5GC/CONF/gnb.sa.band77.fr1.273PRB.2x2.usrpn300.conf +++ b/targets/PROJECTS/GENERIC-NR-5GC/CONF/gnb.sa.band77.fr1.273PRB.2x2.usrpn300.conf @@ -10,17 +10,7 @@ gNBs = ( // Tracking area code, 0x0000 and 0xfffe are reserved values tracking_area_code = 1; - plmn_list = ( - { - mcc = 208; - mnc = 99; - mnc_length = 2; - snssaiList = ({ - sst = 1; - sd = 0x1; // 0 false, else true - }); - } - ); + plmn_list = ({ mcc = 208; mnc = 99; mnc_length = 2; snssaiList = ({ sst = 1 }); }); nr_cellid = 12345678L; diff --git a/targets/PROJECTS/GENERIC-NR-5GC/CONF/gnb.sa.band78.fr1.106PRB.2x2.usrpn300.conf b/targets/PROJECTS/GENERIC-NR-5GC/CONF/gnb.sa.band78.fr1.106PRB.2x2.usrpn300.conf index 30be597255..f5f187a736 100644 --- a/targets/PROJECTS/GENERIC-NR-5GC/CONF/gnb.sa.band78.fr1.106PRB.2x2.usrpn300.conf +++ b/targets/PROJECTS/GENERIC-NR-5GC/CONF/gnb.sa.band78.fr1.106PRB.2x2.usrpn300.conf @@ -11,18 +11,7 @@ gNBs = // Tracking area code, 0x0000 and 0xfffe are reserved values tracking_area_code = 1; - plmn_list = ({ - mcc = 208; - mnc = 99; - mnc_length = 2; - snssaiList = ( - { - sst = 1; - sd = 0x1; // 0 false, else true - } - ); - - }); + plmn_list = ({ mcc = 208; mnc = 99; mnc_length = 2; snssaiList = ({ sst = 1 }) }); nr_cellid = 12345678L; diff --git a/targets/PROJECTS/GENERIC-NR-5GC/CONF/gnb.sa.band78.fr1.106PRB.usrpb210.4layer.conf b/targets/PROJECTS/GENERIC-NR-5GC/CONF/gnb.sa.band78.fr1.106PRB.usrpb210.4layer.conf index 8ff83b5d02..2da02b0353 100644 --- a/targets/PROJECTS/GENERIC-NR-5GC/CONF/gnb.sa.band78.fr1.106PRB.usrpb210.4layer.conf +++ b/targets/PROJECTS/GENERIC-NR-5GC/CONF/gnb.sa.band78.fr1.106PRB.usrpb210.4layer.conf @@ -11,22 +11,7 @@ gNBs = // Tracking area code, 0x0000 and 0xfffe are reserved values tracking_area_code = 1; - plmn_list = ({ - mcc = 208; - mnc = 99; - mnc_length = 2; - snssaiList = ( - { - sst = 1; - sd = 0x1; // 0 false, else true - }, - { - sst = 1; - sd = 0x112233; // 0 false, else true - } - ); - - }); + plmn_list = ({ mcc = 208; mnc = 99; mnc_length = 2; snssaiList = ({ sst = 1 }) }); nr_cellid = 12345678L; diff --git a/targets/PROJECTS/GENERIC-NR-5GC/CONF/gnb.sa.band78.fr1.106PRB.usrpb210.conf b/targets/PROJECTS/GENERIC-NR-5GC/CONF/gnb.sa.band78.fr1.106PRB.usrpb210.conf index 16bd6d9055..b31569af11 100644 --- a/targets/PROJECTS/GENERIC-NR-5GC/CONF/gnb.sa.band78.fr1.106PRB.usrpb210.conf +++ b/targets/PROJECTS/GENERIC-NR-5GC/CONF/gnb.sa.band78.fr1.106PRB.usrpb210.conf @@ -11,18 +11,7 @@ gNBs = // Tracking area code, 0x0000 and 0xfffe are reserved values tracking_area_code = 1; - plmn_list = ({ - mcc = 208; - mnc = 99; - mnc_length = 2; - snssaiList = ( - { - sst = 1; - sd = 0x1; // 0 false, else true - } - ); - - }); + plmn_list = ({ mcc = 208; mnc = 99; mnc_length = 2; snssaiList = ({ sst = 1 }) }); nr_cellid = 12345678L; diff --git a/targets/PROJECTS/GENERIC-NR-5GC/CONF/gnb.sa.band78.fr1.106PRB.usrpb210.sabox.conf b/targets/PROJECTS/GENERIC-NR-5GC/CONF/gnb.sa.band78.fr1.106PRB.usrpb210.sabox.conf index 5fcad18f6d..9e4906af0f 100644 --- a/targets/PROJECTS/GENERIC-NR-5GC/CONF/gnb.sa.band78.fr1.106PRB.usrpb210.sabox.conf +++ b/targets/PROJECTS/GENERIC-NR-5GC/CONF/gnb.sa.band78.fr1.106PRB.usrpb210.sabox.conf @@ -13,18 +13,7 @@ gNBs = // Tracking area code, 0x0000 and 0xfffe are reserved values tracking_area_code = 1; - plmn_list = ({ - mcc = 450; - mnc = 05; - mnc_length = 2; - snssaiList = ( - { - sst = 1; - sd = 0xd143a5; // 0 false, else true - } - ); - - }); + plmn_list = ({ mcc = 450; mnc = 05; mnc_length = 2; snssaiList = ({ sst = 1 }) }); tr_s_preference = "local_mac" diff --git a/targets/PROJECTS/GENERIC-NR-5GC/CONF/gnb.sa.band78.fr1.162PRB.2x2.usrpn300.conf b/targets/PROJECTS/GENERIC-NR-5GC/CONF/gnb.sa.band78.fr1.162PRB.2x2.usrpn300.conf index ef732126bd..67797a0378 100644 --- a/targets/PROJECTS/GENERIC-NR-5GC/CONF/gnb.sa.band78.fr1.162PRB.2x2.usrpn300.conf +++ b/targets/PROJECTS/GENERIC-NR-5GC/CONF/gnb.sa.band78.fr1.162PRB.2x2.usrpn300.conf @@ -11,17 +11,7 @@ gNBs = // Tracking area code, 0x0000 and 0xfffe are reserved values tracking_area_code = 1; - plmn_list = ({ - mcc = 208; - mnc = 99; - mnc_length = 2; - snssaiList = ( - { - sst = 1; - sd = 0x1; // 0 false, else true - } - ); - }); + plmn_list = ({ mcc = 208; mnc = 99; mnc_length = 2; snssaiList = ({ sst = 1 }) }); nr_cellid = 12345678L; diff --git a/targets/PROJECTS/GENERIC-NR-5GC/CONF/gnb.sa.band78.fr1.217PRB.2x2.usrpn300.conf b/targets/PROJECTS/GENERIC-NR-5GC/CONF/gnb.sa.band78.fr1.217PRB.2x2.usrpn300.conf index 1f1f64ce3f..513c167a69 100644 --- a/targets/PROJECTS/GENERIC-NR-5GC/CONF/gnb.sa.band78.fr1.217PRB.2x2.usrpn300.conf +++ b/targets/PROJECTS/GENERIC-NR-5GC/CONF/gnb.sa.band78.fr1.217PRB.2x2.usrpn300.conf @@ -11,17 +11,7 @@ gNBs = // Tracking area code, 0x0000 and 0xfffe are reserved values tracking_area_code = 1; - plmn_list = ({ - mcc = 208; - mnc = 99; - mnc_length = 2; - snssaiList = ( - { - sst = 1; - sd = 0x1; // 0 false, else true - } - ); - }); + plmn_list = ({ mcc = 208; mnc = 99; mnc_length = 2; snssaiList = ({ sst = 1 }) }); nr_cellid = 12345678L; diff --git a/targets/PROJECTS/GENERIC-NR-5GC/CONF/gnb.sa.band78.fr1.24PRB.usrpb210.conf b/targets/PROJECTS/GENERIC-NR-5GC/CONF/gnb.sa.band78.fr1.24PRB.usrpb210.conf index ad1471339a..1defbf91ed 100644 --- a/targets/PROJECTS/GENERIC-NR-5GC/CONF/gnb.sa.band78.fr1.24PRB.usrpb210.conf +++ b/targets/PROJECTS/GENERIC-NR-5GC/CONF/gnb.sa.band78.fr1.24PRB.usrpb210.conf @@ -11,22 +11,7 @@ gNBs = // Tracking area code, 0x0000 and 0xfffe are reserved values tracking_area_code = 1; - plmn_list = ({ - mcc = 208; - mnc = 99; - mnc_length = 2; - snssaiList = ( - { - sst = 1; - sd = 0x1; // 0 false, else true - }, - { - sst = 1; - sd = 0x112233; // 0 false, else true - } - ); - - }); + plmn_list = ({ mcc = 208; mnc = 99; mnc_length = 2; snssaiList = ({ sst = 1 }) }); nr_cellid = 12345678L; From 46bbd3f97911e7e9b6f20dfcd86810dabfb03936 Mon Sep 17 00:00:00 2001 From: Robert Schmidt Date: Tue, 21 Jun 2022 13:47:32 +0200 Subject: [PATCH 52/88] CI: Check that plmn_list matching key has dict type The loop passes over all keys. For plmn_list, there are subentries mcc, mnc, mnc_length. The plmn_list if block assumes that the key is a dict, which was not checked for, leading to a type error. --- docker/scripts/generateTemplate.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docker/scripts/generateTemplate.py b/docker/scripts/generateTemplate.py index 723bf86070..992c0fcb2e 100644 --- a/docker/scripts/generateTemplate.py +++ b/docker/scripts/generateTemplate.py @@ -105,7 +105,7 @@ def main(): templine = line elif re.search(r'mnc_length', line) and key["key"] == "mnc": continue - elif re.search(r'plmn_list', line): + elif re.search(r'plmn_list', line) and type(key["env"]) is dict: templine = re.sub(r'[0-9]+', '""', line) templine = re.sub(r'\"\"', key["env"]["mcc"], templine, 1) templine = re.sub(r'\"\"', key["env"]["mnc"], templine, 1) From 2c08302c89c50be6efe6ff75328e7e271c435071 Mon Sep 17 00:00:00 2001 From: Cedric Roux Date: Mon, 5 Sep 2022 16:29:51 +0200 Subject: [PATCH 53/88] nr rlc: fix in process_control_pdu() the following: if (cur_wait_list == entity->wait_end) end_wait_list = prev_wait_list; was done after cur_wait_list is updated to its new value, but the old value has to be used in this test. So end_wait_list was not set properly. This was leading to random crashes later on because then entity->wait_list was NULL but entity->wait_end was not (because of the bug fixed by this commit). The new value for cur_wait_list is also now set using prev_wait_list->next just before the goto, as done in other places in the code. Also "cur" was removed, for it has no purpose and makes the code harder to understand. --- openair2/LAYER2/nr_rlc/nr_rlc_entity_am.c | 20 +++++++++----------- 1 file changed, 9 insertions(+), 11 deletions(-) diff --git a/openair2/LAYER2/nr_rlc/nr_rlc_entity_am.c b/openair2/LAYER2/nr_rlc/nr_rlc_entity_am.c index 91e2bed11a..feb1a0905d 100644 --- a/openair2/LAYER2/nr_rlc/nr_rlc_entity_am.c +++ b/openair2/LAYER2/nr_rlc/nr_rlc_entity_am.c @@ -473,19 +473,18 @@ process_wait_list_head: * if fully acked */ if (sn_compare_tx(entity, cur_wait_list->sdu->sn, ack_sn) < 0) { - nr_rlc_sdu_segment_t *cur = cur_wait_list; - int upper_layer_id = cur->sdu->upper_layer_id; - int sdu_size = cur->sdu->size; - cur_wait_list = cur_wait_list->next; - prev_wait_list->next = cur_wait_list; + int upper_layer_id = cur_wait_list->sdu->upper_layer_id; + int sdu_size = cur_wait_list->sdu->size; + prev_wait_list->next = cur_wait_list->next; if (cur_wait_list == entity->wait_end) end_wait_list = prev_wait_list; - if (nr_rlc_free_sdu_segment(cur)) { + if (nr_rlc_free_sdu_segment(cur_wait_list)) { entity->tx_size -= sdu_size; entity->common.sdu_successful_delivery( entity->common.sdu_successful_delivery_data, (nr_rlc_entity_t *)entity, upper_layer_id); } + cur_wait_list = prev_wait_list->next; goto process_next_pdu; } @@ -594,19 +593,18 @@ nacks_done: /* current segment is acked, free it, indicate successful delivery * if fully acked */ - nr_rlc_sdu_segment_t *cur = cur_wait_list; - int upper_layer_id = cur->sdu->upper_layer_id; - int sdu_size = cur->sdu->size; + int upper_layer_id = cur_wait_list->sdu->upper_layer_id; + int sdu_size = cur_wait_list->sdu->size; prev_wait_list->next = cur_wait_list->next; if (cur_wait_list == entity->wait_end) end_wait_list = prev_wait_list; - cur_wait_list = cur_wait_list->next; - if (nr_rlc_free_sdu_segment(cur)) { + if (nr_rlc_free_sdu_segment(cur_wait_list)) { entity->tx_size -= sdu_size; entity->common.sdu_successful_delivery( entity->common.sdu_successful_delivery_data, (nr_rlc_entity_t *)entity, upper_layer_id); } + cur_wait_list = prev_wait_list->next; } /* deal with retransmit list */ while (cur_retransmit_list != NULL From 09db9c3022c141dfc7fbdde52eaded9ba5a309bd Mon Sep 17 00:00:00 2001 From: Robert Schmidt Date: Tue, 21 Jun 2022 13:56:53 +0200 Subject: [PATCH 54/88] generateTemplate.py: allow multiple replacements in a single line - especially for plmn_list, will allow to be followed by an MCC/MNC in a single line - tightens regexes to match replacements more accurately, e.g., "val = key" (instead of just searching for "key) - no special rule for SD, which matches SD values (and not the SD field). However, currently it is not possible to specify multiple SDs (multiple SSTs was already not possible) --- docker/scripts/enb_parameters.yaml | 88 ++++++++++++++++-------------- docker/scripts/generateTemplate.py | 51 ++++++----------- docker/scripts/gnb_parameters.yaml | 25 +++++++-- 3 files changed, 86 insertions(+), 78 deletions(-) diff --git a/docker/scripts/enb_parameters.yaml b/docker/scripts/enb_parameters.yaml index 69baaebb3d..b3cd02e941 100644 --- a/docker/scripts/enb_parameters.yaml +++ b/docker/scripts/enb_parameters.yaml @@ -32,11 +32,12 @@ env: "@ENB_NAME@" - key: eNB_name env: "@ENB_NAME@" - - key: plmn_list - env: - mcc: "@MCC@" - mnc: "@MNC@" - mnc_length: "@MNC_LENGTH@" + - key: mcc + env: "@MCC@" + - key: mnc + env: "@MNC@" + - key: mnc_length + env: "@MNC_LENGTH@" - key: tracking_area_code env: "@TAC@" - key: local_s_if_name @@ -75,11 +76,12 @@ env: "@ENB_NAME@" - key: eNB_name env: "@ENB_NAME@" - - key: plmn_list - env: - mcc: "@MCC@" - mnc: "@MNC@" - mnc_length: "@MNC_LENGTH@" + - key: mcc + env: "@MCC@" + - key: mnc + env: "@MNC@" + - key: mnc_length + env: "@MNC_LENGTH@" - key: tracking_area_code env: "@TAC@" - key: local_n_if_name @@ -136,11 +138,12 @@ env: "@ENB_NAME@" - key: eNB_name env: "@ENB_NAME@" - - key: plmn_list - env: - mcc: "@MCC@" - mnc: "@MNC@" - mnc_length: "@MNC_LENGTH@" + - key: mcc + env: "@MCC@" + - key: mnc + env: "@MNC@" + - key: mnc_length + env: "@MNC_LENGTH@" - key: tracking_area_code env: "@TAC@" - key: eutra_band @@ -187,11 +190,12 @@ env: "@ENB_NAME@" - key: eNB_name env: "@ENB_NAME@" - - key: plmn_list - env: - mcc: "@MCC@" - mnc: "@MNC@" - mnc_length: "@MNC_LENGTH@" + - key: mcc + env: "@MCC@" + - key: mnc + env: "@MNC@" + - key: mnc_length + env: "@MNC_LENGTH@" - key: tracking_area_code env: "@TAC@" - key: eutra_band @@ -226,11 +230,12 @@ env: "@ENB_NAME@" - key: eNB_name env: "@ENB_NAME@" - - key: plmn_list - env: - mcc: "@MCC@" - mnc: "@MNC@" - mnc_length: "@MNC_LENGTH@" + - key: mcc + env: "@MCC@" + - key: mnc + env: "@MNC@" + - key: mnc_length + env: "@MNC_LENGTH@" - key: tracking_area_code env: "@TAC@" - key: local_s_if_name @@ -271,11 +276,12 @@ env: "@ENB_NAME@" - key: eNB_name env: "@ENB_NAME@" - - key: plmn_list - env: - mcc: "@MCC@" - mnc: "@MNC@" - mnc_length: "@MNC_LENGTH@" + - key: mcc + env: "@MCC@" + - key: mnc + env: "@MNC@" + - key: mnc_length + env: "@MNC_LENGTH@" - key: tracking_area_code env: "@TAC@" - key: eutra_band @@ -316,11 +322,12 @@ env: "@ENB_NAME@" - key: eNB_name env: "@ENB_NAME@" - - key: plmn_list - env: - mcc: "@MCC@" - mnc: "@MNC@" - mnc_length: "@MNC_LENGTH@" + - key: mcc + env: "@MCC@" + - key: mnc + env: "@MNC@" + - key: mnc_length + env: "@MNC_LENGTH@" - key: tracking_area_code env: "@TAC@" - key: eutra_band @@ -361,11 +368,12 @@ env: "@ENB_NAME@" - key: eNB_name env: "@ENB_NAME@" - - key: plmn_list - env: - mcc: "@MCC@" - mnc: "@MNC@" - mnc_length: "@MNC_LENGTH@" + - key: mcc + env: "@MCC@" + - key: mnc + env: "@MNC@" + - key: mnc_length + env: "@MNC_LENGTH@" - key: tracking_area_code env: "@TAC@" - key: eutra_band diff --git a/docker/scripts/generateTemplate.py b/docker/scripts/generateTemplate.py index 992c0fcb2e..b79d25f8f3 100644 --- a/docker/scripts/generateTemplate.py +++ b/docker/scripts/generateTemplate.py @@ -82,47 +82,32 @@ def main(): with open(f'{inputfile}', mode='r') as inputfile, \ open(outputfile1, mode='w') as outputfile: for line in inputfile: - count = 0 if re.search(r'EHPLMN_LIST', line): outputfile.write(line) continue - if re.search(r'sd = 0x1;', line): - templine = re.sub(r'sd = 0x1;', 'sd = 0x@NSSAI_SD0@;', line) - outputfile.write(templine) - continue - if re.search(r'sd = 0x010203;', line): - templine = re.sub(r'sd = 0x010203;', 'sd = 0x@NSSAI_SD0@;', line) - outputfile.write(templine) - continue - if re.search(r'sd = 0x112233;', line): - templine = re.sub(r'sd = 0x112233;', 'sd = 0x@NSSAI_SD1@;', line) - outputfile.write(templine) - continue + templine = line for key in config["config"]: - if line.find(key["key"]) >= 0: - count += 1 - if re.search(r'preference', line): - templine = line - elif re.search(r'mnc_length', line) and key["key"] == "mnc": + if templine.find(key["key"]) >= 0: + if re.search(r'preference', templine): # false positive + continue + if re.search(r'sdr_addrs', templine): # false positive continue - elif re.search(r'plmn_list', line) and type(key["env"]) is dict: - templine = re.sub(r'[0-9]+', '""', line) - templine = re.sub(r'\"\"', key["env"]["mcc"], templine, 1) - templine = re.sub(r'\"\"', key["env"]["mnc"], templine, 1) - templine = re.sub(r'\"\"', key["env"]["mnc_length"], templine, 1) elif re.search('downlink_frequency', line): templine = re.sub(r'[0-9]+', key["env"], line) elif re.search('uplink_frequency_offset', line): templine = re.sub(r'[0-9]+', key["env"], line) - - elif re.search(r'"(.*?)"', line): - templine = re.sub(r'(?<=")[^"]*(?=")', key["env"], line) - elif re.search(r'[0-9]', line): - templine = re.sub(r'\d+', key["env"], line) - outputfile.write(templine) - - if count == 0: - outputfile.write(line) - + # next: matches key = ( "SOMETHING" ) or key = [ "SOMETHING" ] + elif re.search(key["key"] + "\s*=\s*[\(\[]\s*\"[0-9.a-zA-Z:_-]+\"\s*[\)\]]", templine): + templine = re.sub("(" + key["key"] + "\s*=\s*[\(\[]\s*\")[0-9.a-zA-Z:_-]+(\"[\)\]])", + r'\1' + key["env"] + r"\2", templine) + # next: matches key = "SOMETHING" or key = [SOMETHING], + elif re.search(key["key"] + "\s*=\s*[\"\[][0-9.a-zA-Z:_/-]+[\"\]]", templine): + templine = re.sub("(" + key["key"] + "\s*=\s*[\"\[])[0-9.a-zA-Z:_/-]+([\"\]])", + r'\1' + key["env"] + r"\2", templine) + # next: matches key = NUMBER + elif re.search(key["key"] + "\s*=\s*[x0-9]+", templine): # x for "0x" hex start + templine = re.sub("(" + key["key"] + "\s*=\s*(?:0x)?)[x0-9]+", r"\1" + key["env"], templine) + outputfile.write(templine) + if __name__ == "__main__": main() diff --git a/docker/scripts/gnb_parameters.yaml b/docker/scripts/gnb_parameters.yaml index 420559ff3f..a7539daa69 100644 --- a/docker/scripts/gnb_parameters.yaml +++ b/docker/scripts/gnb_parameters.yaml @@ -32,11 +32,16 @@ env: "@GNB_NAME@" - key: gNB_name env: "@GNB_NAME@" - - key: plmn_list - env: - mcc: "@MCC@" - mnc: "@MNC@" - mnc_length: "@MNC_LENGTH@" + - key: mcc + env: "@MCC@" + - key: mnc + env: "@MNC@" + - key: mnc_length + env: "@MNC_LENGTH@" + - key: sst + env: "@NSSAI_SST@" + - key: sd + env: "@NSSAI_SD@" - key: tracking_area_code env: "@TAC@" - key: enable_x2 @@ -81,6 +86,8 @@ env: "@TAC@" - key: sst env: "@NSSAI_SST@" + - key: sd + env: "@NSSAI_SD@" - key: ipv4 env: "@AMF_IP_ADDRESS@" - key: GNB_INTERFACE_NAME_FOR_NG_AMF @@ -141,6 +148,8 @@ env: "@TAC@" - key: sst env: "@NSSAI_SST@" + - key: sd + env: "@NSSAI_SD@" - key: ipv4 env: "@AMF_IP_ADDRESS@" - key: GNB_INTERFACE_NAME_FOR_NG_AMF @@ -171,6 +180,8 @@ env: "@TAC@" - key: sst env: "@NSSAI_SST@" + - key: sd + env: "@NSSAI_SD@" - key: ipv4 env: "@AMF_IP_ADDRESS@" - key: GNB_INTERFACE_NAME_FOR_NG_AMF @@ -209,6 +220,8 @@ env: "@TAC@" - key: sst env: "@NSSAI_SST@" + - key: sd + env: "@NSSAI_SD@" - key: ipv4 env: "@AMF_IP_ADDRESS@" - key: GNB_INTERFACE_NAME_FOR_NG_AMF @@ -249,6 +262,8 @@ env: "@TAC@" - key: sst env: "@NSSAI_SST@" + - key: sd + env: "@NSSAI_SD@" - key: ipv4 env: "@AMF_IP_ADDRESS@" - key: GNB_INTERFACE_NAME_FOR_NG_AMF From b3b4b6dc0126a0aa1979d143e193ab2af1d5839a Mon Sep 17 00:00:00 2001 From: Robert Schmidt Date: Wed, 22 Jun 2022 17:27:46 +0200 Subject: [PATCH 55/88] docker-compose files: no SD --- .../yaml_files/5g_f1_rfsimulator/docker-compose.yaml | 11 +++-------- .../yaml_files/5g_fdd_rfsimulator/docker-compose.yaml | 9 +++------ .../yaml_files/5g_l2sim_tdd/docker-compose.yaml | 9 +++------ ci-scripts/yaml_files/5g_rfsimulator/README.md | 1 - .../yaml_files/5g_rfsimulator/docker-compose.yaml | 10 +++------- doc/tutorial_resources/docker-compose-basic-nrf.yaml | 2 +- 6 files changed, 13 insertions(+), 29 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 d52b228ec6..23dadab02c 100644 --- a/ci-scripts/yaml_files/5g_f1_rfsimulator/docker-compose.yaml +++ b/ci-scripts/yaml_files/5g_f1_rfsimulator/docker-compose.yaml @@ -63,9 +63,9 @@ services: - PLMN_SUPPORT_MNC=99 - PLMN_SUPPORT_TAC=0x0001 - SST_0=1 - - SD_0=1 + - SD_0=0xffffff - SST_1=1 - - SD_1=12 + - SD_1=1 - AMF_INTERFACE_NAME_FOR_NGAP=eth0 - AMF_INTERFACE_NAME_FOR_N11=eth0 - SMF_INSTANCE_ID_0=1 @@ -183,7 +183,7 @@ services: - NRF_API_VERSION=v1 - NRF_FQDN=oai-nrf - NSSAI_SST_0=1 - - NSSAI_SD_0=1 + - NSSAI_SD_0=0xffffff - DNN_0=oai depends_on: - oai-nrf @@ -237,8 +237,6 @@ services: MNC: '99' MNC_LENGTH: 2 NSSAI_SST: 1 - NSSAI_SD0: 1 - NSSAI_SD1: 112233 AMF_IP_ADDRESS: 192.168.71.132 GNB_NGA_IF_NAME: eth0 GNB_NGA_IP_ADDRESS: 192.168.71.140 @@ -273,8 +271,6 @@ services: MNC: '99' MNC_LENGTH: 2 NSSAI_SST: 1 - NSSAI_SD0: 1 - NSSAI_SD1: 112233 AMF_IP_ADDRESS: 192.168.71.132 GNB_NGA_IF_NAME: eth0 GNB_NGA_IP_ADDRESS: 192.168.71.142 @@ -307,7 +303,6 @@ services: OPC: 'C42449363BBAD02B66D16BC975D77CC1' DNN: oai NSSAI_SST: 1 - NSSAI_SD: 1 USE_ADDITIONAL_OPTIONS: --sa --rfsim -r 106 --numerology 1 -C 3619200000 --nokrnmod --log_config.global_log_options level,nocolor,time depends_on: - oai-du 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 7758c39592..f29700a6ee 100644 --- a/ci-scripts/yaml_files/5g_fdd_rfsimulator/docker-compose.yaml +++ b/ci-scripts/yaml_files/5g_fdd_rfsimulator/docker-compose.yaml @@ -63,9 +63,9 @@ services: - PLMN_SUPPORT_MNC=99 - PLMN_SUPPORT_TAC=0x0001 - SST_0=1 - - SD_0=1 + - SD_0=0xffffff - SST_1=1 - - SD_1=12 + - SD_1=1 - AMF_INTERFACE_NAME_FOR_NGAP=eth0 - AMF_INTERFACE_NAME_FOR_N11=eth0 - SMF_INSTANCE_ID_0=1 @@ -183,7 +183,7 @@ services: - NRF_API_VERSION=v1 - NRF_FQDN=oai-nrf - NSSAI_SST_0=1 - - NSSAI_SD_0=1 + - NSSAI_SD_0=0xffffff - DNN_0=oai depends_on: - oai-nrf @@ -237,8 +237,6 @@ services: MNC: '99' MNC_LENGTH: 2 NSSAI_SST: 1 - NSSAI_SD0: 1 - NSSAI_SD1: 112233 AMF_IP_ADDRESS: 192.168.71.132 GNB_NGA_IF_NAME: eth0 GNB_NGA_IP_ADDRESS: 192.168.71.140 @@ -266,7 +264,6 @@ services: OPC: 'C42449363BBAD02B66D16BC975D77CC1' DNN: oai NSSAI_SST: 1 - NSSAI_SD: 1 USE_ADDITIONAL_OPTIONS: -E --sa --rfsim -r 106 --numerology 1 --band 66 -C 2169080000 --CO -400000000 -s 396 --nokrnmod --log_config.global_log_options level,nocolor,time depends_on: - oai-gnb 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 7edcad25a4..45d01f7bf5 100644 --- a/ci-scripts/yaml_files/5g_l2sim_tdd/docker-compose.yaml +++ b/ci-scripts/yaml_files/5g_l2sim_tdd/docker-compose.yaml @@ -63,9 +63,9 @@ services: - PLMN_SUPPORT_MNC=99 - PLMN_SUPPORT_TAC=0x0001 - SST_0=1 - - SD_0=1 + - SD_0=0xffffff - SST_1=1 - - SD_1=12 + - SD_1=1 - AMF_INTERFACE_NAME_FOR_NGAP=eth0 - AMF_INTERFACE_NAME_FOR_N11=eth0 - SMF_INSTANCE_ID_0=1 @@ -183,7 +183,7 @@ services: - NRF_API_VERSION=v1 - NRF_FQDN=oai-nrf - NSSAI_SST_0=1 - - NSSAI_SD_0=1 + - NSSAI_SD_0=0xffffff - DNN_0=oai depends_on: - oai-nrf @@ -237,8 +237,6 @@ services: MNC: '99' MNC_LENGTH: 2 NSSAI_SST: 1 - NSSAI_SD0: 1 - NSSAI_SD1: 112233 AMF_IP_ADDRESS: 192.168.71.132 GNB_NGA_IF_NAME: eno1 GNB_NGA_IP_ADDRESS: 172.21.16.128 @@ -287,7 +285,6 @@ services: OPC: 'C42449363BBAD02B66D16BC975D77CC1' DNN: oai NSSAI_SST: 1 - NSSAI_SD: 1 NR_UE_NFAPI_IF_NAME: eno1 GNB_IP_ADDRESS: 127.0.0.1 NR_UE_IP_ADDRESS: 127.0.0.1 diff --git a/ci-scripts/yaml_files/5g_rfsimulator/README.md b/ci-scripts/yaml_files/5g_rfsimulator/README.md index aa18571776..36169dca8b 100644 --- a/ci-scripts/yaml_files/5g_rfsimulator/README.md +++ b/ci-scripts/yaml_files/5g_rfsimulator/README.md @@ -274,7 +274,6 @@ Create entry for Second UE in docker-compose.yaml file as follows: OPC: 'C42449363BBAD02B66D16BC975D77CC1' DNN: oai NSSAI_SST: 1 - NSSAI_SD: 1 USE_ADDITIONAL_OPTIONS: -E --sa --rfsim -r 106 --numerology 1 -C 3619200000 --nokrnmod --log_config.global_log_options level,nocolor,time depends_on: - oai-gnb diff --git a/ci-scripts/yaml_files/5g_rfsimulator/docker-compose.yaml b/ci-scripts/yaml_files/5g_rfsimulator/docker-compose.yaml index 88188da53e..af00761dba 100644 --- a/ci-scripts/yaml_files/5g_rfsimulator/docker-compose.yaml +++ b/ci-scripts/yaml_files/5g_rfsimulator/docker-compose.yaml @@ -63,9 +63,9 @@ services: - PLMN_SUPPORT_MNC=99 - PLMN_SUPPORT_TAC=0x0001 - SST_0=1 - - SD_0=1 + - SD_0=0xffffff - SST_1=1 - - SD_1=12 + - SD_1=1 - AMF_INTERFACE_NAME_FOR_NGAP=eth0 - AMF_INTERFACE_NAME_FOR_N11=eth0 - SMF_INSTANCE_ID_0=1 @@ -183,7 +183,7 @@ services: - NRF_API_VERSION=v1 - NRF_FQDN=oai-nrf - NSSAI_SST_0=1 - - NSSAI_SD_0=1 + - NSSAI_SD_0=0xffffff - DNN_0=oai depends_on: - oai-nrf @@ -237,8 +237,6 @@ services: MNC: '99' MNC_LENGTH: 2 NSSAI_SST: 1 - NSSAI_SD0: 1 - NSSAI_SD1: 112233 AMF_IP_ADDRESS: 192.168.71.132 GNB_NGA_IF_NAME: eth0 GNB_NGA_IP_ADDRESS: 192.168.71.140 @@ -266,7 +264,6 @@ services: OPC: 'C42449363BBAD02B66D16BC975D77CC1' DNN: oai NSSAI_SST: 1 - NSSAI_SD: 1 USE_ADDITIONAL_OPTIONS: -E --sa --rfsim -r 106 --numerology 1 -C 3619200000 --nokrnmod --log_config.global_log_options level,nocolor,time depends_on: - oai-gnb @@ -290,7 +287,6 @@ services: OPC: 'C42449363BBAD02B66D16BC975D77CC1' DNN: oai NSSAI_SST: 1 - NSSAI_SD: 1 USE_ADDITIONAL_OPTIONS: -E --sa --rfsim -r 106 --numerology 1 -C 3619200000 --nokrnmod --log_config.global_log_options level,nocolor,time depends_on: - oai-gnb diff --git a/doc/tutorial_resources/docker-compose-basic-nrf.yaml b/doc/tutorial_resources/docker-compose-basic-nrf.yaml index cd1e957ad8..1c78bf37f9 100644 --- a/doc/tutorial_resources/docker-compose-basic-nrf.yaml +++ b/doc/tutorial_resources/docker-compose-basic-nrf.yaml @@ -314,7 +314,7 @@ services: - NRF_API_VERSION=v1 - NRF_FQDN=oai-nrf - NSSAI_SST_0=1 - - NSSAI_SD_0=0x1 + - NSSAI_SD_0=0xffffff - DNN_0=oai depends_on: - oai-nrf From 015c4265f00f85648142dee1fc1c72a8544f7dca Mon Sep 17 00:00:00 2001 From: Robert Schmidt Date: Fri, 24 Jun 2022 17:45:36 +0200 Subject: [PATCH 56/88] Remove NSSAI_SD from UE conf --- ci-scripts/conf_files/nr-ue-sim.conf | 1 - 1 file changed, 1 deletion(-) diff --git a/ci-scripts/conf_files/nr-ue-sim.conf b/ci-scripts/conf_files/nr-ue-sim.conf index 05ac825db4..884430bf39 100644 --- a/ci-scripts/conf_files/nr-ue-sim.conf +++ b/ci-scripts/conf_files/nr-ue-sim.conf @@ -4,5 +4,4 @@ uicc0 = { opc= "@OPC@"; dnn= "@DNN@"; nssai_sst=@NSSAI_SST@; - nssai_sd=@NSSAI_SD@; } From 74c639f867decdfcd7d8b25a2cd96e5eb288630f Mon Sep 17 00:00:00 2001 From: Robert Schmidt Date: Tue, 28 Jun 2022 15:14:18 +0200 Subject: [PATCH 57/88] Send NAS NSSAI SD only if configured, show UICC DNN/SST/SD info --- openair3/NAS/NR_UE/nr_nas_msg_sim.c | 16 ++++++++++------ openair3/UICC/usim_interface.c | 7 +++++-- 2 files changed, 15 insertions(+), 8 deletions(-) diff --git a/openair3/NAS/NR_UE/nr_nas_msg_sim.c b/openair3/NAS/NR_UE/nr_nas_msg_sim.c index 43c3b56aa4..2b2d9b08a5 100644 --- a/openair3/NAS/NR_UE/nr_nas_msg_sim.c +++ b/openair3/NAS/NR_UE/nr_nas_msg_sim.c @@ -733,16 +733,20 @@ static void generatePduSessionEstablishRequest(int Mod_id, uicc_t * uicc, as_nas mm_msg->uplink_nas_transport.pdusessionid = 10; mm_msg->uplink_nas_transport.requesttype = 1; size += 3; - mm_msg->uplink_nas_transport.snssai.length = 4; + const bool has_nssai_sd = uicc->nssai_sd != 0xffffff; // 0xffffff means "no SD", TS 23.003 + const size_t nssai_len = has_nssai_sd ? 4 : 1; + mm_msg->uplink_nas_transport.snssai.length = nssai_len; //Fixme: it seems there are a lot of memory errors in this: this value was on the stack, // but pushed in a itti message to another thread // this kind of error seems in many places in 5G NAS - mm_msg->uplink_nas_transport.snssai.value=calloc(1,4); + mm_msg->uplink_nas_transport.snssai.value = calloc(1, nssai_len); mm_msg->uplink_nas_transport.snssai.value[0] = uicc->nssai_sst; - mm_msg->uplink_nas_transport.snssai.value[1] = (uicc->nssai_sd>>16)&0xFF; - mm_msg->uplink_nas_transport.snssai.value[2] = (uicc->nssai_sd>>8)&0xFF; - mm_msg->uplink_nas_transport.snssai.value[3] = (uicc->nssai_sd)&0xFF; - size += (1+1+4); + if (has_nssai_sd) { + mm_msg->uplink_nas_transport.snssai.value[1] = (uicc->nssai_sd >> 16) & 0xFF; + mm_msg->uplink_nas_transport.snssai.value[2] = (uicc->nssai_sd >> 8) & 0xFF; + mm_msg->uplink_nas_transport.snssai.value[3] = (uicc->nssai_sd) & 0xFF; + } + size += 1 + 1 + nssai_len; int dnnSize=strlen(uicc->dnnStr); mm_msg->uplink_nas_transport.dnn.value=calloc(1,dnnSize+1); mm_msg->uplink_nas_transport.dnn.length = dnnSize + 1; diff --git a/openair3/UICC/usim_interface.c b/openair3/UICC/usim_interface.c index 9d6e7c6ccb..78a3f1ee0a 100644 --- a/openair3/UICC/usim_interface.c +++ b/openair3/UICC/usim_interface.c @@ -44,7 +44,7 @@ extern uint16_t NB_UE_INST; {"sqn", "USIM sqn\n", 0, strptr:&uicc->sqnStr, defstrval:"000000", TYPE_STRING, 0 }, \ {"dnn", "UE dnn (apn)\n", 0, strptr:&uicc->dnnStr, defstrval:"oai", TYPE_STRING, 0 }, \ {"nssai_sst", "UE nssai\n", 0, iptr:&uicc->nssai_sst, defintval:1, TYPE_INT, 0 }, \ - {"nssai_sd", "UE nssai\n", 0, iptr:&uicc->nssai_sd, defintval:1, TYPE_INT, 0 }, \ + {"nssai_sd", "UE nssai\n", 0, iptr:&uicc->nssai_sd, defintval:0xffffff, TYPE_INT, 0 }, \ }; static uicc_t** uiccArray=NULL; @@ -73,7 +73,10 @@ uicc_t *init_uicc(char *sectionName) { // key, OPc, sqn, amf don't need to be read from the true USIM int ret = config_get( uicc_params,sizeof(uicc_params)/sizeof(paramdef_t),sectionName); AssertFatal(ret >= 0, "configuration couldn't be performed for uicc name: %s", sectionName); - LOG_I(SIM, "UICC simulation: IMSI=%s, Ki=%s, OPc=%s\n", uicc->imsiStr, uicc->keyStr, uicc->opcStr); + LOG_I(SIM, + "UICC simulation: IMSI=%s, Ki=%s, OPc=%s, DNN=%s, SST=0x%02x, SD=0x%06x\n", + uicc->imsiStr, uicc->keyStr, uicc->opcStr, + uicc->dnnStr, uicc->nssai_sst, uicc->nssai_sd); to_hex(uicc->keyStr,uicc->key, sizeof(uicc->key) ); to_hex(uicc->opcStr,uicc->opc, sizeof(uicc->opc) ); to_hex(uicc->sqnStr,uicc->sqn, sizeof(uicc->sqn) ); From 18b3189d4e413c392684e19ad1062aa776c013ad Mon Sep 17 00:00:00 2001 From: Sakthivel Velumani Date: Mon, 5 Sep 2022 15:48:02 -0400 Subject: [PATCH 58/88] Fix to support subscribing event from external thread --- common/utils/ocp_itti/intertask_interface.cpp | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/common/utils/ocp_itti/intertask_interface.cpp b/common/utils/ocp_itti/intertask_interface.cpp index 82f7eb5774..8b888e1776 100644 --- a/common/utils/ocp_itti/intertask_interface.cpp +++ b/common/utils/ocp_itti/intertask_interface.cpp @@ -274,16 +274,12 @@ extern "C" { struct epoll_event events[t->nb_fd_epoll]; // Weird condition to deal with crap legacy itti interface - if ( t->nb_fd_epoll == 1 ) { - while (t->message_queue.empty()) { - itti_get_events_locked(task_id, events, t->nb_fd_epoll); - pthread_mutex_lock(&t->queue_cond_lock); - } - } else { - if (t->message_queue.empty()) { + if (t->message_queue.empty()) { + do { itti_get_events_locked(task_id, events, t->nb_fd_epoll); pthread_mutex_lock(&t->queue_cond_lock); } + while (t->message_queue.empty() && t->nb_fd_epoll == 1); } // Legacy design: we return even if we have no message From 11d24ff42c1e6b278082ea6c905fc81067e55e9d Mon Sep 17 00:00:00 2001 From: Robert Schmidt Date: Tue, 6 Sep 2022 09:39:14 +0200 Subject: [PATCH 59/88] Correct copy path for ran-base logs --- ci-scripts/cls_cluster.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ci-scripts/cls_cluster.py b/ci-scripts/cls_cluster.py index 864fb254ea..ed7514e3bc 100644 --- a/ci-scripts/cls_cluster.py +++ b/ci-scripts/cls_cluster.py @@ -302,7 +302,7 @@ class Cluster: pod = self._deploy_pod(mySSH, 'openshift/ran-base-log-retrieval.yaml') if pod is not None: mySSH.command(f'mkdir -p cmake_targets/log/ran-base', '\$', 5) - mySSH.command(f'oc rsync {pod}:/oai-ran/cmake_targets/log cmake_targets/log/ran-base', '\$', 5) + mySSH.command(f'oc rsync {pod}:/oai-ran/cmake_targets/log/ cmake_targets/log/ran-base', '\$', 5) self._undeploy_pod(mySSH, 'openshift/ran-base-log-retrieval.yaml') else: status = False From c1fb4b6c270ce64405d87bc94adad1769a5b6870 Mon Sep 17 00:00:00 2001 From: Robert Schmidt Date: Tue, 6 Sep 2022 09:40:17 +0200 Subject: [PATCH 60/88] Run oc logout in background to avoid timeout --- ci-scripts/cls_cluster.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/ci-scripts/cls_cluster.py b/ci-scripts/cls_cluster.py index ed7514e3bc..debe4c238b 100644 --- a/ci-scripts/cls_cluster.py +++ b/ci-scripts/cls_cluster.py @@ -384,7 +384,8 @@ class Cluster: mySSH.command('for pod in $(oc get pods | tail -n +2 | awk \'{print $1}\'); do oc delete pod ${pod}; done', '\$', 60) - mySSH.command('oc logout', '\$', 30) + # logout will return eventually, but we don't care when -> start in background + mySSH.command('oc logout &', '\$', 5) mySSH.close() # Analyze the logs From 879d37b2de6eb7ea24232cdb65cd1adf2753d281 Mon Sep 17 00:00:00 2001 From: Robert Schmidt Date: Tue, 6 Sep 2022 10:21:55 +0200 Subject: [PATCH 61/88] Enable testing for all files to force ran-base rebuild --- ci-scripts/cls_cluster.py | 4 +--- ci-scripts/cls_oai_html.py | 6 ++---- 2 files changed, 3 insertions(+), 7 deletions(-) diff --git a/ci-scripts/cls_cluster.py b/ci-scripts/cls_cluster.py index debe4c238b..519769d0a7 100644 --- a/ci-scripts/cls_cluster.py +++ b/ci-scripts/cls_cluster.py @@ -259,9 +259,7 @@ class Cluster: if self.ranAllowMerge: # merging MR branch into develop -> temporary image imageTag = 'ci-temp' if self.ranTargetBranch == 'develop': - # TODO IMPORTANT: delete next line, uncomment following - mySSH.command(f'git diff HEAD..origin/develop -- cmake_targets/build_oai cmake_targets/tools/build_helper | grep --colour=never -i INDEX', '\$', 5) - #mySSH.command(f'git diff HEAD..origin/develop -- cmake_targets/build_oai cmake_targets/tools/build_helper docker/Dockerfile.base.rhel8.2 | grep --colour=never -i INDEX', '\$', 5) + mySSH.command(f'git diff HEAD..origin/develop -- cmake_targets/build_oai cmake_targets/tools/build_helper docker/Dockerfile.base.rhel8.2 | grep --colour=never -i INDEX', '\$', 5) result = re.search('index', mySSH.getBefore()) if result is not None: forceBaseImageBuild = True diff --git a/ci-scripts/cls_oai_html.py b/ci-scripts/cls_oai_html.py index 13a1ab8691..536f2ff49e 100644 --- a/ci-scripts/cls_oai_html.py +++ b/ci-scripts/cls_oai_html.py @@ -453,13 +453,11 @@ class HTMLManagement(): self.htmlFile.write(' ' + str(parameters['warnings']) + '\n') elif (parameters['warnings'] == 0): self.htmlFile.write(' ' + str(parameters['warnings']) + '\n') - elif ((parameters['warnings'] > 0) and (parameters['warnings'] <= 20)): - self.htmlFile.write(' ' + str(parameters['warnings']) + '\n') else: - self.htmlFile.write(' ' + str(parameters['warnings']) + '\n') + self.htmlFile.write(' ' + str(parameters['warnings']) + '\n') if (parameters['errors'] == 0) and (parameters['warnings'] == 0): self.htmlFile.write(' OK \n') - elif (parameters['errors'] == 0) and ((parameters['warnings'] > 0) and (parameters['warnings'] <= 20)): + elif (parameters['errors'] == 0): self.htmlFile.write(' OK \n') else: self.htmlFile.write(' NOT OK \n') From 0cffceddb36780c57753a0e5025486aad7c028c4 Mon Sep 17 00:00:00 2001 From: luis_pereira87 Date: Tue, 6 Sep 2022 10:25:51 +0100 Subject: [PATCH 62/88] Address review comments and re-formatting the code using clang-format --- openair1/PHY/NR_UE_TRANSPORT/csi_rx.c | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/openair1/PHY/NR_UE_TRANSPORT/csi_rx.c b/openair1/PHY/NR_UE_TRANSPORT/csi_rx.c index bfa578edce..ae8b733301 100644 --- a/openair1/PHY/NR_UE_TRANSPORT/csi_rx.c +++ b/openair1/PHY/NR_UE_TRANSPORT/csi_rx.c @@ -261,19 +261,20 @@ int nr_get_csi_rs_signal(const PHY_VARS_NR_UE *ue, return 0; } -uint32_t calc_power_csirs(const uint16_t *x, const fapi_nr_dl_config_csirs_pdu_rel15_t *csirs_config_pdu) { +uint32_t calc_power_csirs(const uint16_t *x, const fapi_nr_dl_config_csirs_pdu_rel15_t *csirs_config_pdu) +{ uint64_t sum_x = 0; uint64_t sum_x2 = 0; uint16_t size = 0; - for (int rb = csirs_config_pdu->start_rb; rb < (csirs_config_pdu->start_rb+csirs_config_pdu->nr_of_rbs); rb++) { - if (csirs_config_pdu->freq_density <= 1 && csirs_config_pdu->freq_density != (rb % 2)) { + for (int rb = 0; rb < csirs_config_pdu->nr_of_rbs; rb++) { + if (csirs_config_pdu->freq_density <= 1 && csirs_config_pdu->freq_density != ((rb + csirs_config_pdu->start_rb) % 2)) { continue; } - sum_x = sum_x + x[rb-csirs_config_pdu->start_rb]; - sum_x2 = sum_x2 + x[rb-csirs_config_pdu->start_rb]*x[rb-csirs_config_pdu->start_rb]; + sum_x = sum_x + x[rb]; + sum_x2 = sum_x2 + x[rb] * x[rb]; size++; } - return sum_x2/size - (sum_x/size)*(sum_x/size); + return sum_x2 / size - (sum_x / size) * (sum_x / size); } int nr_csi_rs_channel_estimation(const PHY_VARS_NR_UE *ue, From 68c6a7932869b03ba8383e423dfca0e9d8d75c02 Mon Sep 17 00:00:00 2001 From: Robert Schmidt Date: Tue, 6 Sep 2022 10:26:36 +0200 Subject: [PATCH 63/88] Replace hard-coded (unused) password with a constant The plan is to migrate the CI to not need any passwords. This constant can be used to give a dummy password. --- ci-scripts/cls_cluster.py | 4 ++-- ci-scripts/constants.py | 4 ++++ 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/ci-scripts/cls_cluster.py b/ci-scripts/cls_cluster.py index 519769d0a7..a126c74590 100644 --- a/ci-scripts/cls_cluster.py +++ b/ci-scripts/cls_cluster.py @@ -246,7 +246,7 @@ class Cluster: # Workaround for some servers, we need to erase completely the workspace if self.forcedWorkspaceCleanup: mySSH.command(f'sudo rm -Rf {lSourcePath}', '\$', 15) - self._createWorkspace(mySSH, "SHOULD NOT BE NECESSARY", lSourcePath) + self._createWorkspace(mySSH, CONST.CI_NO_PASSWORD, lSourcePath) # we don't necessarily need a forced workspace cleanup, but in # order to reduce the amount of data send to OpenShift, we @@ -378,7 +378,7 @@ class Cluster: logging.info(f'\u001B[1m{image} size is {imageSize[image]}\u001B[0m') build_log_name = f'build_log_{self.testCase_id}' - cls_containerize.CopyLogsToExecutor(mySSH, lSourcePath, build_log_name, lIpAddr, 'oaicicd', 'SHOULD NOT MATTER') + cls_containerize.CopyLogsToExecutor(mySSH, lSourcePath, build_log_name, lIpAddr, 'oaicicd', CONST.CI_NO_PASSWORD) mySSH.command('for pod in $(oc get pods | tail -n +2 | awk \'{print $1}\'); do oc delete pod ${pod}; done', '\$', 60) diff --git a/ci-scripts/constants.py b/ci-scripts/constants.py index a7ce01615e..17a4ea33fa 100644 --- a/ci-scripts/constants.py +++ b/ci-scripts/constants.py @@ -79,3 +79,7 @@ X2_HO_REQ_STATE__TARGET_RECEIVES_REQ = 1 X2_HO_REQ_STATE__TARGET_RRC_RECFG_COMPLETE = 2 X2_HO_REQ_STATE__TARGET_SENDS_SWITCH_REQ = 3 X2_HO_REQ_STATE__SOURCE_RECEIVES_REQ_ACK = 10 + +# placeholder for a "don't care" password to gradually transition to +# passwordless CI +CI_NO_PASSWORD = "CIPASSWORDDONTCARE" From c01d846a3a47f3eb0a9d4011cd5a7d83eb75b875 Mon Sep 17 00:00:00 2001 From: Robert Schmidt Date: Tue, 6 Sep 2022 10:28:50 +0200 Subject: [PATCH 64/88] Reintroduce banner in README --- openshift/README.md | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/openshift/README.md b/openshift/README.md index 8b904127cd..09ae0c941d 100644 --- a/openshift/README.md +++ b/openshift/README.md @@ -1,3 +1,17 @@ + + + + + +
+ + + + + + OpenShift Build and Usage Procedures +
+ # 1. Introduction ## General From d0e5786470d2c8960aa1024708ba3bda6faca674 Mon Sep 17 00:00:00 2001 From: Robert Schmidt Date: Tue, 6 Sep 2022 10:31:46 +0200 Subject: [PATCH 65/88] Improve wording in openshift/README.md --- openshift/README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/openshift/README.md b/openshift/README.md index 09ae0c941d..481dc5e4fe 100644 --- a/openshift/README.md +++ b/openshift/README.md @@ -66,8 +66,8 @@ oc start-build ran-base --from-file= --follow ``` The `--from-file=` uploads the repository (from which the -build is done) as a binary blob. It is therefore possible to make -merges or other modifications and build an image. +build is done) as a binary blob. It is therefore possible to make merges or +other (local) modifications and build an image. # 3. Build of `build` shared image From 3bb312dce2995f90948a6cb1cda163d17a4c2089 Mon Sep 17 00:00:00 2001 From: Robert Schmidt Date: Tue, 6 Sep 2022 11:23:21 +0200 Subject: [PATCH 66/88] Help function for creating repository workspace --- ci-scripts/cls_cluster.py | 31 +--------------- ci-scripts/cls_containerize.py | 64 +++++++++++++++++----------------- 2 files changed, 33 insertions(+), 62 deletions(-) diff --git a/ci-scripts/cls_cluster.py b/ci-scripts/cls_cluster.py index a126c74590..86edfbe568 100644 --- a/ci-scripts/cls_cluster.py +++ b/ci-scripts/cls_cluster.py @@ -59,35 +59,6 @@ class Cluster: self.ranAllowMerge = False self.ranTargetBranch = "" - def _createWorkspace(self, sshSession, password, sourcePath): - # on RedHat/CentOS .git extension is mandatory - result = re.search('([a-zA-Z0-9\:\-\.\/])+\.git', self.ranRepository) - if result is not None: - full_ran_repo_name = self.ranRepository.replace('git/', 'git') - else: - full_ran_repo_name = self.ranRepository + '.git' - sshSession.command('mkdir -p ' + sourcePath, '\$', 5) - sshSession.command('cd ' + sourcePath, '\$', 5) - sshSession.command('if [ ! -e .git ]; then stdbuf -o0 git clone ' + full_ran_repo_name + ' .; else stdbuf -o0 git fetch --prune; fi', '\$', 600) - # Raphael: here add a check if git clone or git fetch went smoothly - sshSession.command('git config user.email "jenkins@openairinterface.org"', '\$', 5) - sshSession.command('git config user.name "OAI Jenkins"', '\$', 5) - - sshSession.command('echo ' + password + ' | sudo -S git clean -x -d -ff', '\$', 30) - sshSession.command('mkdir -p cmake_targets/log', '\$', 5) - # if the commit ID is provided use it to point to it - if self.ranCommitID != '': - sshSession.command('git checkout -f ' + self.ranCommitID, '\$', 30) - # if the branch is not develop, then it is a merge request and we need to do - # the potential merge. Note that merge conflicts should already been checked earlier - if (self.ranAllowMerge): - if self.ranTargetBranch == '': - if (self.ranBranch != 'develop') and (self.ranBranch != 'origin/develop'): - sshSession.command('git merge --ff origin/develop -m "Temporary merge for CI"', '\$', 5) - else: - logging.debug('Merging with the target branch: ' + self.ranTargetBranch) - sshSession.command('git merge --ff origin/' + self.ranTargetBranch + ' -m "Temporary merge for CI"', '\$', 5) - def _recreate_entitlements(self, sshSession): # recreating entitlements, don't care if deletion fails sshSession.command('oc delete secret etc-pki-entitlement', '\$', 5) @@ -246,7 +217,7 @@ class Cluster: # Workaround for some servers, we need to erase completely the workspace if self.forcedWorkspaceCleanup: mySSH.command(f'sudo rm -Rf {lSourcePath}', '\$', 15) - self._createWorkspace(mySSH, CONST.CI_NO_PASSWORD, lSourcePath) + cls_containerize.CreateWorkspace(mySSH, lSourcePath, self.ranRepository, self.ranCommitID, self.ranTargetBranch, self.ranAllowMerge) # we don't necessarily need a forced workspace cleanup, but in # order to reduce the amount of data send to OpenShift, we diff --git a/ci-scripts/cls_containerize.py b/ci-scripts/cls_containerize.py index d083b69be8..bc3d43a83e 100644 --- a/ci-scripts/cls_containerize.py +++ b/ci-scripts/cls_containerize.py @@ -52,6 +52,35 @@ import constants as CONST # Helper functions used here and in other classes # (e.g., cls_cluster.py) #----------------------------------------------------------- +def CreateWorkspace(sshSession, sourcePath, ranRepository, ranCommitID, ranTargetBranch, ranAllowMerge): + # on RedHat/CentOS .git extension is mandatory + result = re.search('([a-zA-Z0-9\:\-\.\/])+\.git', ranRepository) + if result is not None: + full_ran_repo_name = ranRepository.replace('git/', 'git') + else: + full_ran_repo_name = ranRepository + '.git' + sshSession.command('mkdir -p ' + sourcePath, '\$', 5) + sshSession.command('cd ' + sourcePath, '\$', 5) + sshSession.command('if [ ! -e .git ]; then stdbuf -o0 git clone ' + full_ran_repo_name + ' .; else stdbuf -o0 git fetch --prune; fi', '\$', 600) + if sshSession.getBefore().count('done.') == 0: + logging.warning('did not find \'done.\' in git output while cloning/fetching, was not successful?') + sshSession.command('git config user.email "jenkins@openairinterface.org"', '\$', 5) + sshSession.command('git config user.name "OAI Jenkins"', '\$', 5) + + sshSession.command('sudo git clean -x -d -ff', '\$', 30) + sshSession.command('mkdir -p cmake_targets/log', '\$', 5) + # if the commit ID is provided use it to point to it + if ranCommitID != '': + sshSession.command('git checkout -f ' + ranCommitID, '\$', 30) + # if the branch is not develop, then it is a merge request and we need to do + # the potential merge. Note that merge conflicts should already been checked earlier + if ranAllowMerge: + if ranTargetBranch == '': + sshSession.command('git merge --ff origin/develop -m "Temporary merge for CI"', '\$', 5) + else: + logging.debug('Merging with the target branch: ' + ranTargetBranch) + sshSession.command('git merge --ff origin/' + ranTargetBranch + ' -m "Temporary merge for CI"', '\$', 5) + def CopyLogsToExecutor(sshSession, sourcePath, log_name, scpIp, scpUser, scpPw): sshSession.command(f'cd {sourcePath}/cmake_targets', '\$', 5) sshSession.command(f'rm -f {log_name}.zip', '\$', 5) @@ -185,35 +214,6 @@ class Containerize(): # Container management functions #----------------------------------------------------------- - def _createWorkspace(self, sshSession, password, sourcePath): - # on RedHat/CentOS .git extension is mandatory - result = re.search('([a-zA-Z0-9\:\-\.\/])+\.git', self.ranRepository) - if result is not None: - full_ran_repo_name = self.ranRepository.replace('git/', 'git') - else: - full_ran_repo_name = self.ranRepository + '.git' - sshSession.command('mkdir -p ' + sourcePath, '\$', 5) - sshSession.command('cd ' + sourcePath, '\$', 5) - sshSession.command('if [ ! -e .git ]; then stdbuf -o0 git clone ' + full_ran_repo_name + ' .; else stdbuf -o0 git fetch --prune; fi', '\$', 600) - # Raphael: here add a check if git clone or git fetch went smoothly - sshSession.command('git config user.email "jenkins@openairinterface.org"', '\$', 5) - sshSession.command('git config user.name "OAI Jenkins"', '\$', 5) - - sshSession.command('echo ' + password + ' | sudo -S git clean -x -d -ff', '\$', 30) - sshSession.command('mkdir -p cmake_targets/log', '\$', 5) - # if the commit ID is provided use it to point to it - if self.ranCommitID != '': - sshSession.command('git checkout -f ' + self.ranCommitID, '\$', 30) - # if the branch is not develop, then it is a merge request and we need to do - # the potential merge. Note that merge conflicts should already been checked earlier - if (self.ranAllowMerge): - if self.ranTargetBranch == '': - if (self.ranBranch != 'develop') and (self.ranBranch != 'origin/develop'): - sshSession.command('git merge --ff origin/develop -m "Temporary merge for CI"', '\$', 5) - else: - logging.debug('Merging with the target branch: ' + self.ranTargetBranch) - sshSession.command('git merge --ff origin/' + self.ranTargetBranch + ' -m "Temporary merge for CI"', '\$', 5) - def BuildImage(self, HTML): if self.ranRepository == '' or self.ranBranch == '' or self.ranCommitID == '': HELP.GenericHelp(CONST.Version) @@ -281,7 +281,7 @@ class Containerize(): self.testCase_id = HTML.testCase_id - self._createWorkspace(mySSH, lPassWord, lSourcePath) + CreateWorkspace(mySSH, lSourcePath, self.ranRepository, self.ranCommitID, self.ranTargetBranch, self.ranAllowMerge) # if asterix, copy the entitlement and subscription manager configurations if self.host == 'Red Hat': @@ -460,7 +460,7 @@ class Containerize(): self.ranCommitID = self.proxyCommit self.ranRepository = 'https://github.com/EpiSci/oai-lte-5g-multi-ue-proxy.git' self.ranAllowMerge = False - self._createWorkspace(mySSH, lPassWord, lSourcePath) + CreateWorkspace(mySSH, lSourcePath, self.ranRepository, self.ranCommitID, self.ranTargetBranch, self.ranAllowMerge) # to prevent accidentally overwriting data that might be used later self.ranCommitID = oldRanCommidID self.ranRepository = oldRanRepository @@ -641,7 +641,7 @@ class Containerize(): mySSH = SSH.SSHConnection() mySSH.open(lIpAddr, lUserName, lPassWord) - self._createWorkspace(mySSH, lPassWord, lSourcePath) + CreateWorkspace(mySSH, lSourcePath, self.ranRepository, self.ranCommitID, self.ranTargetBranch, self.ranAllowMerge) mySSH.command('cd ' + lSourcePath + '/' + self.yamlPath[self.eNB_instance], '\$', 5) mySSH.command('cp docker-compose.yml ci-docker-compose.yml', '\$', 5) From b36a5b446f9c67b1e50f09173dd133bea3b14d3c Mon Sep 17 00:00:00 2001 From: laurent Date: Tue, 6 Sep 2022 13:48:00 +0200 Subject: [PATCH 67/88] fix reject gtp-u incoming with no data --- openair3/ocp-gtpu/gtp_itf.cpp | 41 ++++++++--------------------------- 1 file changed, 9 insertions(+), 32 deletions(-) diff --git a/openair3/ocp-gtpu/gtp_itf.cpp b/openair3/ocp-gtpu/gtp_itf.cpp index 9f1c4a04a9..af2a0ee9e8 100644 --- a/openair3/ocp-gtpu/gtp_itf.cpp +++ b/openair3/ocp-gtpu/gtp_itf.cpp @@ -1096,44 +1096,21 @@ static int Gtpv1uHandleGpdu(int h, const rb_id_t rb_id=tunnel->second.incoming_rb_id; const mui_t mui=RLC_MUI_UNDEFINED; const confirm_t confirm=RLC_SDU_CONFIRM_NO; - const sdu_size_t sdu_buffer_size=msgBufLen-offset; - if (sdu_buffer_size < 1) { - LOG_E(GTPU, "gtp-u received header is malformed, ignore gtp packet\n"); - return GTPNOK; - } + const sdu_size_t sdu_buffer_size = msgBufLen - offset; unsigned char *const sdu_buffer=msgBuf+offset; const pdcp_transmission_mode_t mode=PDCP_TRANSMISSION_MODE_DATA; const uint32_t sourceL2Id=0; const uint32_t destinationL2Id=0; pthread_mutex_unlock(&globGtp.gtp_lock); - if (qfi != -1 && tunnel->second.callBackSDAP) { - if ( !tunnel->second.callBackSDAP(&ctxt, - srb_flag, - rb_id, - mui, - confirm, - sdu_buffer_size, - sdu_buffer, - mode, - &sourceL2Id, - &destinationL2Id, - qfi, - rqi, - tunnel->second.pdusession_id) ) - LOG_E(GTPU,"[%d] down layer refused incoming packet\n", h); - } else { - if ( !tunnel->second.callBack(&ctxt, - srb_flag, - rb_id, - mui, - confirm, - sdu_buffer_size, - sdu_buffer, - mode, - &sourceL2Id, - &destinationL2Id) ) - LOG_E(GTPU,"[%d] down layer refused incoming packet\n", h); + if (sdu_buffer_size > 0) { + if (qfi != -1 && tunnel->second.callBackSDAP) { + if (!tunnel->second.callBackSDAP(&ctxt, srb_flag, rb_id, mui, confirm, sdu_buffer_size, sdu_buffer, mode, &sourceL2Id, &destinationL2Id, qfi, rqi, tunnel->second.pdusession_id)) + LOG_E(GTPU, "[%d] down layer refused incoming packet\n", h); + } else { + if (!tunnel->second.callBack(&ctxt, srb_flag, rb_id, mui, confirm, sdu_buffer_size, sdu_buffer, mode, &sourceL2Id, &destinationL2Id)) + LOG_E(GTPU, "[%d] down layer refused incoming packet\n", h); + } } if(NR_PDCP_PDU_SN > 0 && NR_PDCP_PDU_SN %5 ==0){ From bc95466e1e33719e41b6f1b821e3f82624c19e3d Mon Sep 17 00:00:00 2001 From: laurent Date: Tue, 6 Sep 2022 13:50:38 +0200 Subject: [PATCH 68/88] fix check error in config module, for array types --- common/config/config_userapi.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/common/config/config_userapi.c b/common/config/config_userapi.c index 9725c15845..78a6a1b2c9 100644 --- a/common/config/config_userapi.c +++ b/common/config/config_userapi.c @@ -113,7 +113,7 @@ void config_check_valptr(paramdef_t *cfgoptions, int elt_sz, int nb_elt) { sz=managed_ptr_sz(*cfgoptions->strptr); else sz=managed_ptr_sz(cfgoptions->voidptr); - if ( sz != -1) { + if ( sz == -1) { CONFIG_PRINTF_ERROR("[CONFIG] %s NOT SUPPORTED not NULL pointer with array types", cfgoptions->optname); return ; } From bcba097936f4071f364d97c85138924ed11b3bee Mon Sep 17 00:00:00 2001 From: laurent Date: Tue, 6 Sep 2022 13:51:43 +0200 Subject: [PATCH 69/88] fix nrscope array size len --- openair1/PHY/TOOLS/nr_phy_scope.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/openair1/PHY/TOOLS/nr_phy_scope.c b/openair1/PHY/TOOLS/nr_phy_scope.c index d4b28361d2..79e210df41 100644 --- a/openair1/PHY/TOOLS/nr_phy_scope.c +++ b/openair1/PHY/TOOLS/nr_phy_scope.c @@ -323,7 +323,7 @@ static void timeSignal (OAIgraph_t *graph, PHY_VARS_gNB *phy_vars_gnb, RU_t *phy */ static void timeResponse (OAIgraph_t *graph, scopeData_t *p, int nb_UEs) { - const int len=2*p->gNB->frame_parms.ofdm_symbol_size; + const int len=p->gNB->frame_parms.ofdm_symbol_size; float *values, *time; oai_xygraph_getbuff(graph, &time, &values, len, 0); const int ant=0; // display antenna 0 for each UE From 3b42e46cf0b6fc5dda820f229efd3065ac7c28e6 Mon Sep 17 00:00:00 2001 From: Cedric Roux Date: Tue, 6 Sep 2022 15:42:52 +0200 Subject: [PATCH 70/88] nr rlc: add enum for rlc mode (am, um, or tm) --- openair2/LAYER2/nr_rlc/nr_rlc_entity.c | 6 +++--- openair2/LAYER2/nr_rlc/nr_rlc_entity.h | 8 +++++++- 2 files changed, 10 insertions(+), 4 deletions(-) diff --git a/openair2/LAYER2/nr_rlc/nr_rlc_entity.c b/openair2/LAYER2/nr_rlc/nr_rlc_entity.c index 559ccd3c1c..a27cf4f048 100644 --- a/openair2/LAYER2/nr_rlc/nr_rlc_entity.c +++ b/openair2/LAYER2/nr_rlc/nr_rlc_entity.c @@ -110,7 +110,7 @@ nr_rlc_entity_t *new_nr_rlc_entity_am( ret->common.max_retx_reached = max_retx_reached; ret->common.max_retx_reached_data = max_retx_reached_data; - ret->common.stats.mode = 0; /* 0 for AM */ + ret->common.stats.mode = NR_RLC_AM; /* let's take average over the last 100 milliseconds * initial_size of 1024 is arbitrary @@ -165,7 +165,7 @@ nr_rlc_entity_t *new_nr_rlc_entity_um( ret->common.deliver_sdu = deliver_sdu; ret->common.deliver_sdu_data = deliver_sdu_data; - ret->common.stats.mode = 1; /* 1 for UM */ + ret->common.stats.mode = NR_RLC_UM; /* let's take average over the last 100 milliseconds * initial_size of 1024 is arbitrary @@ -205,7 +205,7 @@ nr_rlc_entity_t *new_nr_rlc_entity_tm( ret->common.deliver_sdu = deliver_sdu; ret->common.deliver_sdu_data = deliver_sdu_data; - ret->common.stats.mode = 2; /* 2 for TM */ + ret->common.stats.mode = NR_RLC_TM; /* let's take average over the last 100 milliseconds * initial_size of 1024 is arbitrary diff --git a/openair2/LAYER2/nr_rlc/nr_rlc_entity.h b/openair2/LAYER2/nr_rlc/nr_rlc_entity.h index dc0f2601db..cd26094cf7 100644 --- a/openair2/LAYER2/nr_rlc/nr_rlc_entity.h +++ b/openair2/LAYER2/nr_rlc/nr_rlc_entity.h @@ -28,8 +28,14 @@ #define NR_SDU_MAX 16000 /* max NR PDCP SDU size is 9000, let's take more */ +typedef enum { + NR_RLC_AM, + NR_RLC_UM, + NR_RLC_TM, +} nr_rlc_mode_t; + typedef struct { - uint32_t mode; /* 0: RLC AM, 1: RLC UM, 2: RLC TM */ + nr_rlc_mode_t mode; /* AM, UM, or TM */ /* PDU stats */ /* TX */ From c4950f41b9c07d16166e45866e76f9d19137b27a Mon Sep 17 00:00:00 2001 From: Raphael Defosseux Date: Thu, 8 Sep 2022 11:19:52 +0200 Subject: [PATCH 71/88] fix(ci): SMF configuration was incomplete for none-SD NSSAI Signed-off-by: Raphael Defosseux --- .../5g_f1_rfsimulator/docker-compose.yaml | 14 ++++++++++---- .../5g_fdd_rfsimulator/docker-compose.yaml | 14 ++++++++++---- .../yaml_files/5g_l2sim_tdd/docker-compose.yaml | 6 ++++++ .../yaml_files/5g_rfsimulator/docker-compose.yaml | 6 ++++++ 4 files changed, 32 insertions(+), 8 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 23dadab02c..952732f22d 100644 --- a/ci-scripts/yaml_files/5g_f1_rfsimulator/docker-compose.yaml +++ b/ci-scripts/yaml_files/5g_f1_rfsimulator/docker-compose.yaml @@ -2,7 +2,7 @@ version: '3.8' services: oai-nrf: container_name: "rfsim5g-oai-nrf" - image: oai-nrf:latest + image: oai-nrf:august-dev environment: - NRF_INTERFACE_NAME_FOR_SBI=eth0 - NRF_INTERFACE_PORT_FOR_SBI=80 @@ -42,7 +42,7 @@ services: ipv4_address: 192.168.71.131 oai-amf: container_name: "rfsim5g-oai-amf" - image: oai-amf:latest + image: oai-amf:august-dev environment: - TZ=Europe/paris - INSTANCE=0 @@ -110,7 +110,7 @@ services: ipv4_address: 192.168.71.132 oai-smf: container_name: "rfsim5g-oai-smf" - image: oai-smf:latest + image: oai-smf:august-dev environment: - TZ=Europe/Paris - INSTANCE=0 @@ -140,6 +140,12 @@ services: - DISCOVER_UPF=yes - USE_FQDN_DNS=yes - DNN_NI0=oai + - TYPE0=IPv4 + - DNN_RANGE0=12.1.1.2 - 12.1.1.127 + - NSSAI_SST0=1 + - NSSAI_SD0=0xFFFFFF + - SESSION_AMBR_UL0=200Mbps + - SESSION_AMBR_DL0=400Mbps - DNN_NI2=oai.ipv4 depends_on: - oai-nrf @@ -156,7 +162,7 @@ services: ipv4_address: 192.168.71.133 oai-spgwu: container_name: "rfsim5g-oai-spgwu" - image: oai-spgwu-tiny:latest + image: oai-spgwu-tiny:august-dev environment: - TZ=Europe/Paris - PID_DIRECTORY=/var/run 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 f29700a6ee..b9db6fe7d5 100644 --- a/ci-scripts/yaml_files/5g_fdd_rfsimulator/docker-compose.yaml +++ b/ci-scripts/yaml_files/5g_fdd_rfsimulator/docker-compose.yaml @@ -2,7 +2,7 @@ version: '3.8' services: oai-nrf: container_name: "rfsim5g-oai-nrf" - image: oai-nrf:latest + image: oai-nrf:august-dev environment: - NRF_INTERFACE_NAME_FOR_SBI=eth0 - NRF_INTERFACE_PORT_FOR_SBI=80 @@ -42,7 +42,7 @@ services: ipv4_address: 192.168.71.131 oai-amf: container_name: "rfsim5g-oai-amf" - image: oai-amf:latest + image: oai-amf:august-dev environment: - TZ=Europe/paris - INSTANCE=0 @@ -110,7 +110,7 @@ services: ipv4_address: 192.168.71.132 oai-smf: container_name: "rfsim5g-oai-smf" - image: oai-smf:latest + image: oai-smf:august-dev environment: - TZ=Europe/Paris - INSTANCE=0 @@ -140,6 +140,12 @@ services: - DISCOVER_UPF=yes - USE_FQDN_DNS=yes - DNN_NI0=oai + - TYPE0=IPv4 + - DNN_RANGE0=12.1.1.2 - 12.1.1.127 + - NSSAI_SST0=1 + - NSSAI_SD0=0xFFFFFF + - SESSION_AMBR_UL0=200Mbps + - SESSION_AMBR_DL0=400Mbps - DNN_NI2=oai.ipv4 depends_on: - oai-nrf @@ -156,7 +162,7 @@ services: ipv4_address: 192.168.71.133 oai-spgwu: container_name: "rfsim5g-oai-spgwu" - image: oai-spgwu-tiny:latest + image: oai-spgwu-tiny:august-dev environment: - TZ=Europe/Paris - PID_DIRECTORY=/var/run 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 45d01f7bf5..2990d421b8 100644 --- a/ci-scripts/yaml_files/5g_l2sim_tdd/docker-compose.yaml +++ b/ci-scripts/yaml_files/5g_l2sim_tdd/docker-compose.yaml @@ -140,6 +140,12 @@ services: - DISCOVER_UPF=yes - USE_FQDN_DNS=yes - DNN_NI0=oai + - TYPE0=IPv4 + - DNN_RANGE0=12.1.1.2 - 12.1.1.127 + - NSSAI_SST0=1 + - NSSAI_SD0=0xFFFFFF + - SESSION_AMBR_UL0=200Mbps + - SESSION_AMBR_DL0=400Mbps - DNN_NI2=oai.ipv4 depends_on: - oai-nrf diff --git a/ci-scripts/yaml_files/5g_rfsimulator/docker-compose.yaml b/ci-scripts/yaml_files/5g_rfsimulator/docker-compose.yaml index af00761dba..183d184977 100644 --- a/ci-scripts/yaml_files/5g_rfsimulator/docker-compose.yaml +++ b/ci-scripts/yaml_files/5g_rfsimulator/docker-compose.yaml @@ -140,6 +140,12 @@ services: - DISCOVER_UPF=yes - USE_FQDN_DNS=yes - DNN_NI0=oai + - TYPE0=IPv4 + - DNN_RANGE0=12.1.1.2 - 12.1.1.127 + - NSSAI_SST0=1 + - NSSAI_SD0=0xFFFFFF + - SESSION_AMBR_UL0=200Mbps + - SESSION_AMBR_DL0=400Mbps - DNN_NI2=oai.ipv4 depends_on: - oai-nrf From 8eaceae023522341b94b3c214606cee6ca71e485 Mon Sep 17 00:00:00 2001 From: Robert Schmidt Date: Thu, 8 Sep 2022 15:18:52 +0200 Subject: [PATCH 72/88] Add NSSAI_SD in docker-compose for nFAPI nrUE config --- ci-scripts/yaml_files/5g_l2sim_tdd/docker-compose.yaml | 1 + 1 file changed, 1 insertion(+) 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 2990d421b8..9ece49da74 100644 --- a/ci-scripts/yaml_files/5g_l2sim_tdd/docker-compose.yaml +++ b/ci-scripts/yaml_files/5g_l2sim_tdd/docker-compose.yaml @@ -291,6 +291,7 @@ services: OPC: 'C42449363BBAD02B66D16BC975D77CC1' DNN: oai NSSAI_SST: 1 + NSSAI_SD: 0xffffff NR_UE_NFAPI_IF_NAME: eno1 GNB_IP_ADDRESS: 127.0.0.1 NR_UE_IP_ADDRESS: 127.0.0.1 From 3dc4736009340a6978d28988b5c7887f61cd9167 Mon Sep 17 00:00:00 2001 From: Robert Schmidt Date: Mon, 12 Sep 2022 14:21:03 +0200 Subject: [PATCH 73/88] Reverting SD changes to make Quectel connect in CI --- .../conf_files/gnb.band78.sa.fr1.106PRB.2x2.usrpn310.asue.conf | 2 +- .../conf_files/gnb.band78.sa.fr1.106PRB.ddsuu.2x2.usrpn310.conf | 2 +- .../conf_files/gnb.band78.sa.fr1.162PRB.2x2.usrpn310.conf | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/ci-scripts/conf_files/gnb.band78.sa.fr1.106PRB.2x2.usrpn310.asue.conf b/ci-scripts/conf_files/gnb.band78.sa.fr1.106PRB.2x2.usrpn310.asue.conf index 0412c1ef9a..5f2e43fbf1 100644 --- a/ci-scripts/conf_files/gnb.band78.sa.fr1.106PRB.2x2.usrpn310.asue.conf +++ b/ci-scripts/conf_files/gnb.band78.sa.fr1.106PRB.2x2.usrpn310.asue.conf @@ -15,7 +15,7 @@ gNBs = // Tracking area code, 0x0000 and 0xfffe are reserved values tracking_area_code = 1; - plmn_list = ({ mcc = 208; mnc = 97; mnc_length = 2; snssaiList = ({ sst = 1 }) }); + plmn_list = ({ mcc = 208; mnc = 97; mnc_length = 2; snssaiList = ({ sst = 1, sd = 0x010203 }) }); nr_cellid = 12345678L diff --git a/ci-scripts/conf_files/gnb.band78.sa.fr1.106PRB.ddsuu.2x2.usrpn310.conf b/ci-scripts/conf_files/gnb.band78.sa.fr1.106PRB.ddsuu.2x2.usrpn310.conf index e0f8e50555..2ca4471c61 100644 --- a/ci-scripts/conf_files/gnb.band78.sa.fr1.106PRB.ddsuu.2x2.usrpn310.conf +++ b/ci-scripts/conf_files/gnb.band78.sa.fr1.106PRB.ddsuu.2x2.usrpn310.conf @@ -15,7 +15,7 @@ gNBs = // Tracking area code, 0x0000 and 0xfffe are reserved values tracking_area_code = 1; - plmn_list = ({ mcc = 208; mnc = 97; mnc_length = 2; snssaiList = ({ sst = 1 }) }); + plmn_list = ({ mcc = 208; mnc = 97; mnc_length = 2; snssaiList = ({ sst = 1, sd = 0x010203 }) }); nr_cellid = 12345678L diff --git a/ci-scripts/conf_files/gnb.band78.sa.fr1.162PRB.2x2.usrpn310.conf b/ci-scripts/conf_files/gnb.band78.sa.fr1.162PRB.2x2.usrpn310.conf index 63048987eb..256dfd5dc8 100644 --- a/ci-scripts/conf_files/gnb.band78.sa.fr1.162PRB.2x2.usrpn310.conf +++ b/ci-scripts/conf_files/gnb.band78.sa.fr1.162PRB.2x2.usrpn310.conf @@ -15,7 +15,7 @@ gNBs = // Tracking area code, 0x0000 and 0xfffe are reserved values tracking_area_code = 1; - plmn_list = ({ mcc = 208; mnc = 97; mnc_length = 2; snssaiList = ({ sst = 1 }) }); + plmn_list = ({ mcc = 208; mnc = 97; mnc_length = 2; snssaiList = ({ sst = 1, sd = 0x010203 }) }); nr_cellid = 12345678L From 62cea0ef8c9b7ceeba8b32227e90159b640f8ea1 Mon Sep 17 00:00:00 2001 From: Robert Schmidt Date: Tue, 13 Sep 2022 05:24:09 +0200 Subject: [PATCH 74/88] Add two file exceptions for suspect license (BSD); remove two GPL'ed files --- ci-scripts/checkCodingFormattingRules.sh | 4 +- common/utils/T/tracer/packet-mac-lte.h | 2 - openair2/UTIL/OPT/ws_compiler_tests.h | 138 ---------------- openair2/UTIL/OPT/ws_symbol_export.h | 202 ----------------------- 4 files changed, 2 insertions(+), 344 deletions(-) delete mode 100644 openair2/UTIL/OPT/ws_compiler_tests.h delete mode 100644 openair2/UTIL/OPT/ws_symbol_export.h diff --git a/ci-scripts/checkCodingFormattingRules.sh b/ci-scripts/checkCodingFormattingRules.sh index 2f2ae0c5bd..ffe978d30d 100755 --- a/ci-scripts/checkCodingFormattingRules.sh +++ b/ci-scripts/checkCodingFormattingRules.sh @@ -74,7 +74,7 @@ then IS_NFAPI=`echo $FILE | egrep -c "nfapi/open-nFAPI|nfapi/oai_integration/vendor_ext" || true` IS_OAI_LICENCE_PRESENT=`egrep -c "OAI Public License" $FILE || true` IS_BSD_LICENCE_PRESENT=`egrep -c "the terms of the BSD Licence|License-Identifier: BSD-2-Clause" $FILE || true` - IS_EXCEPTION=`echo $FILE | egrep -c "common/utils/collection/tree.h|common/utils/collection/queue.h|openair2/UTIL/OPT/packet-rohc.h|openair3/NAS/COMMON/milenage.h|openair1/PHY/CODING/types.h|openair1/PHY/CODING/nrLDPC_decoder/nrLDPC_decoder_offload.c|openair1/PHY/CODING/nrLDPC_decoder/nrLDPC_offload.h" || true` + IS_EXCEPTION=`echo $FILE | egrep -c "common/utils/collection/tree.h|common/utils/collection/queue.h|openair2/UTIL/OPT/packet-rohc.h|openair3/NAS/COMMON/milenage.h|openair1/PHY/CODING/crc.h|openair1/PHY/CODING/crcext.h|openair1/PHY/CODING/types.h|openair1/PHY/CODING/nrLDPC_decoder/nrLDPC_decoder_offload.c|openair1/PHY/CODING/nrLDPC_decoder/nrLDPC_offload.h" || true` if [ $IS_OAI_LICENCE_PRESENT -eq 0 ] && [ $IS_BSD_LICENCE_PRESENT -eq 0 ] then if [ $IS_NFAPI -eq 0 ] && [ $IS_EXCEPTION -eq 0 ] @@ -184,7 +184,7 @@ do IS_NFAPI=`echo $FULLFILE | egrep -c "nfapi/open-nFAPI|nfapi/oai_integration/vendor_ext" || true` IS_OAI_LICENCE_PRESENT=`egrep -c "OAI Public License" $FULLFILE || true` IS_BSD_LICENCE_PRESENT=`egrep -c "the terms of the BSD Licence|License-Identifier: BSD-2-Clause" $FULLFILE || true` - IS_EXCEPTION=`echo $FULLFILE | egrep -c "common/utils/collection/tree.h|common/utils/collection/queue.h|openair2/UTIL/OPT/packet-rohc.h|openair3/NAS/COMMON/milenage.h|openair1/PHY/CODING/types.h|openair1/PHY/CODING/nrLDPC_decoder/nrLDPC_decoder_offload.c|openair1/PHY/CODING/nrLDPC_decoder/nrLDPC_offload.h" || true` + IS_EXCEPTION=`echo $FULLFILE | egrep -c "common/utils/collection/tree.h|common/utils/collection/queue.h|openair2/UTIL/OPT/packet-rohc.h|openair3/NAS/COMMON/milenage.h|openair1/PHY/CODING/crc.h|openair1/PHY/CODING/crcext.h|openair1/PHY/CODING/types.h|openair1/PHY/CODING/nrLDPC_decoder/nrLDPC_decoder_offload.c|openair1/PHY/CODING/nrLDPC_decoder/nrLDPC_offload.h" || true` if [ $IS_OAI_LICENCE_PRESENT -eq 0 ] && [ $IS_BSD_LICENCE_PRESENT -eq 0 ] then if [ $IS_NFAPI -eq 0 ] && [ $IS_EXCEPTION -eq 0 ] diff --git a/common/utils/T/tracer/packet-mac-lte.h b/common/utils/T/tracer/packet-mac-lte.h index 60181987a9..715bbb68d9 100644 --- a/common/utils/T/tracer/packet-mac-lte.h +++ b/common/utils/T/tracer/packet-mac-lte.h @@ -17,8 +17,6 @@ #ifndef __COMMON_UTILS_T_TRACER_PACKET_MAC_LTE__H__ #define __COMMON_UTILS_T_TRACER_PACKET_MAC_LTE__H__ -//#include "ws_symbol_export.h" - /* radioType */ #define FDD_RADIO 1 #define TDD_RADIO 2 diff --git a/openair2/UTIL/OPT/ws_compiler_tests.h b/openair2/UTIL/OPT/ws_compiler_tests.h deleted file mode 100644 index 46a4ab6099..0000000000 --- a/openair2/UTIL/OPT/ws_compiler_tests.h +++ /dev/null @@ -1,138 +0,0 @@ -/* ws_compiler_tests.h - * - * Wireshark - Network traffic analyzer - * By Gerald Combs - * Copyright 1998 Gerald Combs - * - * SPDX-License-Identifier: GPL-2.0-or-later - */ - -#ifndef __WS_COMPILER_TESTS_H__ -#define __WS_COMPILER_TESTS_H__ - -/* - * This was introduced by Clang: - * - * http://clang.llvm.org/docs/LanguageExtensions.html#has-attribute - * - * in some version (which version?); it has been picked up by GCC 5.0. - */ -#ifndef __has_attribute - /* - * It's a macro, so you can check whether it's defined to check - * whether it's supported. - * - * If it's not, define it to always return 0, so that we move on to - * the fallback checks. - */ - #define __has_attribute(x) 0 -#endif - -/* - * Note that the C90 spec's "6.8.1 Conditional inclusion" and the - * C99 spec's and C11 spec's "6.10.1 Conditional inclusion" say: - * - * Prior to evaluation, macro invocations in the list of preprocessing - * tokens that will become the controlling constant expression are - * replaced (except for those macro names modified by the defined unary - * operator), just as in normal text. If the token "defined" is - * generated as a result of this replacement process or use of the - * "defined" unary operator does not match one of the two specified - * forms prior to macro replacement, the behavior is undefined. - * - * so you shouldn't use defined() in a #define that's used in #if or - * #elif. Some versions of Clang, for example, will warn about this. - * - * Instead, we check whether the pre-defined macros for particular - * compilers are defined and, if not, define the "is this version XXX - * or a later version of this compiler" macros as 0. - */ - -/* - * Check whether this is GCC major.minor or a later release, or some - * compiler that claims to be "just like GCC" of that version or a - * later release. - */ - -#if !defined(__GNUC__) - #define WS_IS_AT_LEAST_GNUC_VERSION(major, minor) 0 -#else - #define WS_IS_AT_LEAST_GNUC_VERSION(major, minor) \ - (__GNUC__ > (major) || \ - (__GNUC__ == (major) && __GNUC_MINOR__ >= (minor))) -#endif - -/* - * Check whether this is Clang major.minor or a later release. - */ - -#if !defined(__clang__) - #define WS_IS_AT_LEAST_CLANG_VERSION(major, minor) 0 -#else - #define WS_IS_AT_LEAST_CLANG_VERSION(major, minor) \ - (__clang_major__ > (major) || \ - (__clang_major__ == (major) && __clang_minor__ >= (minor))) -#endif - -/* - * Check whether this is Sun C/SunPro C/Oracle Studio major.minor - * or a later release. - * - * The version number in __SUNPRO_C is encoded in hex BCD, with the - * uppermost hex digit being the major version number, the next - * one or two hex digits being the minor version number, and - * the last digit being the patch version. - * - * It represents the *compiler* version, not the product version; - * see - * - * https://sourceforge.net/p/predef/wiki/Compilers/ - * - * for a partial mapping, which we assume continues for later - * 12.x product releases. - */ - -#if !defined(__SUNPRO_C) - #define WS_IS_AT_LEAST_SUNC_VERSION(major, minor) 0 -#else - #define WS_SUNPRO_VERSION_TO_BCD(major, minor) \ - (((minor) >= 10) ? \ - (((major) << 12) | (((minor)/10) << 8) | (((minor)%10) << 4)) : \ - (((major) << 8) | ((minor) << 4))) - #define WS_IS_AT_LEAST_SUNC_VERSION(major, minor) \ - (__SUNPRO_C >= WS_SUNPRO_VERSION_TO_BCD((major), (minor))) -#endif - -/* - * Check whether this is IBM XL C major.minor or a later release. - * - * The version number in __xlC__ has the major version in the - * upper 8 bits and the minor version in the lower 8 bits. - */ - -#if !defined(__xlC__) - #define WS_IS_AT_LEAST_XL_C_VERSION(major, minor) 0 -#else - #define WS_IS_AT_LEAST_XL_C_VERSION(major, minor) \ - (__xlC__ >= (((major) << 8) | (minor))) -#endif - -/* - * Check whether this is HP aC++/HP C major.minor or a later release. - * - * The version number in __HP_aCC is encoded in zero-padded decimal BCD, - * with the "A." stripped off, the uppermost two decimal digits being - * the major version number, the next two decimal digits being the minor - * version number, and the last two decimal digits being the patch version. - * (Strip off the A., remove the . between the major and minor version - * number, and add two digits of patch.) - */ - -#if !defined(__HP_aCC) - #define WS_IS_AT_LEAST_HP_C_VERSION(major, minor) 0 -#else - #define WS_IS_AT_LEAST_HP_C_VERSION(major, minor) \ - (__HP_aCC >= ((major)*10000 + (minor)*100)) -#endif - -#endif /* __WS_COMPILER_TESTS_H__ */ diff --git a/openair2/UTIL/OPT/ws_symbol_export.h b/openair2/UTIL/OPT/ws_symbol_export.h deleted file mode 100644 index 4c7a2f710a..0000000000 --- a/openair2/UTIL/OPT/ws_symbol_export.h +++ /dev/null @@ -1,202 +0,0 @@ -/* - * Cross platform defines for exporting symbols from shared libraries - * - * Wireshark - Network traffic analyzer - * By Balint Reczey - * Copyright 2013 Balint Reczey - * - * SPDX-License-Identifier: GPL-2.0-or-later - */ - -#include "ws_compiler_tests.h" - -/** Reset symbol export behavior. - * If you {un}define WS_BUILD_DLL on the fly you'll have to define this - * as well. - */ -#ifdef RESET_SYMBOL_EXPORT - -#ifdef SYMBOL_EXPORT_H -#undef SYMBOL_EXPORT_H -#endif - -#ifdef WS_DLL_PUBLIC -#undef WS_DLL_PUBLIC -#endif - -#ifdef WS_DLL_PUBLIC_DEF -#undef WS_DLL_PUBLIC_DEF -#endif - -#ifdef WS_DLL_LOCAL -#undef WS_DLL_LOCAL -#endif - -#endif /* RESET_SYMBOL_EXPORT */ - -#ifndef SYMBOL_EXPORT_H -#define SYMBOL_EXPORT_H - -/* - * NOTE: G_HAVE_GNUC_VISIBILITY is defined only if all of - * - * __attribute__ ((visibility ("hidden"))) - * - * __attribute__ ((visibility ("internal"))) - * - * __attribute__ ((visibility ("protected"))) - * - * __attribute__ ((visibility ("default"))) - * - * are supported, and at least some versions of GCC from Apple support - * "default" and "hidden" but not "internal" or "protected", so it - * shouldn't be used to determine whether "hidden" or "default" is - * supported. - * - * This also means that we shouldn't use G_GNUC_INTERNAL instead of - * WS_DLL_LOCAL, as GLib uses G_HAVE_GNUC_VISIBILITY to determine - * whether to use __attribute__ ((visibility ("hidden"))) for - * G_GNUC_INTERNAL, and that will not use it even with compilers - * that support it. - */ - -/* Originally copied from GCC Wiki at http://gcc.gnu.org/wiki/Visibility */ -#if defined _WIN32 || defined __CYGWIN__ - /* Compiling for Windows, so we use the Windows DLL declarations. */ - #ifdef WS_BUILD_DLL - /* - * Building a DLL; for all definitions, we want dllexport, and - * (presumably so source from DLL and source from a program using the - * DLL can both include a header that declares APIs and exported data - * for the DLL), for declarations, either dllexport or dllimport will - * work (they mean the same thing for a declaration when building a DLL). - */ - #ifdef __GNUC__ - /* GCC */ - #define WS_DLL_PUBLIC_DEF __attribute__ ((dllexport)) - #else /* ! __GNUC__ */ - /* - * Presumably MSVC. - * Note: actually gcc seems to also support this syntax. - */ - #define WS_DLL_PUBLIC_DEF __declspec(dllexport) - #endif /* __GNUC__ */ - #else /* WS_BUILD_DLL */ - /* - * Building a program; we should only see declarations, not definitions, - * with WS_DLL_PUBLIC, and they all represent APIs or data imported - * from a DLL, so use dllimport. - * - * For functions, export shouldn't be necessary; for data, it might - * be necessary, e.g. if what's declared is an array whose size is - * not given in the declaration. - */ - #ifdef __GNUC__ - /* GCC */ - #define WS_DLL_PUBLIC_DEF __attribute__ ((dllimport)) - #elif ! (defined ENABLE_STATIC) /* ! __GNUC__ */ - /* - * Presumably MSVC, and we're not building all-static. - * Note: actually gcc seems to also support this syntax. - */ - #define WS_DLL_PUBLIC_DEF __declspec(dllimport) - #else /* ! __GNUC__ && ENABLE_STATIC */ - /* - * Presumably MSVC, and we're building all-static, so we're - * not building any DLLs. - */ - #define WS_DLL_PUBLIC_DEF - #endif /* __GNUC__ */ - #endif /* WS_BUILD_DLL */ - - /* - * Symbols in a DLL are *not* exported unless they're specifically - * flagged as exported, so, for a non-static but non-exported - * symbol, we don't have to do anything. - */ - #define WS_DLL_LOCAL -#else /* defined _WIN32 || defined __CYGWIN__ */ - /* - * Compiling for UN*X, where the dllimport and dllexport stuff - * is neither necessary nor supported; just specify the - * visibility if we have a compiler that supports doing so. - */ - #if WS_IS_AT_LEAST_GNUC_VERSION(3,4) \ - || WS_IS_AT_LEAST_XL_C_VERSION(12,0) - /* - * GCC 3.4 or later, or some compiler asserting compatibility with - * GCC 3.4 or later, or XL C 13.0 or later, so we have - * __attribute__((visibility()). - */ - - /* - * Symbols exported from libraries. - */ - #define WS_DLL_PUBLIC_DEF __attribute__ ((visibility ("default"))) - - /* - * Non-static symbols *not* exported from libraries. - */ - #define WS_DLL_LOCAL __attribute__ ((visibility ("hidden"))) - #elif WS_IS_AT_LEAST_SUNC_VERSION(5,5) - /* - * Sun C 5.5 or later, so we have __global and __hidden. - * (Sun C 5.9 and later also have __attribute__((visibility()), - * but there's no reason to prefer it with Sun C.) - */ - - /* - * Symbols exported from libraries. - */ - #define WS_DLL_PUBLIC_DEF __global - - /* - * Non-static symbols *not* exported from libraries. - */ - #define WS_DLL_LOCAL __hidden - #else - /* - * We have neither a way to make stuff not explicitly marked as - * visible invisible outside a library nor a way to make stuff - * explicitly marked as local invisible outside the library. - */ - - /* - * Symbols exported from libraries. - */ - #define WS_DLL_PUBLIC_DEF - - /* - * Non-static symbols *not* exported from libraries. - */ - #define WS_DLL_LOCAL - #endif -#endif - -/* - * You *must* use this for exported data *declarations*; if you use - * WS_DLL_PUBLIC_DEF, some compilers, such as MSVC++, will complain - * about array definitions with no size. - * - * You must *not* use this for exported data *definitions*, as that - * will, for some compilers, cause warnings about items being initialized - * and declared extern. - * - * Either can be used for exported *function* declarations and definitions. - */ -#define WS_DLL_PUBLIC WS_DLL_PUBLIC_DEF extern - -#endif /* SYMBOL_EXPORT_H */ - -/* - * Editor modelines - http://www.wireshark.org/tools/modelines.html - * - * Local Variables: - * c-basic-offset: 2 - * tab-width: 8 - * indent-tabs-mode: nil - * End: - * - * vi: set shiftwidth=2 tabstop=8 expandtab: - * :indentSize=2:tabSize=8:noTabs=true: - */ From 50dc769827c3d752f3f111e320c5dd95234072cd Mon Sep 17 00:00:00 2001 From: Robert Schmidt Date: Tue, 13 Sep 2022 17:46:28 +0200 Subject: [PATCH 75/88] Revert "Switch to RHEL8-Cluster-Image-Builder in RAN-Container-Parent" This reverts commit 5008eb4e38b448a792582583a8a2d398b38386f7. The RHEL8-Cluster-Image-Builder has problems and is not ready. This commit reverts the switch, and uses RHEL8-Image-Builder instead. --- ci-scripts/Jenkinsfile-GitLab-Container | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/ci-scripts/Jenkinsfile-GitLab-Container b/ci-scripts/Jenkinsfile-GitLab-Container index c8fb565488..89665f292f 100644 --- a/ci-scripts/Jenkinsfile-GitLab-Container +++ b/ci-scripts/Jenkinsfile-GitLab-Container @@ -136,16 +136,16 @@ pipeline { } } } - stage ("RHEL8-Cluster-Image-Builder") { + stage ("RHEL8 Build") { steps { script { - triggerSlaveJob ('RAN-RHEL8-Cluster-Image-Builder', 'RHEL8-Cluster-Image-Builder') + triggerSlaveJob ('RAN-RHEL8-Image-Builder', 'RHEL8-Images-Build') } } post { always { script { - finalizeSlaveJob('RAN-RHEL8-Cluster-Image-Builder') + finalizeSlaveJob('RAN-RHEL8-Image-Builder') } } failure { From b87e86fd30b0ebfd6da6b8239f1b2f9f9be4097b Mon Sep 17 00:00:00 2001 From: francescomani Date: Wed, 14 Sep 2022 11:38:33 +0200 Subject: [PATCH 76/88] remove target/SCRIPTS --- .../asn1_generate_rrc_messaging_c_code.bash | 21 ---------- targets/SCRIPTS/install_asn1.sh | 6 --- .../install_asn1c_0.9.24.modified.bash | 31 -------------- targets/SCRIPTS/svn-merge-meld.py | 41 ------------------- 4 files changed, 99 deletions(-) delete mode 100755 targets/SCRIPTS/asn1_generate_rrc_messaging_c_code.bash delete mode 100644 targets/SCRIPTS/install_asn1.sh delete mode 100755 targets/SCRIPTS/install_asn1c_0.9.24.modified.bash delete mode 100755 targets/SCRIPTS/svn-merge-meld.py diff --git a/targets/SCRIPTS/asn1_generate_rrc_messaging_c_code.bash b/targets/SCRIPTS/asn1_generate_rrc_messaging_c_code.bash deleted file mode 100755 index e0832dd8a7..0000000000 --- a/targets/SCRIPTS/asn1_generate_rrc_messaging_c_code.bash +++ /dev/null @@ -1,21 +0,0 @@ -#!/bin/bash - -# generate .c and .h files -which asn1c > /dev/null -if [ $? -eq 0 ] ; then echo "asn1c is installed" ; else echo "Please install asn1c (version 0.9.22 or greater)" ; fi -cd $OPENAIR2_DIR/RRC/LITE/MESSAGES && asn1c -gen-PER -fcompound-names -fnative-types -fskeletons-copy $OPENAIR2_DIR/RRC/LITE/MESSAGES/asn1c/ASN1_files/EUTRA-RRC-Definitions.asn - - -# generate ASN constants - -rm -f $OPENAIR2_DIR/RRC/LITE/MESSAGES/asn1_constants.h -cat $OPENAIR2_DIR/RRC/LITE/MESSAGES/asn1c/ASN1_files/EUTRA-RRC-Definitions.asn | grep INTEGER\ \:\: | sed 's/INTEGER ::=//g' | sed 's/--/\/\//g' | sed 's/^/#define /' | sed 's/\-1/_minus_1/g' | sed 's/\-/_/g' > $OPENAIR2_DIR/RRC/LITE/MESSAGES/asn1_constants.tmp -rm -f /tmp/EUTRA-RRC-Definitions.tmp -cat $OPENAIR2_DIR/RRC/LITE/MESSAGES/asn1c/ASN1_files/EUTRA-RRC-Definitions.asn | grep --invert-match SEQUENCE | grep INTEGER\ \( | uniq | grep \:\:\= | sed 's/INTEGER\ //g' | sed 's/[()]//g' | tr "." " " | sed 's/\:\:\=//g' | tr '\t' " " > /tmp/EUTRA-RRC-Definitions.tmp -cat /tmp/EUTRA-RRC-Definitions.tmp | sed 's/^ *//g' | sed 's/ \{1,\}/ /g' | cut --complement -d ' ' -f3 | sed 's/^/#define min_val_/' | sed 's/\ -/\ +/g' | sed 's/-/_/g' | sed 's/\ +/\ -/g' >> $OPENAIR2_DIR/RRC/LITE/MESSAGES/asn1_constants.tmp -cat /tmp/EUTRA-RRC-Definitions.tmp | sed 's/^ *//g' | sed 's/ \{1,\}/ /g' | cut --complement -d ' ' -f2 | sed 's/^/#define max_val_/' | sed 's/\ -/\ +/g' | sed 's/-/_/g' | sed 's/\ +/\ -/g' >> $OPENAIR2_DIR/RRC/LITE/MESSAGES/asn1_constants.tmp; -echo "#ifndef __ASN1_CONSTANTS_H__" > $OPENAIR2_DIR/RRC/LITE/MESSAGES/asn1_constants.h -echo "#define __ASN1_CONSTANTS_H__" >> $OPENAIR2_DIR/RRC/LITE/MESSAGES/asn1_constants.h -cat $OPENAIR2_DIR/RRC/LITE/MESSAGES/asn1_constants.tmp >> $OPENAIR2_DIR/RRC/LITE/MESSAGES/asn1_constants.h -echo "#endif " >> $OPENAIR2_DIR/RRC/LITE/MESSAGES/asn1_constants.h -rm -f $OPENAIR2_DIR/RRC/LITE/MESSAGES/asn1_constants.tmp; diff --git a/targets/SCRIPTS/install_asn1.sh b/targets/SCRIPTS/install_asn1.sh deleted file mode 100644 index 7da7d50b47..0000000000 --- a/targets/SCRIPTS/install_asn1.sh +++ /dev/null @@ -1,6 +0,0 @@ -#!/bin/bash -which asn1c > /dev/null -if [ $? -eq 0 ] ; then echo "asn1c is installed" ; else echo "Please install asn1c (version 0.9.22 or greater)" ; fi -cd $OPENAIR2_DIR/RRC/LITE/MESSAGES && asn1c -gen-PER -fcompound-names -fnative-types -fskeletons-copy $OPENAIR2_DIR/RRC/LITE/MESSAGES/asn1c/ASN1_files/EUTRA-RRC-Definitions.asn - - diff --git a/targets/SCRIPTS/install_asn1c_0.9.24.modified.bash b/targets/SCRIPTS/install_asn1c_0.9.24.modified.bash deleted file mode 100755 index 9c4947d479..0000000000 --- a/targets/SCRIPTS/install_asn1c_0.9.24.modified.bash +++ /dev/null @@ -1,31 +0,0 @@ -#!/bin/bash -#/* -# * 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 -# */ -################################################################################ -# Tested on ubuntu 12.04 with updates 07 november 2013 - -$1 rm -Rf /usr/local/src/asn1c-r1516 -$1 svn co https://github.com/vlm/asn1c/trunk /usr/local/src/asn1c-r1516 -r 1516 > /tmp/install_log.txt -cd /usr/local/src/asn1c-r1516 -$1 patch -p0 < $OPENAIR3_DIR/S1AP/MESSAGES/ASN1/asn1cpatch.p0 > /tmp/install_log.txt -$1 ./configure > /tmp/install_log.txt -$1 make > /tmp/install_log.txt -$1 make install > /tmp/install_log.txt diff --git a/targets/SCRIPTS/svn-merge-meld.py b/targets/SCRIPTS/svn-merge-meld.py deleted file mode 100755 index a05d697f2e..0000000000 --- a/targets/SCRIPTS/svn-merge-meld.py +++ /dev/null @@ -1,41 +0,0 @@ -#!/usr/bin/env python -# svn merge-tool python wrapper for meld -# to use: edit ~/.subversion/config and uncomment the line merge-tool-cmd = -# and set the path to your command - -# Note that when a conflict occurs, you will be prompted what to do with it. You need to type a single 'l' and for svn to run this script. When you've finished your merge, you need to type an 'r' to resolve the conflict and copy the merged version to the working copy. - -import os, sys -import subprocess -import shutil - -try: - # path to meld - meld = "/usr/bin/meld" - - print "Set the file paths for mine, theirs, and merged\n" - print "When you've finished your merge, you need to type an 'r' to resolve the conflict and copy the merged version to the working copy\n" - - # the base or "left" revision version of the file you're merging with - base = sys.argv[1] - - # this is "later" or "right"revision version of the file you're merging with - theirs = sys.argv[2] - - # this is my version, recommandations: sync your copy to the latest version - mine = sys.argv[3] - - #this starts out as a copy of 'mine' (your working copy), and this is where you want the final results of the merge to end up. - merged = sys.argv[4] - - print "Calling meld: the order of the files is (merged, theirs, and mine)" - # all 4 versions: worke right-to-left, reslut being stored in the left file - # cmd = [meld, mine, base, theirs, merged] - # only 3 versions - cmd = [meld, merged, theirs, mine] - - # Call meld, making sure it exits correctly - subprocess.check_call(cmd) -except: - print "Oh, an error!\n" - sys.exit(-1) From e3a9c880e49ee310c3cfd6015be009b4e6ff8626 Mon Sep 17 00:00:00 2001 From: Robert Schmidt Date: Thu, 15 Sep 2022 12:41:22 +0200 Subject: [PATCH 77/88] Revert "Physim: image is already on openshift image registry" This reverts commit ebdbb1fc1386745334a63dfbff0c5ab468952943. Same as parent commit. --- ci-scripts/cls_physim1.py | 73 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 73 insertions(+) diff --git a/ci-scripts/cls_physim1.py b/ci-scripts/cls_physim1.py index 56934fcd22..0f187a4633 100644 --- a/ci-scripts/cls_physim1.py +++ b/ci-scripts/cls_physim1.py @@ -115,6 +115,30 @@ class PhySim: mySSH.command('git merge --ff origin/' + self.ranTargetBranch + ' -m "Temporary merge for CI"', '\$', 5) else: imageTag = "develop" + # Check if image is exist on the Red Hat server, before pushing it to OC cluster + mySSH.command('sudo podman image inspect --format="Size = {{.Size}} bytes" oai-physim:' + imageTag, '\$', 60) + if mySSH.getBefore().count('no such image') != 0: + logging.error('\u001B[1m No such image oai-physim\u001B[0m') + mySSH.close() + HTML.CreateHtmlTestRow('N/A', 'KO', CONST.PHYSIM_IMAGE_ABSENT) + RAN.prematureExit = True + return + else: + result = re.search('Size *= *(?P[0-9\-]+) *bytes', mySSH.getBefore()) + if result is not None: + imageSize = float(result.group('size')) + imageSize = imageSize / 1000 + if imageSize < 1000: + logging.debug('\u001B[1m oai-physim size is ' + ('%.0f' % imageSize) + ' kbytes\u001B[0m') + else: + imageSize = imageSize / 1000 + if imageSize < 1000: + logging.debug('\u001B[1m oai-physim size is ' + ('%.0f' % imageSize) + ' Mbytes\u001B[0m') + else: + imageSize = imageSize / 1000 + logging.debug('\u001B[1m oai-physim is ' + ('%.3f' % imageSize) + ' Gbytes\u001B[0m') + else: + logging.debug('oai-physim size is unknown') # logging to OC Cluster and then switch to corresponding project mySSH.command(f'oc login -u {ocUserName} -p {ocPassword} --server https://api.oai.cs.eurecom.fr:6443', '\$', 30) @@ -137,7 +161,46 @@ class PhySim: else: logging.debug(f'\u001B[1m Now using project {ocProjectName}\u001B[0m') + # Tag the image and push to the OC cluster + mySSH.command('oc whoami -t | sudo podman login -u ' + ocUserName + ' --password-stdin https://default-route-openshift-image-registry.apps.oai.cs.eurecom.fr/ --tls-verify=false', '\$', 30) + if mySSH.getBefore().count('Login Succeeded!') == 0: + logging.error('\u001B[1m Podman Login to OC Cluster Registry Failed\u001B[0m') + mySSH.command('oc logout', '\$', 30) + mySSH.close() + HTML.CreateHtmlTestRow('N/A', 'KO', CONST.OC_LOGIN_FAIL) + RAN.prematureExit = True + return + else: + logging.debug('\u001B[1m Podman Login to OC Cluster Registry Successfully\u001B[0m') + time.sleep(2) + mySSH.command('oc create -f openshift/oai-physim-is.yml || true', '\$', 30) + if mySSH.getBefore().count('(AlreadyExists):') == 0 and mySSH.getBefore().count('created') == 0: + logging.error(f'\u001B[1m Image Stream "oai-physim" Creation Failed on OC Cluster {ocProjectName}\u001B[0m') + mySSH.command('sudo podman logout https://default-route-openshift-image-registry.apps.oai.cs.eurecom.fr/', '\$', 6) + mySSH.command('oc logout', '\$', 30) + mySSH.close() + HTML.CreateHtmlTestRow('N/A', 'KO', CONST.OC_IS_FAIL) + RAN.prematureExit = True + return + else: + logging.debug(f'\u001B[1m Image Stream "oai-physim" created on OC project {ocProjectName}\u001B[0m') + time.sleep(2) + mySSH.command(f'sudo podman tag oai-physim:{imageTag} default-route-openshift-image-registry.apps.oai.cs.eurecom.fr/{self.OCProjectName}/oai-physim:{imageTag}', '\$', 30) + time.sleep(2) + mySSH.command(f'sudo podman push default-route-openshift-image-registry.apps.oai.cs.eurecom.fr/{self.OCProjectName}/oai-physim:{imageTag} --tls-verify=false', '\$', 180) + if mySSH.getBefore().count('Storing signatures') == 0: + logging.error('\u001B[1m Image "oai-physim" push to OC Cluster Registry Failed\u001B[0m') + mySSH.command('sudo podman logout https://default-route-openshift-image-registry.apps.oai.cs.eurecom.fr/', '\$', 6) + mySSH.command('oc logout', '\$', 30) + mySSH.close() + HTML.CreateHtmlTestRow('N/A', 'KO', CONST.OC_IS_FAIL) + RAN.prematureExit = True + return + else: + logging.debug('\u001B[1m Image "oai-physim" push to OC Cluster Registry Successfully\u001B[0m') + # Using helm charts deployment + time.sleep(5) mySSH.command(f'grep -rl OAICICD_PROJECT ./charts/ | xargs sed -i -e "s#OAICICD_PROJECT#{ocProjectName}#"', '\$', 30) mySSH.command(f'sed -i -e "s#TAG#{imageTag}#g" ./charts/physims/values.yaml', '\$', 6) mySSH.command('helm install physim ./charts/physims/ 2>&1 | tee -a cmake_targets/log/physim_helm_summary.txt', '\$', 30) @@ -150,6 +213,9 @@ class PhySim: mySSH.command('oc get pods -l app.kubernetes.io/instance=physim', '\$', 6, resync=True) if re.search('No resources found', mySSH.getBefore()): isFinished1 = True + mySSH.command(f'sudo podman rmi default-route-openshift-image-registry.apps.oai.cs.eurecom.fr/{self.OCProjectName}/oai-physim:{imageTag}', '\$', 30) + mySSH.command('oc delete is oai-physim', '\$', 30) + mySSH.command('sudo podman logout https://default-route-openshift-image-registry.apps.oai.cs.eurecom.fr/', '\$', 6) mySSH.command('oc logout', '\$', 30) mySSH.close() self.AnalyzeLogFile_phySim(HTML) @@ -178,6 +244,9 @@ class PhySim: mySSH.command('oc get pods -l app.kubernetes.io/instance=physim', '\$', 6, resync=True) if re.search('No resources found', mySSH.getBefore()): isFinished1 = True + mySSH.command(f'sudo podman rmi default-route-openshift-image-registry.apps.oai.cs.eurecom.fr/{self.OCProjectName}/oai-physim:{imageTag}', '\$', 6) + mySSH.command('oc delete is oai-physim', '\$', 6) + mySSH.command('sudo podman logout https://default-route-openshift-image-registry.apps.oai.cs.eurecom.fr/', '\$', 6) mySSH.command('oc logout', '\$', 30) HTML.CreateHtmlTestRow('N/A', 'KO', CONST.OC_PHYSIM_DEPLOY_FAIL) HTML.CreateHtmlTestRowPhySimTestResult(self.testSummary,self.testResult) @@ -235,6 +304,10 @@ class PhySim: isFinished1 = True if isFinished1 == True: logging.debug('\u001B[1m UnDeployed PhySim Successfully on OC Cluster\u001B[0m') + mySSH.command(f'sudo podman rmi default-route-openshift-image-registry.apps.oai.cs.eurecom.fr/{self.OCProjectName}/oai-physim:{imageTag}', '\$', 6) + mySSH.command('oc delete is oai-physim', '\$', 6) + logging.debug('\u001B[1m Deleted the Image and ImageStream\u001B[0m') + mySSH.command('sudo podman logout https://default-route-openshift-image-registry.apps.oai.cs.eurecom.fr/', '\$', 6) mySSH.command('oc logout', '\$', 6) mySSH.close() self.AnalyzeLogFile_phySim(HTML) From 61e65959b045f8a113c464ede8219c5026b627cd Mon Sep 17 00:00:00 2001 From: Robert Schmidt Date: Fri, 16 Sep 2022 09:17:57 +0200 Subject: [PATCH 78/88] Correct physim IS filename --- ci-scripts/cls_physim1.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ci-scripts/cls_physim1.py b/ci-scripts/cls_physim1.py index 0f187a4633..8af2dcd25b 100644 --- a/ci-scripts/cls_physim1.py +++ b/ci-scripts/cls_physim1.py @@ -173,7 +173,7 @@ class PhySim: else: logging.debug('\u001B[1m Podman Login to OC Cluster Registry Successfully\u001B[0m') time.sleep(2) - mySSH.command('oc create -f openshift/oai-physim-is.yml || true', '\$', 30) + mySSH.command('oc create -f openshift/oai-physim-is.yaml || true', '\$', 30) if mySSH.getBefore().count('(AlreadyExists):') == 0 and mySSH.getBefore().count('created') == 0: logging.error(f'\u001B[1m Image Stream "oai-physim" Creation Failed on OC Cluster {ocProjectName}\u001B[0m') mySSH.command('sudo podman logout https://default-route-openshift-image-registry.apps.oai.cs.eurecom.fr/', '\$', 6) From eb15d7332bf2428a8fd388d10db8e61b49808a4c Mon Sep 17 00:00:00 2001 From: Robert Schmidt Date: Thu, 15 Sep 2022 14:23:44 +0200 Subject: [PATCH 79/88] Remove sudo commands from cluster-related CI scripts --- ci-scripts/cls_cluster.py | 14 +------------- ci-scripts/cls_containerize.py | 2 +- 2 files changed, 2 insertions(+), 14 deletions(-) diff --git a/ci-scripts/cls_cluster.py b/ci-scripts/cls_cluster.py index 86edfbe568..af73051436 100644 --- a/ci-scripts/cls_cluster.py +++ b/ci-scripts/cls_cluster.py @@ -141,18 +141,6 @@ class Cluster: def _retag_image_statement(self, sshSession, oldImage, newImage, newTag, filename): sshSession.command(f'sed -i -e "s#{oldImage}:latest#{newImage}:{newTag}#" {filename}', '\$', 5) - def _pull_image(self, sshSession, image, tag): - sshSession.command(f'oc whoami -t | sudo podman login -u oaicicd --password-stdin https://{self.OCRegistry} --tls-verify=false', '\$', 5, silent=True) - if sshSession.getBefore().count('Login Succeeded!') == 0: - return None - imageName = f'{self.OCRegistry}{self.OCProjectName}/{image}:{tag}' - sshSession.command(f'sudo podman pull {imageName} --tls-verify=false', '\$', 300) - pullResult = sshSession.getBefore() - sshSession.command(f'sudo podman logout https://{self.OCRegistry}', '\$', 10, silent=True) - if pullResult.count('Storing signatures') == 0: - return None - return imageName - def _get_image_size(self, sshSession, image, tag): # get the SHA of the image we built using the image name and its tag sshSession.command(f'oc describe is {image} | grep -A4 {tag}', '\$', 5) @@ -216,7 +204,7 @@ class Cluster: # Workaround for some servers, we need to erase completely the workspace if self.forcedWorkspaceCleanup: - mySSH.command(f'sudo rm -Rf {lSourcePath}', '\$', 15) + mySSH.command(f'rm -Rf {lSourcePath}', '\$', 15) cls_containerize.CreateWorkspace(mySSH, lSourcePath, self.ranRepository, self.ranCommitID, self.ranTargetBranch, self.ranAllowMerge) # we don't necessarily need a forced workspace cleanup, but in diff --git a/ci-scripts/cls_containerize.py b/ci-scripts/cls_containerize.py index bc3d43a83e..6197cc7e4f 100644 --- a/ci-scripts/cls_containerize.py +++ b/ci-scripts/cls_containerize.py @@ -67,7 +67,7 @@ def CreateWorkspace(sshSession, sourcePath, ranRepository, ranCommitID, ranTarge sshSession.command('git config user.email "jenkins@openairinterface.org"', '\$', 5) sshSession.command('git config user.name "OAI Jenkins"', '\$', 5) - sshSession.command('sudo git clean -x -d -ff', '\$', 30) + sshSession.command('git clean -x -d -ff', '\$', 30) sshSession.command('mkdir -p cmake_targets/log', '\$', 5) # if the commit ID is provided use it to point to it if ranCommitID != '': From 9e3d565c5d75546c7dd92ad5a9003f3e1aab60eb Mon Sep 17 00:00:00 2001 From: Robert Schmidt Date: Thu, 15 Sep 2022 14:25:55 +0200 Subject: [PATCH 80/88] Remove tag information from image streams The tags in the status section simply serves no purpose/is misleading, as it is not used. --- openshift/oai-enb-is.yaml | 2 -- openshift/oai-gnb-is.yaml | 3 --- openshift/oai-lte-ue-is.yaml | 2 -- openshift/oai-nr-ue-is.yaml | 2 -- openshift/oai-physim-is.yaml | 2 -- openshift/ran-base-is.yaml | 2 -- openshift/ran-build-is.yaml | 3 --- 7 files changed, 16 deletions(-) diff --git a/openshift/oai-enb-is.yaml b/openshift/oai-enb-is.yaml index 7e75af58d6..d7467ec37c 100644 --- a/openshift/oai-enb-is.yaml +++ b/openshift/oai-enb-is.yaml @@ -28,5 +28,3 @@ metadata: spec: lookupPolicy: local: true -status: - tag: latest diff --git a/openshift/oai-gnb-is.yaml b/openshift/oai-gnb-is.yaml index 996ad9fd1d..553f9f58e9 100644 --- a/openshift/oai-gnb-is.yaml +++ b/openshift/oai-gnb-is.yaml @@ -28,6 +28,3 @@ metadata: spec: lookupPolicy: local: true -status: - tag: latest - diff --git a/openshift/oai-lte-ue-is.yaml b/openshift/oai-lte-ue-is.yaml index 678b8e6cbf..93429faf70 100644 --- a/openshift/oai-lte-ue-is.yaml +++ b/openshift/oai-lte-ue-is.yaml @@ -28,5 +28,3 @@ metadata: spec: lookupPolicy: local: true -status: - tag: latest diff --git a/openshift/oai-nr-ue-is.yaml b/openshift/oai-nr-ue-is.yaml index 0afd7b9448..111be0d51d 100644 --- a/openshift/oai-nr-ue-is.yaml +++ b/openshift/oai-nr-ue-is.yaml @@ -28,5 +28,3 @@ metadata: spec: lookupPolicy: local: true -status: - tag: latest diff --git a/openshift/oai-physim-is.yaml b/openshift/oai-physim-is.yaml index f2c7853540..df0545eb61 100644 --- a/openshift/oai-physim-is.yaml +++ b/openshift/oai-physim-is.yaml @@ -28,5 +28,3 @@ metadata: spec: lookupPolicy: local: true -status: - tag: latest diff --git a/openshift/ran-base-is.yaml b/openshift/ran-base-is.yaml index edde0d700e..e551166627 100644 --- a/openshift/ran-base-is.yaml +++ b/openshift/ran-base-is.yaml @@ -27,5 +27,3 @@ metadata: spec: lookupPolicy: local: true -status: - tag: latest diff --git a/openshift/ran-build-is.yaml b/openshift/ran-build-is.yaml index 4f38d0ab47..0538b16478 100644 --- a/openshift/ran-build-is.yaml +++ b/openshift/ran-build-is.yaml @@ -28,6 +28,3 @@ metadata: spec: lookupPolicy: local: true -status: - tag: latest - From b14b9eda299c2b19ec5430c7164332884b366796 Mon Sep 17 00:00:00 2001 From: laurent Date: Sat, 17 Sep 2022 11:23:53 +0200 Subject: [PATCH 81/88] fix bug added in MR1609 improve-nr_ul_channel_estimation branch --- openair1/PHY/NR_ESTIMATION/nr_ul_channel_estimation.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/openair1/PHY/NR_ESTIMATION/nr_ul_channel_estimation.c b/openair1/PHY/NR_ESTIMATION/nr_ul_channel_estimation.c index 1d6ff4603f..4133875139 100644 --- a/openair1/PHY/NR_ESTIMATION/nr_ul_channel_estimation.c +++ b/openair1/PHY/NR_ESTIMATION/nr_ul_channel_estimation.c @@ -283,7 +283,7 @@ int nr_pusch_channel_estimation(PHY_VARS_gNB *gNB, pil = pilot + idxDC / 2 - 1; ul_ch += idxDC - 2 ; ul_ch = memset(ul_ch, 0, sizeof(*ul_ch)*5); - re_offset = (re_offset+idxDC-1) % symbolSize; + re_offset = (re_offset + idxDC - 2) % symbolSize; const c16_t ch=c16mulShift(*pil, rxdataF[soffset+nushift+re_offset], 15); From edfb7aca1d147e2e685083f5f974e32ce33c4b06 Mon Sep 17 00:00:00 2001 From: Robert Schmidt Date: Thu, 15 Sep 2022 15:00:01 +0200 Subject: [PATCH 82/88] Recreate imagestreamtags to not lose image registry image association Previously, the cluster-build code would recreate imagestreams, which would drop the association of image streams to images previously created. To avoid this, the code is updated to never delete imagestreams, and only recreate imagestreamtags. --- ci-scripts/cls_cluster.py | 35 ++++++++++++++++++++++------------- 1 file changed, 22 insertions(+), 13 deletions(-) diff --git a/ci-scripts/cls_cluster.py b/ci-scripts/cls_cluster.py index af73051436..bdc6e5fd3f 100644 --- a/ci-scripts/cls_cluster.py +++ b/ci-scripts/cls_cluster.py @@ -90,14 +90,23 @@ class Cluster: logging.error('error while creating buildconfig: ' + sshSession.getBefore()) return False - def _recreate_is(self, sshSession, name, newTag, filename): - sshSession.command(f'sed -i -e "s#tag: *latest#tag: {newTag}#" {filename}', '\$', 5) - sshSession.command(f'oc delete -f {filename}', '\$', 5) - sshSession.command(f'oc create -f {filename}', '\$', 5) + def _recreate_is_tag(self, sshSession, name, newTag, filename): + sshSession.command(f'oc describe is {name}', '\$', 5) + if sshSession.getBefore().count('NotFound') > 0: + sshSession.command(f'oc create -f {filename}', '\$', 5) + before = sshSession.getBefore() + if re.search(f'imagestream.image.openshift.io/{name} created', before) is None: + logging.error('error while creating imagestream: ' + sshSession.getBefore()) + return False + else: + logging.debug(f'-> imagestream {name} found') + image = f'{name}:{newTag}' + sshSession.command(f'oc delete istag {image}', '\$', 5) # we don't care if this fails, e.g., if it is missing + sshSession.command(f'oc create istag {image}', '\$', 5) before = sshSession.getBefore() - if re.search('imagestream.image.openshift.io/[a-zA-Z\-0-9]+ created', before) is not None: + if re.search(f'imagestreamtag.image.openshift.io/{image} created', before) is not None: return True - logging.error('error while creating imagestream: ' + sshSession.getBefore()) + logging.error('error while creating imagestreamtag: ' + sshSession.getBefore()) return False def _start_build(self, sshSession, name): @@ -247,7 +256,7 @@ class Cluster: status = True # flag to abandon compiling if any image fails attemptedImages = [] if forceBaseImageBuild: - self._recreate_is(mySSH, 'ran-base', baseTag, 'openshift/ran-base-is.yaml') + self._recreate_is_tag(mySSH, 'ran-base', baseTag, 'openshift/ran-base-is.yaml') self._recreate_bc(mySSH, 'ran-base', baseTag, 'openshift/ran-base-bc.yaml') ranbase_job = self._start_build(mySSH, 'ran-base') attemptedImages += ['ran-base'] @@ -265,13 +274,13 @@ class Cluster: status = False if status: - self._recreate_is(mySSH, 'oai-physim', imageTag, 'openshift/oai-physim-is.yaml') + self._recreate_is_tag(mySSH, 'oai-physim', imageTag, 'openshift/oai-physim-is.yaml') self._recreate_bc(mySSH, 'oai-physim', imageTag, 'openshift/oai-physim-bc.yaml') self._retag_image_statement(mySSH, 'ran-base', 'image-registry.openshift-image-registry.svc:5000/oaicicd-ran/ran-base', baseTag, 'docker/Dockerfile.phySim.rhel8.2') physim_job = self._start_build(mySSH, 'oai-physim') attemptedImages += ['oai-physim'] - self._recreate_is(mySSH, 'ran-build', imageTag, 'openshift/ran-build-is.yaml') + self._recreate_is_tag(mySSH, 'ran-build', imageTag, 'openshift/ran-build-is.yaml') self._recreate_bc(mySSH, 'ran-build', imageTag, 'openshift/ran-build-bc.yaml') self._retag_image_statement(mySSH, 'ran-base', 'image-registry.openshift-image-registry.svc:5000/oaicicd-ran/ran-base', baseTag, 'docker/Dockerfile.build.rhel8.2') ranbuild_job = self._start_build(mySSH, 'ran-build') @@ -284,28 +293,28 @@ class Cluster: mySSH.command(f'oc logs {physim_job} > cmake_targets/log/oai-physim.log', '\$', 10) if status: - self._recreate_is(mySSH, 'oai-enb', imageTag, 'openshift/oai-enb-is.yaml') + self._recreate_is_tag(mySSH, 'oai-enb', imageTag, 'openshift/oai-enb-is.yaml') self._recreate_bc(mySSH, 'oai-enb', imageTag, 'openshift/oai-enb-bc.yaml') self._retag_image_statement(mySSH, 'ran-base', 'image-registry.openshift-image-registry.svc:5000/oaicicd-ran/ran-base', baseTag, 'docker/Dockerfile.eNB.rhel8.2') self._retag_image_statement(mySSH, 'ran-build', 'image-registry.openshift-image-registry.svc:5000/oaicicd-ran/ran-build', imageTag, 'docker/Dockerfile.eNB.rhel8.2') enb_job = self._start_build(mySSH, 'oai-enb') attemptedImages += ['oai-enb'] - self._recreate_is(mySSH, 'oai-gnb', imageTag, 'openshift/oai-gnb-is.yaml') + self._recreate_is_tag(mySSH, 'oai-gnb', imageTag, 'openshift/oai-gnb-is.yaml') self._recreate_bc(mySSH, 'oai-gnb', imageTag, 'openshift/oai-gnb-bc.yaml') self._retag_image_statement(mySSH, 'ran-base', 'image-registry.openshift-image-registry.svc:5000/oaicicd-ran/ran-base', baseTag, 'docker/Dockerfile.gNB.rhel8.2') self._retag_image_statement(mySSH, 'ran-build', 'image-registry.openshift-image-registry.svc:5000/oaicicd-ran/ran-build', imageTag, 'docker/Dockerfile.gNB.rhel8.2') gnb_job = self._start_build(mySSH, 'oai-gnb') attemptedImages += ['oai-gnb'] - self._recreate_is(mySSH, 'oai-lte-ue', imageTag, 'openshift/oai-lte-ue-is.yaml') + self._recreate_is_tag(mySSH, 'oai-lte-ue', imageTag, 'openshift/oai-lte-ue-is.yaml') self._recreate_bc(mySSH, 'oai-lte-ue', imageTag, 'openshift/oai-lte-ue-bc.yaml') self._retag_image_statement(mySSH, 'ran-base', 'image-registry.openshift-image-registry.svc:5000/oaicicd-ran/ran-base', baseTag, 'docker/Dockerfile.lteUE.rhel8.2') self._retag_image_statement(mySSH, 'ran-build', 'image-registry.openshift-image-registry.svc:5000/oaicicd-ran/ran-build', imageTag, 'docker/Dockerfile.lteUE.rhel8.2') lteue_job = self._start_build(mySSH, 'oai-lte-ue') attemptedImages += ['oai-lte-ue'] - self._recreate_is(mySSH, 'oai-nr-ue', imageTag, 'openshift/oai-nr-ue-is.yaml') + self._recreate_is_tag(mySSH, 'oai-nr-ue', imageTag, 'openshift/oai-nr-ue-is.yaml') self._recreate_bc(mySSH, 'oai-nr-ue', imageTag, 'openshift/oai-nr-ue-bc.yaml') self._retag_image_statement(mySSH, 'ran-base', 'image-registry.openshift-image-registry.svc:5000/oaicicd-ran/ran-base', baseTag, 'docker/Dockerfile.nrUE.rhel8.2') self._retag_image_statement(mySSH, 'ran-build', 'image-registry.openshift-image-registry.svc:5000/oaicicd-ran/ran-build', imageTag, 'docker/Dockerfile.nrUE.rhel8.2') From ca5a6deb9dc7f54d020a3bfe3ddec66181b420f9 Mon Sep 17 00:00:00 2001 From: Robert Schmidt Date: Fri, 16 Sep 2022 18:08:58 +0200 Subject: [PATCH 83/88] Fix timeout in wait_job_end() --- ci-scripts/cls_cluster.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ci-scripts/cls_cluster.py b/ci-scripts/cls_cluster.py index bdc6e5fd3f..9e416d8f6a 100644 --- a/ci-scripts/cls_cluster.py +++ b/ci-scripts/cls_cluster.py @@ -134,7 +134,7 @@ class Cluster: while timeout_sec > 0: # check status for j in jobs: - sshSession.command(f'oc get pods | grep {j}', '\$', 5, silent = True) + sshSession.command(f'oc get pods | grep {j}', '\$', 10, silent = True) if sshSession.getBefore().count('Completed') > 0: jobs.remove(j) if sshSession.getBefore().count('Error') > 0: logging.error(f'error for job {j}: ' + sshSession.getBefore()) From 28487ee2237cdf62cc69c4a20b84e3037a9c3eec Mon Sep 17 00:00:00 2001 From: Robert Schmidt Date: Mon, 29 Aug 2022 14:48:47 +0200 Subject: [PATCH 84/88] Physim: image is already on openshift image registry --- ci-scripts/cls_physim1.py | 73 --------------------------------------- 1 file changed, 73 deletions(-) diff --git a/ci-scripts/cls_physim1.py b/ci-scripts/cls_physim1.py index 8af2dcd25b..56934fcd22 100644 --- a/ci-scripts/cls_physim1.py +++ b/ci-scripts/cls_physim1.py @@ -115,30 +115,6 @@ class PhySim: mySSH.command('git merge --ff origin/' + self.ranTargetBranch + ' -m "Temporary merge for CI"', '\$', 5) else: imageTag = "develop" - # Check if image is exist on the Red Hat server, before pushing it to OC cluster - mySSH.command('sudo podman image inspect --format="Size = {{.Size}} bytes" oai-physim:' + imageTag, '\$', 60) - if mySSH.getBefore().count('no such image') != 0: - logging.error('\u001B[1m No such image oai-physim\u001B[0m') - mySSH.close() - HTML.CreateHtmlTestRow('N/A', 'KO', CONST.PHYSIM_IMAGE_ABSENT) - RAN.prematureExit = True - return - else: - result = re.search('Size *= *(?P[0-9\-]+) *bytes', mySSH.getBefore()) - if result is not None: - imageSize = float(result.group('size')) - imageSize = imageSize / 1000 - if imageSize < 1000: - logging.debug('\u001B[1m oai-physim size is ' + ('%.0f' % imageSize) + ' kbytes\u001B[0m') - else: - imageSize = imageSize / 1000 - if imageSize < 1000: - logging.debug('\u001B[1m oai-physim size is ' + ('%.0f' % imageSize) + ' Mbytes\u001B[0m') - else: - imageSize = imageSize / 1000 - logging.debug('\u001B[1m oai-physim is ' + ('%.3f' % imageSize) + ' Gbytes\u001B[0m') - else: - logging.debug('oai-physim size is unknown') # logging to OC Cluster and then switch to corresponding project mySSH.command(f'oc login -u {ocUserName} -p {ocPassword} --server https://api.oai.cs.eurecom.fr:6443', '\$', 30) @@ -161,46 +137,7 @@ class PhySim: else: logging.debug(f'\u001B[1m Now using project {ocProjectName}\u001B[0m') - # Tag the image and push to the OC cluster - mySSH.command('oc whoami -t | sudo podman login -u ' + ocUserName + ' --password-stdin https://default-route-openshift-image-registry.apps.oai.cs.eurecom.fr/ --tls-verify=false', '\$', 30) - if mySSH.getBefore().count('Login Succeeded!') == 0: - logging.error('\u001B[1m Podman Login to OC Cluster Registry Failed\u001B[0m') - mySSH.command('oc logout', '\$', 30) - mySSH.close() - HTML.CreateHtmlTestRow('N/A', 'KO', CONST.OC_LOGIN_FAIL) - RAN.prematureExit = True - return - else: - logging.debug('\u001B[1m Podman Login to OC Cluster Registry Successfully\u001B[0m') - time.sleep(2) - mySSH.command('oc create -f openshift/oai-physim-is.yaml || true', '\$', 30) - if mySSH.getBefore().count('(AlreadyExists):') == 0 and mySSH.getBefore().count('created') == 0: - logging.error(f'\u001B[1m Image Stream "oai-physim" Creation Failed on OC Cluster {ocProjectName}\u001B[0m') - mySSH.command('sudo podman logout https://default-route-openshift-image-registry.apps.oai.cs.eurecom.fr/', '\$', 6) - mySSH.command('oc logout', '\$', 30) - mySSH.close() - HTML.CreateHtmlTestRow('N/A', 'KO', CONST.OC_IS_FAIL) - RAN.prematureExit = True - return - else: - logging.debug(f'\u001B[1m Image Stream "oai-physim" created on OC project {ocProjectName}\u001B[0m') - time.sleep(2) - mySSH.command(f'sudo podman tag oai-physim:{imageTag} default-route-openshift-image-registry.apps.oai.cs.eurecom.fr/{self.OCProjectName}/oai-physim:{imageTag}', '\$', 30) - time.sleep(2) - mySSH.command(f'sudo podman push default-route-openshift-image-registry.apps.oai.cs.eurecom.fr/{self.OCProjectName}/oai-physim:{imageTag} --tls-verify=false', '\$', 180) - if mySSH.getBefore().count('Storing signatures') == 0: - logging.error('\u001B[1m Image "oai-physim" push to OC Cluster Registry Failed\u001B[0m') - mySSH.command('sudo podman logout https://default-route-openshift-image-registry.apps.oai.cs.eurecom.fr/', '\$', 6) - mySSH.command('oc logout', '\$', 30) - mySSH.close() - HTML.CreateHtmlTestRow('N/A', 'KO', CONST.OC_IS_FAIL) - RAN.prematureExit = True - return - else: - logging.debug('\u001B[1m Image "oai-physim" push to OC Cluster Registry Successfully\u001B[0m') - # Using helm charts deployment - time.sleep(5) mySSH.command(f'grep -rl OAICICD_PROJECT ./charts/ | xargs sed -i -e "s#OAICICD_PROJECT#{ocProjectName}#"', '\$', 30) mySSH.command(f'sed -i -e "s#TAG#{imageTag}#g" ./charts/physims/values.yaml', '\$', 6) mySSH.command('helm install physim ./charts/physims/ 2>&1 | tee -a cmake_targets/log/physim_helm_summary.txt', '\$', 30) @@ -213,9 +150,6 @@ class PhySim: mySSH.command('oc get pods -l app.kubernetes.io/instance=physim', '\$', 6, resync=True) if re.search('No resources found', mySSH.getBefore()): isFinished1 = True - mySSH.command(f'sudo podman rmi default-route-openshift-image-registry.apps.oai.cs.eurecom.fr/{self.OCProjectName}/oai-physim:{imageTag}', '\$', 30) - mySSH.command('oc delete is oai-physim', '\$', 30) - mySSH.command('sudo podman logout https://default-route-openshift-image-registry.apps.oai.cs.eurecom.fr/', '\$', 6) mySSH.command('oc logout', '\$', 30) mySSH.close() self.AnalyzeLogFile_phySim(HTML) @@ -244,9 +178,6 @@ class PhySim: mySSH.command('oc get pods -l app.kubernetes.io/instance=physim', '\$', 6, resync=True) if re.search('No resources found', mySSH.getBefore()): isFinished1 = True - mySSH.command(f'sudo podman rmi default-route-openshift-image-registry.apps.oai.cs.eurecom.fr/{self.OCProjectName}/oai-physim:{imageTag}', '\$', 6) - mySSH.command('oc delete is oai-physim', '\$', 6) - mySSH.command('sudo podman logout https://default-route-openshift-image-registry.apps.oai.cs.eurecom.fr/', '\$', 6) mySSH.command('oc logout', '\$', 30) HTML.CreateHtmlTestRow('N/A', 'KO', CONST.OC_PHYSIM_DEPLOY_FAIL) HTML.CreateHtmlTestRowPhySimTestResult(self.testSummary,self.testResult) @@ -304,10 +235,6 @@ class PhySim: isFinished1 = True if isFinished1 == True: logging.debug('\u001B[1m UnDeployed PhySim Successfully on OC Cluster\u001B[0m') - mySSH.command(f'sudo podman rmi default-route-openshift-image-registry.apps.oai.cs.eurecom.fr/{self.OCProjectName}/oai-physim:{imageTag}', '\$', 6) - mySSH.command('oc delete is oai-physim', '\$', 6) - logging.debug('\u001B[1m Deleted the Image and ImageStream\u001B[0m') - mySSH.command('sudo podman logout https://default-route-openshift-image-registry.apps.oai.cs.eurecom.fr/', '\$', 6) mySSH.command('oc logout', '\$', 6) mySSH.close() self.AnalyzeLogFile_phySim(HTML) From 5cb85c3f4aa50cf7653e21d545f268a67a4ea255 Mon Sep 17 00:00:00 2001 From: Robert Schmidt Date: Mon, 5 Sep 2022 15:11:33 +0200 Subject: [PATCH 85/88] Switch to RHEL8-Cluster-Image-Builder in RAN-Container-Parent --- ci-scripts/Jenkinsfile-GitLab-Container | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/ci-scripts/Jenkinsfile-GitLab-Container b/ci-scripts/Jenkinsfile-GitLab-Container index 89665f292f..c8fb565488 100644 --- a/ci-scripts/Jenkinsfile-GitLab-Container +++ b/ci-scripts/Jenkinsfile-GitLab-Container @@ -136,16 +136,16 @@ pipeline { } } } - stage ("RHEL8 Build") { + stage ("RHEL8-Cluster-Image-Builder") { steps { script { - triggerSlaveJob ('RAN-RHEL8-Image-Builder', 'RHEL8-Images-Build') + triggerSlaveJob ('RAN-RHEL8-Cluster-Image-Builder', 'RHEL8-Cluster-Image-Builder') } } post { always { script { - finalizeSlaveJob('RAN-RHEL8-Image-Builder') + finalizeSlaveJob('RAN-RHEL8-Cluster-Image-Builder') } } failure { From 7d20568c094576bf359bf98883c43a891e432f29 Mon Sep 17 00:00:00 2001 From: Robert Schmidt Date: Fri, 16 Sep 2022 16:41:00 +0200 Subject: [PATCH 86/88] List all OC images in registry in artifact file --- ci-scripts/cls_cluster.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/ci-scripts/cls_cluster.py b/ci-scripts/cls_cluster.py index 9e416d8f6a..210191ce66 100644 --- a/ci-scripts/cls_cluster.py +++ b/ci-scripts/cls_cluster.py @@ -345,6 +345,9 @@ class Cluster: imageSize[image] = f'{sizeMb:.1f} Mbytes (uncompressed: ~{sizeMb*2.5:.1f} Mbytes)' logging.info(f'\u001B[1m{image} size is {imageSize[image]}\u001B[0m') + grep_exp = "\|".join(attemptedImages) + mySSH.command(f'oc get images | grep -e \'{grep_exp}\' > cmake_targets/log/image_registry.log', '\$', 10); + build_log_name = f'build_log_{self.testCase_id}' cls_containerize.CopyLogsToExecutor(mySSH, lSourcePath, build_log_name, lIpAddr, 'oaicicd', CONST.CI_NO_PASSWORD) From b6c2dd7820d2c592dd4c4087f9462ee14592b1a2 Mon Sep 17 00:00:00 2001 From: Robert Schmidt Date: Fri, 16 Sep 2022 10:53:53 +0200 Subject: [PATCH 87/88] Update README for OpenShift deployments using helm --- openshift/README.md | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/openshift/README.md b/openshift/README.md index 481dc5e4fe..9f0923bd60 100644 --- a/openshift/README.md +++ b/openshift/README.md @@ -12,6 +12,8 @@ +[[_TOC_]] + # 1. Introduction ## General @@ -119,13 +121,14 @@ The `` could be `oai-gnb`, and the `` `ci-temp`. # 6. Deployment using HELM Charts -**CAUTION: even more experimental.** - -Helm charts are located in another repository: +Helm charts are located under `charts`. Assuming that the image is in the image +registry, the physims could be deployed as shown in the following steps: ```bash -git clone https://github.com/OPENAIRINTERFACE/openair-k8s.git -cd openair-k8s -git checkout helm-deployment-S6a-S1C-S1U-in-network-18-with-enb -helm install mme /path-to-your-cloned/openair-k8s/charts/oai-mme/ +grep -rl OAICICD_PROJECT ./charts/ | xargs sed -i -e "s#OAICICD_PROJECT#oaicicd-ran#" # select the correct project +sed -i -e "s#TAG#ci-temp#g" ./charts/physims/values.yaml # select the correct tag +helm install physim ./charts/physims/ # deploy +oc get pods # get the list of deployed containers +oc logs # inspect the logs of a pod +helm uninstall physim # undeploy ``` From bfba0c87ed4052b212189ff2bbcf9104c719eb6d Mon Sep 17 00:00:00 2001 From: Robert Schmidt Date: Thu, 22 Sep 2022 15:35:54 +0200 Subject: [PATCH 88/88] Remove sudo from cls_physim1 class We move the execution of the physim to a jumphost without sudo rights. Therefore, remove sudo from this class. --- ci-scripts/cls_physim1.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/ci-scripts/cls_physim1.py b/ci-scripts/cls_physim1.py index 56934fcd22..4b7c01c64d 100644 --- a/ci-scripts/cls_physim1.py +++ b/ci-scripts/cls_physim1.py @@ -92,7 +92,7 @@ class PhySim: full_ran_repo_name = self.ranRepository.replace('git/', 'git') else: full_ran_repo_name = self.ranRepository + '.git' - mySSH.command('echo ' + lPassWord + ' | sudo rm -Rf ' + lSourcePath, '\$', 30) + mySSH.command('rm -Rf ' + lSourcePath, '\$', 30) mySSH.command('mkdir -p ' + lSourcePath, '\$', 5) mySSH.command('cd ' + lSourcePath, '\$', 5) mySSH.command('if [ ! -e .git ]; then stdbuf -o0 git clone ' + full_ran_repo_name + ' .; else stdbuf -o0 git fetch --prune; fi', '\$', 600) @@ -100,7 +100,7 @@ class PhySim: mySSH.command('git config user.email "jenkins@openairinterface.org"', '\$', 5) mySSH.command('git config user.name "OAI Jenkins"', '\$', 5) - mySSH.command('echo ' + lPassWord + ' | sudo -S git clean -x -d -ff', '\$', 30) + mySSH.command('git clean -x -d -ff', '\$', 30) mySSH.command('mkdir -p cmake_targets/log', '\$', 5) # if the commit ID is provided use it to point to it if self.ranCommitID != '':