官网
目录
1. 容器控制台(CLI)的使用
nr-cli用法:
nr-cli更多用法
1.1 gNB控制台
进入容器通过交互式shell执行命令
需要查看更多命令,请输入commands
进一步调查子命令的用法和帮助信息
1.2 UE控制台
2. 常用交互式命令
2.1 用户释放
gNB shell
UE Shell命令
2.2 tunX接口使用
ping命令
nr-binder命令
官网给出的大多为基于UERANSIM软件的操作方式,并未拓展太多基于容器化的UERANSIM操作方式,该教程旨在探索容器化UERANSIM的操作方式。
我们为 gNB 和 UE 提供工具。nr-cli
注意:UE 和 gNB 具有不同的 CLI 命令。例如,在 gNB 中,您可以检查 AMF 连接状态,或者在 UE 中可以触发取消注册。本文件对更多细节作了解释。
如何获得UE和gNB的名称?
docker-compose# docker exec -it ./nr-cli --dump
由此可以获得UERANSIM的名称UERANSIM-gnb-208-95-1和UE的imsi,接下来就可以进一步使用CLI控制台
docker-compose$ docker exec -it ueransim ./nr-cli --help
WARNING: Error loading config file: /home/lab/.docker/config.json: open /home/lab/.docker/config.json: permission denied
UERANSIM v3.2.5 | Command Line Interface | Copyright (c) 2023 ALİ GÜNGÖR
Usage:
nr-cli [option...]
nr-cli --dump
Options:
-d, --dump List all UE and gNBs in the environment
-e, --exec Execute the given command directly without an interactive shell
-h, --help Show this help message and exit
-v, --version Show version information and exit
ocker-compose# docker exec -it ueransim ./nr-cli UERANSIM-gnb-208-95-1
--------------------------------------------------------------------------------------------
$ commands
info | Show some information about the gNB
status | Show some status information about the gNB
amf-list | List all AMFs associated with the gNB
amf-info | Show some status information about the given AMF
ue-list | List all UEs associated with the gNB
ue-count | Print the total number of UEs connected the this gNB
ue-release | Request a UE context release for the given UE
------------------------------------------------------------------------------------------
docker-compose# docker exec -it ./nr-cli UERANSIM-gnb-208-95-1
--------------------------------------------------------------------------------------------
$
$ amf-info --help
$ ue-list --version
$ docker exec -it ueransim ./nr-cli imsi-208950000000130
--------------------------------------------------------------------------------------------
$ commands
info | Show some information about the UE
status | Show some status information about the UE
timers | Dump current status of the timers in the UE
rls-state | Show status information about RLS
coverage | Dump available cells and PLMNs in the coverage
ps-establish | Trigger a PDU session establishment procedure
ps-list | List all PDU sessions
ps-release | Trigger a PDU session release procedure
ps-release-all | Trigger PDU session release procedures for all active sessions
deregister | Perform a de-registration by the UE
--------------------------------------------------------------------------------------------
控制台,可以进一步调查子命令的用法和帮助信息(传送门)
下面来介绍一些基站常用交互式shell命令
通过交互式shell在基站侧释放用户连接,从连接态(CONNECTED)转向空闲态(IDLE)
docker-compose# docker exec -it ueransim ./nr-cli UERANSIM-gnb-208-95-1
--------------------------------------------------------------------------------------------
$ commands
info | Show some information about the gNB
status | Show some status information about the gNB
amf-list | List all AMFs associated with the gNB
amf-info | Show some status information about the given AMF
ue-list | List all UEs associated with the gNB
ue-count | Print the total number of UEs connected the this gNB
ue-release | Request a UE context release for the given UE
----------------------------------------------------------------------------------------------
$ ue-list
- ue-id: 1
ran-ngap-id: 1
amf-ngap-id: 1
--------------------------------------------------------------------------------------------
$ amf-list
- id: 2
--------------------------------------------------------------------------------------------
$ status
is-ngap-up: true
--------------------------------------------------------------------------------------------
$ ue-count
1
--------------------------------------------------------------------------------------------
$ ue-release --help
Request a UE context release for the given UE
Usage:
ue-release
--------------------------------------------------------------------------------------------
--------------------------------------------------------------------------------------------
$ ue-release 1
Requesting UE context release
--------------------------------------------------------------------------------------------
$ ue-list
--------------------------------------------------------------------------------------------
$ ue-count
0
--------------------------------------------------------------------------------------------
$ status
is-ngap-up: true
--------------------------------------------------------------------------------------------
$
通过交互式命令,我们原始连接的ue已经被释放,可以通过ueransim的日志验证这一点:
使用交互式命令来建立或注销PDU会话
查询用法:
--------------------------------------------------------------------------------------------
$ ps-establish
Trigger a PDU session establishment procedure
Usage:
ps-establish [options]
Examples:
ps-establish IPv4 --sst 1 --sd 1 --dnn internet
ps-establish IPv4 --emergency
Options:
--sst SST value of the PDU session
--sd SD value of the PDU session
-n, --dnn DNN/APN value of the PDU session
-e, --emergency Request as an emergency session
--------------------------------------------------------------------------------------------
PDU会话列表:
--------------------------------------------------------------------------------------------
$ ps-list
PDU Session1:
state: PS-ACTIVE
session-type: IPv4
apn: default
s-nssai:
sst: 0xde
sd: 0x00007b
emergency: false
address: 12.1.1.5
ambr: up[50Mb/s] down[100Mb/s]
data-pending: false
--------------------------------------------------------------------------------------------
新的PDU会话建立:
--------------------------------------------------------------------------------------------
$ ps-establish IPV4 -n default
PDU session establishment procedure triggered
--------------------------------------------------------------------------------------------
查询
我们可以查询uaransim的日志来查看PUD会话建立情况
ping验证:
值得注意的是,虽然一个UE能够创建多个tunX接口,但是对于核心网而言还是只有一个用户接入,只是该用户有了不同的业务接口而已,可以通过基站shell查询:
值得注意的是:
UERANSIM提供了一个TUN接口,以便使用UE的互联网连接。在版本 v2.2.1 中,将自动应用所有 TUN 配置。UERANSIM为每个 PDU 会话设置一个 TUN 接口。成功建立PDU会话后,UE会自动执行以下操作:
注意:路由配置可能与您的当前设置冲突。如果不需要自动路由配置(第 2 项),可以只使用启动 UE(nr-ue --no-route-config)。但是,TUN 接口始终在 PDU 会话建立后创建(第 1 项)。
注意:在同一台计算机上使用 UE 和核心网络通常会导致问题。请使用 2 台不同的机器进行 UERANSIM 和核心网络。(可以使用虚拟机或非虚拟机)
docker-compose# docker exec -it ueransim0 ping -I uesimtun0
图中的202.108.22.5为百度的ip
使用 docker stats命令查看各容器资源的使用情况
详见另外一篇文章