目录

​第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章 概述与软件测试架构

1.1 信息来源

(1)OAI主页​oai / openairinterface5G · GitLabOpenairinterface 5G Wireless Implementation[OpenAirInterface实战-9] :OAI代码的运行与常规测试(ping、Iperf)之RF Simulator_5ghttps://gitlab.eurecom.fr/oai/openairinterface5g​(2)How to run OAI主页

​doc/RUNMODEM.md · develop · oai / openairinterface5G · GitLabOpenairinterface 5G Wireless Implementation[OpenAirInterface实战-9] :OAI代码的运行与常规测试(ping、Iperf)之RF Simulator_5ghttps://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 · GitLab[OpenAirInterface实战-9] :OAI代码的运行与常规测试(ping、Iperf)之RF Simulator_RF仿真_03https://gitlab.eurecom.fr/oai/openairinterface5g/-/blob/develop/targets/ARCH/rfsimulator/README.md​

1.2 目标程序测试环境架构: RF Simulator

RF Simulator测试是指,在没有真实的RF板的情况下,使用RF Simulator替代真实的RF板子,进进行OAI功能性测试。当然,性能可能要比有真实的RF板时差很多。

RF Simulator的情况下,数据的来源有两种模式

(1)"noS1" mode:在这种模式下,通过UE侧和核心网侧的ping和iperf工具,把基站和UE之间的传输通道,在两侧进行数据传输数据。

(2)"phy-test" mode:在这种模式下,在每个MAC层调度周期内,基站随机的发送一些DL下行数据,而手机随机地发送一些UL上行数据。

1.3 测试系统架构

[OpenAirInterface实战-9] :OAI代码的运行与常规测试(ping、Iperf)之RF Simulator_数据_04 说明:

