diff --git a/auto-test.py b/auto-test.py index 00af77d..81e3cb9 100644 --- a/auto-test.py +++ b/auto-test.py @@ -374,8 +374,13 @@ def run_gnb_test(args): parser.add_argument('--timing_advance', type=int, help='Timing advance. Only used at UE-side. Overrides timing advance of base configuration') + parser.add_argument('--cores', + default='', + type=str, + help='Cores to force OAI gNB on, e.g., 0-45') parser.add_argument('--tqsample', default=True, action='store_true', help='use 3/4 of sampling rate in USRP') parser.add_argument('--flash', '-f', default=False, action='store_true') + parser.add_argument('--oai_extra_args', type=str, default='', help='Extra args to pass to OAI') args = parser.parse_args() args.f1_remote_node = '0.0.0.0' args.if_freq = 0 diff --git a/radio_api/common.sh b/radio_api/common.sh index 7e821d6..84fc9c1 100755 --- a/radio_api/common.sh +++ b/radio_api/common.sh @@ -30,6 +30,7 @@ while IFS='=' read -r key value || [[ -n "$line" ]]; do "timing_advance") timing_advance="$value" ;; "start_dapp") start_dapp="$value" ;; "dapp_args") dapp_args="$value" ;; + "oai_extra_args") oai_extra_args="$value" ;; # Add more cases for other keys as needed esac fi @@ -37,12 +38,11 @@ done < "$config_file" script_cmd="" if [ "$mode_type" == "gnb" ]; then - script_cmd="auto-test.py -T gnb" + script_cmd="auto-test.py -T gnb --cores 0-45" + if [ -z ${oai_extra_args+x} ]; then :; else script_cmd+=" --oai_extra_args="${oai_extra_args}; fi elif [ "$mode_type" == "ue" ]; then script_cmd="auto-test.py -T ue -t ${iperf_duration} --iperf_protocol ${iperf_protocol} -D ${dl_iperf_rate} -U ${ul_iperf_rate}" if [ -z ${timing_advance+x} ]; then :; else script_cmd=${script_cmd}" --timing_advance ${timing_advance}"; fi - echo ${script_cmd} - # script_cmd="auto-test.py -T ue -t ${iperf_duration}" elif [ "$mode_type" == "core" ]; then script_cmd="auto-test.py -T core-nw" else @@ -50,3 +50,5 @@ else exit 1 fi +echo ${script_cmd} + diff --git a/radio_api/start.sh b/radio_api/start.sh index c95ea86..0c9691f 100755 --- a/radio_api/start.sh +++ b/radio_api/start.sh @@ -37,7 +37,7 @@ else echo "[`date`] Command line ${script_cmd}" >> /logs/run.log cd ${APP_DIR} - python3 ${APP_DIR}/${script_cmd} + eval "python3 ${APP_DIR}/${script_cmd}" 2> /logs/python_error.log fi exit 0 diff --git a/radio_api/stop.sh b/radio_api/stop.sh index 3998ba8..bf075bd 100755 --- a/radio_api/stop.sh +++ b/radio_api/stop.sh @@ -26,6 +26,7 @@ if [ "$mode_type" == "ue" ]; then elif [ "$mode_type" == "gnb" ]; then systemctl stop oai_ran.service cp /root/last_log /logs/nr-gnb.log + cp /root/openairinterface5g/cmake_targets/ran_build/build/*.log /logs/ 2> /dev/null elif [ "$mode_type" == "core" ]; then systemctl stop oai_5gc.service cp /root/iperf-core-server-ue-* /logs/ diff --git a/ran.py b/ran.py index 556c635..e482663 100644 --- a/ran.py +++ b/ran.py @@ -77,6 +77,11 @@ def __init__(self, args): if args.timing_advance is not None: self.conf["timing_advance"] = args.timing_advance + # get extra args + self.oai_extra_args = [] + if self.args.oai_extra_args: + self.oai_extra_args = self.args.oai_extra_args.split(' ') + self.set_ips() try: os.remove('/root/last_log') @@ -194,6 +199,8 @@ def run_gnb(self, type): if self.args.gdb > 0: # gdb override numa pre_path += ['gdb', '--args'] + if self.args.cores: + pre_path += ['taskset', '-ca', self.args.cores] executable = [f'{OAI_PATH}cmake_targets/ran_build/build/nr-softmodem'] oai_args = ['-O', f'{self.config_file}', '--usrp-tx-thread-config', '1'] if self.prb >= 106 and self.numerology == 1: @@ -229,8 +236,13 @@ def run_gnb(self, type): oai_args += ['--T_stdout', '2', '--gNBs.[0].do_SRS', '0'] + # Add any additional extra args passed + if self.oai_extra_args: + oai_args += self.oai_extra_args + # Set F1 parameters oai_args += f1_cmd_args + self.cmd_stored = pre_path + executable + oai_args if self.execute: command_to_run = f"""{' '.join(self.cmd_stored)} 2>&1 | tee ~/mylogs/gNB-$(date +"%m%d%H%M").log | tee ~/last_log"""