作者主页(文火冰糖的硅基工坊):文火冰糖(王文兵)的博客_文火冰糖的硅基工坊_CSDN博客
本文网址:https://blog.csdn.net/HiWangWenBing/article/details/120680728
目录
第1章 概述与软件测试架构
1.1 信息来源
1.2 目标程序测试环境架构: RF Simulator
1.3 测试系统架构
第2章 目标代码的编译
2.1 Build LTE UE and eNB without RF Simulator (仅供对比)
2.2 build NR UE and gNB witout RF Simulator:-w SIMU(4G测试)
2.3 build NR UE and gNB with RF Simulator :-w SIMU(5G测试)
2.4 单独编译RF Simulator
第3章 目标代码的运行
3.1 参考描述
3.2 启动前检查:
3.3 启动基站
3.4 启动UE
第4章 目标代码的测试
4.1 查看PHY层自动产生的随机数据
4.2 Ping测试
4.3 Iperf UDP测试
4.4 Iperf TCP测试
第5章附录
5.1 iperf参数详细说明
(1)OAI主页oai / openairinterface5G · GitLabOpenairinterface 5G Wireless Implementationhttps://gitlab.eurecom.fr/oai/openairinterface5g(2)How to run OAI主页
doc/RUNMODEM.md · develop · oai / openairinterface5G · GitLabOpenairinterface 5G Wireless Implementationhttps://gitlab.eurecom.fr/oai/openairinterface5g/-/blob/develop/doc/RUNMODEM.md注意:5G NR在develop分支上,而不是master分支。
(3)How to run OAI with RF Simulator主页
targets/ARCH/rfsimulator/README.md · develop · oai / openairinterface5G · GitLabhttps://gitlab.eurecom.fr/oai/openairinterface5g/-/blob/develop/targets/ARCH/rfsimulator/README.md
RF Simulator测试是指,在没有真实的RF板的情况下,使用RF Simulator替代真实的RF板子,进进行OAI功能性测试。当然,性能可能要比有真实的RF板时差很多。
在RF Simulator的情况下,数据的来源有两种模式:
(1)"noS1" mode:在这种模式下,通过UE侧和核心网侧的ping和iperf工具,把基站和UE之间的传输通道,在两侧进行数据传输数据。
(2)"phy-test" mode:在这种模式下,在每个MAC层调度周期内,基站随机的发送一些DL下行数据,而手机随机地发送一些UL上行数据。
说明:
(0)如果Linx-1(UE)和Linux-2(基站)是同一个服务器,则IP数据包不会通过oaitun_enb1和oaitun_ue1这两个物理接口的驱动,直接被IP层间直接路由,从而导致数据包不会经过空口协议栈。
(1)网络接口oaitun_ue1,是UE程序nr-uesoftmodem创建的接口驱动,它调用UE的空口协议栈进行数据包的收发。
(2)网络接口oaitun_enb1,是基站程序nr-softmodem创建的接口驱动,它调用基站的空口协议栈进行数据包的收发。
通过ifconfig查看IP接口:
(3)基站或UE的RF,可以通过三种方式收发数据包:
通过netstat -tulnp 查看端口状态:
cd /openairinterface5g/
source oaienv
cd cmake_targets/
./build_oai --eNB --UE
>./build_oai --UE --eNB
Will compile UE
Will compile eNB
CMAKE_CMD=cmake ..
No local radio head and no transport protocol selected
No radio head has been selected (HW set to None)
No transport protocol has been selected (TP set to None)
RF HW set to None
Flags for Deadline scheduler: False
......................
......................
Compiling rfsimulator
Log file for compilation has been written to: /usr/local/oai/rfsimu_config/openairinterface5g/cmake_targets/log/rfsimulator.Rel15.txt
rfsimulator compiled
......................
......................
备注:
rfsimulator会自动默认的OAI RF设备,因此,在编译UE和eNB的时候,会自动重新编译rfsimulator。
虽然rfsimulator被编译了,但RF HW set to NULL。
因此,如果使用rfsimulator测试,还需要指明RF使用的是RF rfsimulator设备,而不是USRP设备。
cd /openairinterface5g/
source oaienv
cd cmake_targets/
./build_oai --UE --eNB
cd /openairinterface5g/
source oaienv
cd cmake_targets/
./build_oai -w SIMU --nrUE --gNB
>./build_oai -w SIMU --nrUE --gNB
Setting hardware to: OAI_SIMU
Will compile UE
Will compile eNB
CMAKE_CMD=cmake ..
RF HW set to OAI_SIMU
Flags for Deadline scheduler: False
Flags for CPU Affinity: False
2. Setting the OAI PATHS ...
OPENAIR_DIR = /home/wangwenbing/oai/openairinterface5g
(1)方法1:./build_oai --phy_simulators
cd /openairinterface5g/
source oaienv
cd cmake_targets/
./build_oai --phy_simulators
(2)方法2:make rfsimulator
cd /openairinterface5g/
source oaienv
cd cmake_targets/ran_build/build
make rfsimulator
Built target generate_T
Built target SIMU_COMMON
Built target rfsimulator
This is equivalent to using -w SIMU
when running the build_oai
script.
特别注意:
The 5G RF simulator will be aligned with the 4G as the efforts for merging the 5G specific branches into the develop make progresses.
After regular build, add the simulation driver (do not use ./build_oai -w SIMU until 4G and 5G branches are merged).
目前,还不能通过-w SIMU来编译5G 5G RF simulator, 5G RF simulator需要在编译UE和gNB之后,单独编译:make rfsimulator
targets/ARCH/rfsimulator/README.md · develop · oai / openairinterface5G · GitLabhttps://gitlab.eurecom.fr/oai/openairinterface5g/-/blob/develop/targets/ARCH/rfsimulator/README.md
(1)查看基站和UE的可执行程序
cd xxx/oai/openairinterface5g/cmake_targets/ran_build/build
nr-softmodem =》 5G基站可执行程序
nr-uesoftmodem =》 5G UE可执行程序
(1)执行命令:
sudo RFSIMULATOR=server ./nr-softmodem -O ../../../targets/PROJECTS/GENERIC-LTE-EPC/CONF/gnb.band78.tm1.106PRB.usrpn300.conf --parallel-config PARALLEL_SINGLE_THREAD --rfsim --phy-test --noS1 --nokrnmod 1 -d
(2)说明:
(3)检查启动情况
等待UE RFSIMULATOR的TCP连接
(1)周期性的发送随机的下行数据
(2)接收上行数据并处理
(1)执行命令:
sudo RFSIMULATOR=127.0.0.1 ./nr-uesoftmodem --rfsim --phy-test --rrc_config_path . --noS1 --nokrnmod 1 -d
(2)说明:
(3)查看执行结果:
(1) 与基站 RFSIMULATOR建立TCP连接
(2)周期性的发送随机的上行数据
(3)接收基站的下行数据并处理
备注:
注意:只有在有核心网的情况下,方可去掉--phy-test选项。
(1)测试Linux支持DNS解析
ping -I oaitun_enb1 10.0.1.2 (from the shell at gNB mchine)
ping -I oaitun_ue1 10.0.1.1 (from the shell at nrUE mchine)
(2)测试Linux不支持DNS解析
ping -I 10.0.1.1 10.0.1.2 (from the shell at gNB mchine)
ping -I 10.0.1.2 10.0.1.1 (from the shell at nrUE mchine)
(3)测试结果
注意:Iperf 必须确保基站和UE软件运行在不同的Linux服务器上或不同的虚拟机中。
否则,IP数据包不会通过oaitun_enb1和oaitun_ue1这两个物理接口的驱动,直接被IP层间直接路由,从而导致数据包不会经过空口协议栈。
(1)常见的Iperf 选项
-f [k|m|K|M] 分别表示以Kbits, Mbits, KBytes, MBytes显示报告,默认以Mbits为单位,eg:iperf -c 222.35.11.23 -f K -i sec 以秒为单位显示报告间隔,eg:iperf -c 222.35.11.23 -i 2 -l 缓冲区大小,默认是8KB,eg:iperf -c 222.35.11.23 -l 16 -m 显示tcp最大mtu值 -o 将报告和错误信息输出到文件eg:iperf -c 222.35.11.23 -o c:\iperflog.txt -p 指定服务器端使用的端口或客户端所连接的端口eg:iperf -s -p 9999;iperf -c 222.35.11.23 -p 9999 -u 使用udp协议 -w 指定TCP窗口大小,默认是8KB -B 绑定一个主机地址或接口(当主机有多个地址或接口时使用该参数) -C 兼容旧版本(当server端和client端版本不一样时使用) -M 设定TCP数据包的最大mtu值 -N 设定TCP不延时 -V 传输ipv6数据包 server专用参数 -D 以服务方式运行ipserf,eg:iperf -s -D -R 停止iperf服务,针对-D,eg:iperf -s -R client端专用参数 -d 同时进行双向传输测试 -n 指定传输的字节数,eg:iperf -c 222.35.11.23 -n 100000 -r 单独进行双向传输测试 -t 测试时间,默认10秒,eg:iperf -c 222.35.11.23 -t 5 -F 指定需要传输的文件 -T 指定ttl值
(2)UE:作为UDP server
Server nrUE machine: iperf -s -i 1 -u -B 10.0.1.2
在本测试中,client端的数据速率为:100K, 也可以设定其他速率,如1M, 10M, 100M等。
(3)基站:作为UDP Client
Client gNB machine: iperf -c 10.0.1.2 -u -b 0.1M --bind 10.0.1.1
TCP测试与UDP类似。去掉-u选项,Iperf 默认采用tcp连接。
Server nrUE machine: iperf -s -i 1 -B 10.0.1.2
Client gNB machine: iperf -c 10.0.1.2 -b 0.1M --bind 10.0.1.1
iperf -h
Usage: iperf [-s|-c host] [options]
iperf [-h|--help] [-v|--version]
Client/Server:
-b, --bandwidth #[kmgKMG | pps] bandwidth to send at in bits/sec or packets per second
-e, --enhancedreports use enhanced reporting giving more tcp/udp and traffic information
-f, --format [kmgKMG] format to report: Kbits, Mbits, KBytes, MBytes
-i, --interval # seconds between periodic bandwidth reports
-l, --len #[kmKM] length of buffer in bytes to read or write (Defaults: TCP=128K, v4 UDP=1470, v6 UDP=1450)
-m, --print_mss print TCP maximum segment size (MTU - TCP/IP header)
-o, --output
-p, --port # server port to listen on/connect to
-u, --udp use UDP rather than TCP
--udp-counters-64bit use 64 bit sequence numbers with UDP
-w, --window #[KM] TCP window size (socket buffer size)
-z, --realtime request realtime scheduler
-B, --bind
-C, --compatibility for use with older versions does not sent extra msgs
-M, --mss # set TCP maximum segment size (MTU - 40 bytes)
-N, --nodelay set TCP no delay, disabling Nagle's Algorithm
-S, --tos # set the socket's IP_TOS (byte) field
Server specific:
-s, --server run in server mode
-t, --time # time in seconds to listen for new connections as well as to receive traffic (default not set)
-U, --single_udp run in single threaded UDP mode
-D, --daemon run the server as a daemon
-V, --ipv6_domain Enable IPv6 reception by setting the domain and socket to AF_INET6 (Can receive on both IPv4 and IPv6)
Client specific:
-c, --client
-d, --dualtest Do a bidirectional test simultaneously
-n, --num #[kmgKMG] number of bytes to transmit (instead of -t)
-r, --tradeoff Do a bidirectional test individually
-t, --time # time in seconds to transmit for (default 10 secs)
-B, --bind [
-F, --fileinput
-I, --stdin input the data to be transmitted from stdin
-L, --listenport # port to receive bidirectional tests back on
-P, --parallel # number of parallel client threads to run
-R, --reverse reverse the test (client receives, server sends)
-T, --ttl # time-to-live, for multicast (default 1)
-V, --ipv6_domain Set the domain to IPv6 (send packets over IPv6)
-X, --peer-detect perform server version detection and version exchange
-Z, --linux-congestion
Miscellaneous:
-x, --reportexclude [CDMSV] exclude C(connection) D(data) M(multicast) S(settings) V(server) reports
-y, --reportstyle C report as a Comma-Separated Values
-h, --help print this message and quit
-v, --version print version information and quit
[kmgKMG] Indicates options that support a k,m,g,K,M or G suffix
Lowercase format characters are 10^3 based and uppercase are 2^n based
(e.g. 1k = 1000, 1K = 1024, 1m = 1,000,000 and 1M = 1,048,576)
The TCP window size option can be set by the environment variable
TCP_WINDOW_SIZE. Most other options can be set by an environment variable
IPERF_
作者主页(文火冰糖的硅基工坊):文火冰糖(王文兵)的博客_文火冰糖的硅基工坊_CSDN博客
本文网址:https://blog.csdn.net/HiWangWenBing/article/details/120680728