(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接口:

[OpenAirInterface实战-9] :OAI代码的运行与常规测试(ping、Iperf)之RF Simulator_测试_05

(3)基站或UE的RF,可以通过三种方式收发数据包:

  • 真实的空口
  • 同一个服务器间的TCP网络通信127.0.0.0,其中基站是TCP server,端口号为4043
  • 不同服务器的TCP网络通信, IP地址是基站所在服务的IP地址,其中基站是TCP server,端口号为4043。

通过netstat -tulnp 查看端口状态:

[OpenAirInterface实战-9] :OAI代码的运行与常规测试(ping、Iperf)之RF Simulator_数据_06

第2章 目标代码的编译

2.1 Build LTE UE and eNB without RF Simulator (仅供对比)

cd <your oai installation directory>/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设备。

2.2 build NR UE and gNB witout RF Simulator:-w SIMU(4G测试)

cd <your oai installation directory>/openairinterface5g/
source oaienv
cd cmake_targets/
./build_oai --UE --eNB

2.3 build NR UE and gNB with RF Simulator :-w SIMU(5G测试)

cd <your oai installation directory>/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

2.4 单独编译RF Simulator 

(1)方法1:./build_oai --phy_simulators

cd <your oai installation directory>/openairinterface5g/
source oaienv
cd cmake_targets/
./build_oai --phy_simulators

(2)方法2:make rfsimulator

cd <your oai installation directory>/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

第3章 目标代码的运行

3.1 参考描述

 ​

3.2 启动前检查:

(1)查看基站和UE的可执行程序

cd  xxx/oai/openairinterface5g/cmake_targets/ran_build/build

nr-softmodem     =》 5G基站可执行程序

nr-uesoftmodem =》 5G UE可执行程序

3.3 启动基站

(1)执行命令:

sudo RFSIMULATOR=server ./nr-softmodem -O ../../../targets/PROJECTS/GENERIC-LTE-EPC/CONF/gnb.band78.tm1.106PRB.usrpn300.conf --parallel-config -d PARALLEL_SINGLE_THREAD --rfsim --phy-test --noS1 --nokrnmod 1

(2)说明:

  • RFSIMULATOR=server:设定基站的RFSIMULATOR为TCP server
  • ./nr-softmodem:NR 基站可执行程序
  • -O ../../../targets/PROJECTS/GENERIC-LTE-EPC/CONF/gnb.band78.tm1.106PRB.usrpn300.conf :基站配置文件
  • --parallel-config PARALLEL_SINGLE_THREAD:创建独立的并行线程
  • --rfsim:采用RFSIMULATOR,而不是正式的RF硬件
  • --phy-test:启动基站的phy test功能,这种功能,每一次调度周期,基站会随机产生一些DL下行数据进行发送。
  • -noS1:没有真实的核心网,采用核心网模拟器。
  • --nokrnmod 1:没有核心网是设置该flag
  • -d:图形显示星座图或其他结果 (Window端需要使用MobaXterm这样的远程终端)

(3)检查启动情况

[OpenAirInterface实战-9] :OAI代码的运行与常规测试(ping、Iperf)之RF Simulator_测试_07

 等待UE RFSIMULATOR的TCP连接

(1)周期性的发送随机的下行数据

(2)接收上行数据并处理

3.4 启动UE

(1)执行命令:

sudo RFSIMULATOR=127.0.0.1 ./nr-uesoftmodem --rfsim --phy-test --rrc_config_path . --noS1 --nokrnmod 1 -d

(2)说明:

  • RFSIMULATOR=127.0.0.1:设定基站RFSIMULATOR的IP地址,如果在同一个Linux服务器上,可以使用127.0.0.1。
  • ./nr-uesoftmodem:NR UE可执行程序
  • -O ../../../targets/PROJECTS/GENERIC-LTE-EPC/CONF/gnb.band78.tm1.106PRB.usrpn300.conf :基站配置文件
  • --parallel-config PARALLEL_SINGLE_THREAD:创建独立的并行线程
  • --rfsim:采用RFSIMULATOR,而不是正式的RF硬件
  • --phy-test:启动UE的phy test功能,这种功能,每一次调度周期,UE会随机产生一些UL上行数据进行发送。
  • -noS1:没有真实的核心网,采用核心网模拟器。
  • --nokrnmod 1:没有核心网是设置该flag
  • -d:图形显示星座图或其他结果 (Window端需要使用MobaXterm这样的远程终端)

(3)查看执行结果:

[OpenAirInterface实战-9] :OAI代码的运行与常规测试(ping、Iperf)之RF Simulator_OAI_08

(1) 与基站 RFSIMULATOR建立TCP连接

(2)周期性的发送随机的上行数据

(3)接收基站的下行数据并处理

第4章 目标代码的测试

4.1 查看PHY层自动产生的随机数据

4.2 Ping测试

注意:为了避免干扰,在启动UE和基站时,可以去掉--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)测试结果

  • ping包收到相应数据 

[OpenAirInterface实战-9] :OAI代码的运行与常规测试(ping、Iperf)之RF Simulator_测试_09

4.3 Iperf UDP测试

注意: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

  • -s:server端
  • -i:interval,时间间隔为1s。
  • -u:发送udp包
  • -B:  绑定一个主机接口,UE为10.0.1.2

[OpenAirInterface实战-9] :OAI代码的运行与常规测试(ping、Iperf)之RF Simulator_OAI_10

在本测试中,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

  • -c:连接远端服务器:10.0.1.2
  • -u:发送udp包
  • -b:发送带宽=100K
  • --bind :绑定一个主机接口,基站为10.0.1.1

[OpenAirInterface实战-9] :OAI代码的运行与常规测试(ping、Iperf)之RF Simulator_OAI_11

4.4 Iperf TCP测试

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

第5章附录

5.1 iperf参数详细说明

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    <filename> output the report or error message to this specified file

  -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      <host>   bind to <host>, an interface or multicast address

  -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    <host>   run in client mode, connecting to <host>

  -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 [<ip> | <ip:port>] bind src addr(s) from which to originate traffic

  -F, --fileinput <name>   input the data to be transmitted from a file

  -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 <algo>  set TCP congestion control algorithm (Linux only)

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_<long option name>, such as IPERF_BANDWIDTH.



作者主页(​​文火冰糖的硅基工坊​​)