From 703fa47814280c4a5f77f158525a0d0dbc5d75c6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=BAben=20Soares=20da=20Silva?= <rsilva@allbesmart.pt> Date: Thu, 15 Dec 2022 15:41:30 +0000 Subject: [PATCH] Use string values for nFAPI parameter (--nfapi) - previously, used magic numbers to designate nFAPI mode - now, use string values (MONOLITHIC, PNF, VNF, ...) - Remove printing of the nfapi mode to the console, as it's value is clear from the command-line argument - Update usages of the --nfapi command-line parameter in scripts and documentation to reflect the change to string values --- ci-scripts/cls_oaicitest.py | 2 +- .../5g_l2sim_tdd/docker-compose.yaml | 4 +- doc/RUN_NR_NFAPI.md | 8 +-- executables/nr-softmodem.c | 22 --------- executables/softmodem-common.c | 24 ++++++--- executables/softmodem-common.h | 49 ++++++++++++++++++- 6 files changed, 70 insertions(+), 39 deletions(-) diff --git a/ci-scripts/cls_oaicitest.py b/ci-scripts/cls_oaicitest.py index e21176c1762..328785f8d1f 100644 --- a/ci-scripts/cls_oaicitest.py +++ b/ci-scripts/cls_oaicitest.py @@ -3179,7 +3179,7 @@ class OaiCiTest(): result = re.search('warning: discard PDU, sn out of window', str(line)) if result is not None: nbPduDiscard += 1 - result = re.search('--nfapi 5 --node-number 2 --sa', str(line)) + result = re.search('--nfapi STANDALONE_PNF --node-number 2 --sa', str(line)) if result is not None: frequency_found = True result = re.search('Exiting OAI softmodem', str(line)) 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 9ece49da74b..83b6ce50ae7 100644 --- a/ci-scripts/yaml_files/5g_l2sim_tdd/docker-compose.yaml +++ b/ci-scripts/yaml_files/5g_l2sim_tdd/docker-compose.yaml @@ -251,7 +251,7 @@ services: LOCAL_S_IF_NAME: 'lo:' REMOTE_S_ADDRESS: 127.0.0.1 LOCAL_S_ADDRESS: 127.0.0.2 - USE_ADDITIONAL_OPTIONS: --sa --nfapi 2 --emulate-l1 --log_config.global_log_options level,time,thread_id,nocolor + USE_ADDITIONAL_OPTIONS: --sa --nfapi VNF --emulate-l1 --log_config.global_log_options level,time,thread_id,nocolor depends_on: - oai-spgwu - oai-amf @@ -295,7 +295,7 @@ services: NR_UE_NFAPI_IF_NAME: eno1 GNB_IP_ADDRESS: 127.0.0.1 NR_UE_IP_ADDRESS: 127.0.0.1 - USE_ADDITIONAL_OPTIONS: --nokrnmod 1 --nfapi 5 --node-number 2 --sa --emulate-l1 --log_config.global_log_options level,time,thread_id,nocolor + USE_ADDITIONAL_OPTIONS: --nokrnmod 1 --nfapi STANDALONE_PNF --node-number 2 --sa --emulate-l1 --log_config.global_log_options level,time,thread_id,nocolor volumes: - ../../../openair1/SIMULATION/LTE_PHY/BLER_SIMULATIONS/AWGN/AWGN_results:/opt/oai-nr-ue/openair1/SIMULATION/LTE_PHY/BLER_SIMULATIONS/AWGN/AWGN_results depends_on: diff --git a/doc/RUN_NR_NFAPI.md b/doc/RUN_NR_NFAPI.md index ea7c2590c73..e294703d440 100644 --- a/doc/RUN_NR_NFAPI.md +++ b/doc/RUN_NR_NFAPI.md @@ -21,12 +21,12 @@ sudo ifconfig lo: 127.0.0.2 netmask 255.0.0.0 up ### VNF command ``` -sudo ./nr-softmodem -O ../../../targets/PROJECTS/GENERIC-LTE-EPC/CONF/rcc.band78.tm1.106PRB.nfapi.conf --nfapi 2 --noS1 --phy-test +sudo ./nr-softmodem -O ../../../targets/PROJECTS/GENERIC-LTE-EPC/CONF/rcc.band78.tm1.106PRB.nfapi.conf --nfapi VNF --noS1 --phy-test ``` ### PNF command ``` -sudo ./nr-softmodem -O ../../../targets/PROJECTS/GENERIC-LTE-EPC/CONF/oaiL1.nfapi.usrpx300.conf --nfapi 1 --rfsim --phy-test --rfsimulator.serveraddr server +sudo ./nr-softmodem -O ../../../targets/PROJECTS/GENERIC-LTE-EPC/CONF/oaiL1.nfapi.usrpx300.conf --nfapi PNF --rfsim --phy-test --rfsimulator.serveraddr server ``` ### UE command @@ -38,12 +38,12 @@ sudo RFSIMULATOR=127.0.0.1 ./nr-uesoftmodem --rfsim --phy-test --rrc_config_path ### VNF command ``` -sudo ./nr-softmodem -O ../../../targets/PROJECTS/GENERIC-LTE-EPC/CONF/rcc.band78.tm1.106PRB.nfapi.conf --nfapi 2 --noS1 --phy-test +sudo ./nr-softmodem -O ../../../targets/PROJECTS/GENERIC-LTE-EPC/CONF/rcc.band78.tm1.106PRB.nfapi.conf --nfapi VNF --noS1 --phy-test ``` ### PNF command ``` -sudo ./nr-softmodem -O ../../../targets/PROJECTS/GENERIC-LTE-EPC/CONF/oaiL1.nfapi.usrpx300.conf --nfapi 1 --phy-test +sudo ./nr-softmodem -O ../../../targets/PROJECTS/GENERIC-LTE-EPC/CONF/oaiL1.nfapi.usrpx300.conf --nfapi PNF --phy-test ``` ### UE command diff --git a/executables/nr-softmodem.c b/executables/nr-softmodem.c index 0ecd46e5e0e..b9c26af1a38 100644 --- a/executables/nr-softmodem.c +++ b/executables/nr-softmodem.c @@ -598,28 +598,6 @@ int main( int argc, char **argv ) { pthread_mutex_init(&sync_mutex, NULL); } - const char *nfapi_mode_str = "<UNKNOWN>"; - - switch(NFAPI_MODE) { - case 0: - nfapi_mode_str = "MONOLITHIC"; - break; - - case 1: - nfapi_mode_str = "PNF"; - break; - - case 2: - nfapi_mode_str = "VNF"; - break; - - default: - nfapi_mode_str = "<UNKNOWN NFAPI MODE>"; - break; - } - - printf("NFAPI MODE:%s\n", nfapi_mode_str); - printf("START MAIN THREADS\n"); // start the main threads number_of_cards = 1; diff --git a/executables/softmodem-common.c b/executables/softmodem-common.c index e1a3583bb0e..7c0b9cd1cda 100644 --- a/executables/softmodem-common.c +++ b/executables/softmodem-common.c @@ -98,17 +98,25 @@ void get_common_options(uint32_t execmask) { uint32_t start_websrv = 0; uint32_t noS1 = 0, nokrnmod = 1, nonbiot = 0; uint32_t rfsim = 0, do_forms = 0; + int nfapi_index = 0; char *logmem_filename = NULL; - paramdef_t cmdline_params[] =CMDLINE_PARAMS_DESC ; + check_execmask(execmask); + + paramdef_t cmdline_params[] = CMDLINE_PARAMS_DESC; + checkedparam_t cmdline_CheckParams[] = CMDLINE_PARAMS_CHECK_DESC; + int numparams = sizeof(cmdline_params) / sizeof(paramdef_t); + config_set_checkfunctions(cmdline_params, cmdline_CheckParams, numparams); + config_get(cmdline_params, sizeof(cmdline_params) / sizeof(paramdef_t), NULL); + nfapi_index = config_paramidx_fromname(cmdline_params, sizeof(cmdline_params) / sizeof(paramdef_t),"nfapi"); + AssertFatal(nfapi_index != -1,"Index for nfapi config option not found!"); + nfapi_mode = config_get_processedint(&cmdline_params[nfapi_index]); + paramdef_t cmdline_logparams[] =CMDLINE_LOGPARAMS_DESC ; checkedparam_t cmdline_log_CheckParams[] = CMDLINE_LOGPARAMS_CHECK_DESC; - check_execmask(execmask); - config_get( cmdline_params,sizeof(cmdline_params)/sizeof(paramdef_t),NULL); - - int numparams=sizeof(cmdline_logparams)/sizeof(paramdef_t); - config_set_checkfunctions(cmdline_logparams, cmdline_log_CheckParams,numparams); - config_get( cmdline_logparams,numparams,NULL); - + int numlogparams = sizeof(cmdline_logparams) / sizeof(paramdef_t); + config_set_checkfunctions(cmdline_logparams, cmdline_log_CheckParams, numlogparams); + config_get(cmdline_logparams, numlogparams, NULL); + if(config_isparamset(cmdline_logparams,config_paramidx_fromname(cmdline_logparams,numparams, CONFIG_FLOG_OPT))) { set_glog_onlinelog(online_log_messages); } diff --git a/executables/softmodem-common.h b/executables/softmodem-common.h index 752b64bb384..1263d9713b5 100644 --- a/executables/softmodem-common.h +++ b/executables/softmodem-common.h @@ -97,7 +97,7 @@ extern "C" #define CONFIG_HLP_NOKRNMOD "(noS1 only): Use tun instead of namesh module \n" #define CONFIG_HLP_DISABLNBIOT "disable nb-iot, even if defined in config\n" #define CONFIG_HLP_USRP_THREAD "having extra thead for usrp tx\n" -#define CONFIG_HLP_NFAPI "Change the nFAPI mode for NR\n" +#define CONFIG_HLP_NFAPI "Change the nFAPI mode for NR 'MONOLITHIC', 'PNF', 'VNF','UE_STUB_PNF','UE_STUB_OFFNET','STANDALONE_PNF'\n" #define CONFIG_L1_EMULATOR "Run in L1 emulated mode (disable PHY layer)\n" #define CONFIG_HLP_CONTINUOUS_TX "perform continuous transmission, even in TDD mode (to work around USRP issues)\n" #define CONFIG_HLP_STATS_DISABLE "disable globally the stats generation and persistence" @@ -167,13 +167,58 @@ extern int usrp_tx_thread; {"nsa", CONFIG_HLP_NSA, PARAMFLAG_BOOL, iptr:&NSA, defintval:0, TYPE_INT, 0}, \ {"node-number", NULL, 0, u16ptr:&NODE_NUMBER, defuintval:0, TYPE_UINT16, 0}, \ {"usrp-tx-thread-config", CONFIG_HLP_USRP_THREAD, 0, iptr:&usrp_tx_thread, defstrval:0, TYPE_INT, 0}, \ - {"nfapi", CONFIG_HLP_NFAPI, 0, u8ptr:&nfapi_mode, defintval:0, TYPE_UINT8, 0}, \ + {"nfapi", CONFIG_HLP_NFAPI, 0, strptr:NULL, defstrval:"MONOLITHIC", TYPE_STRING, 0}, \ {"non-stop", CONFIG_HLP_NONSTOP, PARAMFLAG_BOOL, iptr:&NON_STOP, defintval:0, TYPE_INT, 0}, \ {"emulate-l1", CONFIG_L1_EMULATOR, PARAMFLAG_BOOL, iptr:&EMULATE_L1, defintval:0, TYPE_INT, 0}, \ {"continuous-tx", CONFIG_HLP_CONTINUOUS_TX,PARAMFLAG_BOOL, iptr:&CONTINUOUS_TX, defintval:0, TYPE_INT, 0}, \ {"disable-stats", CONFIG_HLP_STATS_DISABLE, PARAMFLAG_BOOL, iptr:&stats_disabled, defintval:0, TYPE_INT, 0}, \ } + + +#define CMDLINE_PARAMS_CHECK_DESC { \ + { .s5 = { NULL } }, \ + { .s5 = { NULL } }, \ + { .s5 = { NULL } }, \ + { .s5 = { NULL } }, \ + { .s5 = { NULL } }, \ + { .s5 = { NULL } }, \ + { .s5 = { NULL } }, \ + { .s5 = { NULL } }, \ + { .s5 = { NULL } }, \ + { .s5 = { NULL } }, \ + { .s5 = { NULL } }, \ + { .s5 = { NULL } }, \ + { .s5 = { NULL } }, \ + { .s5 = { NULL } }, \ + { .s5 = { NULL } }, \ + { .s5 = { NULL } }, \ + { .s5 = { NULL } }, \ + { .s5 = { NULL } }, \ + { .s5 = { NULL } }, \ + { .s5 = { NULL } }, \ + { .s5 = { NULL } }, \ + { .s5 = { NULL } }, \ + { .s5 = { NULL } }, \ + { .s5 = { NULL } }, \ + { .s5 = { NULL } }, \ + { .s5 = { NULL } }, \ + { .s5 = { NULL } }, \ + { .s5 = { NULL } }, \ + { .s5 = { NULL } }, \ + { .s5 = { NULL } }, \ + { .s5 = { NULL } }, \ + { .s3a = { config_checkstr_assign_integer, \ + {"MONOLITHIC", "PNF", "VNF","UE_STUB_PNF","UE_STUB_OFFNET","STANDALONE_PNF"}, \ + {NFAPI_MONOLITHIC, NFAPI_MODE_PNF, NFAPI_MODE_VNF,NFAPI_UE_STUB_PNF,NFAPI_UE_STUB_OFFNET,NFAPI_MODE_STANDALONE_PNF}, \ + 6 } }, \ + { .s5 = { NULL } }, \ + { .s5 = { NULL } }, \ + { .s5 = { NULL } }, \ + { .s5 = { NULL } }, \ + { .s5 = { NULL } }, \ +} + #define CONFIG_HLP_NSA "Enable NSA mode \n" #define CONFIG_HLP_FLOG "Enable online log \n" #define CONFIG_HLP_LOGL "Set the global log level, valid options: (4:trace, 3:debug, 2:info, 1:warn, (0:error))\n" -- GitLab