Files
ueransim/CLI_HANDOVER_SOLUTION.md
2025-09-11 06:16:32 +00:00

131 lines
3.0 KiB
Markdown
Vendored
Raw Permalink Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
# UERANSIM CLI Handover 解决方案
## 问题解决
**错误**: `ERROR: No node found with name: 127.0.0.1`
**原因**: UERANSIM CLI 不使用IP地址连接而是使用节点名称。
## 正确的CLI使用方法
### 1. 查看所有可用节点
```bash
cd /home/uenr-3.2.7/ueransim
./build/nr-cli --dump
```
输出示例:
```
UERANSIM-gnb-286-1-1
imsi-286010000000001
imsi-286010000000002
imsi-286010000000003
imsi-286010000000004
imsi-286010000000005
```
### 2. 连接到gNB节点
```bash
# 错误的方法 (不要使用IP地址)
./build/nr-cli 127.0.0.1 -e help # ❌ 这会失败
# 正确的方法 (使用节点名称)
./build/nr-cli UERANSIM-gnb-286-1-1 -e commands # ✅ 正确
```
### 3. 查看可用命令
```bash
./build/nr-cli UERANSIM-gnb-286-1-1 -e 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
handover | Trigger handover for a UE to target gNB
```
### 4. 使用Handover命令
#### 查看handover语法
```bash
./build/nr-cli UERANSIM-gnb-286-1-1 -e "handover"
```
输出:
```
Trigger handover for a UE to target gNB
Usage:
handover <ue-id> <target-gnb-id>
```
#### 实际触发handover
```bash
# 语法: handover <UE-ID> <目标gNB-ID>
./build/nr-cli UERANSIM-gnb-286-1-1 -e "handover 1 2"
```
## 完整的测试流程
### 步骤1: 启动环境
确保gNB和UE都在运行
```bash
# 终端1: 启动gNB
./build/nr-gnb -c config/custom-gnb.yaml
# 终端2: 启动UE
./build/nr-ue -c config/custom-ue.yaml
```
### 步骤2: 检查连接状态
```bash
# 查看gNB信息
./build/nr-cli UERANSIM-gnb-286-1-1 -e "info"
# 查看连接的UE数量
./build/nr-cli UERANSIM-gnb-286-1-1 -e "ue-count"
# 列出连接的UE
./build/nr-cli UERANSIM-gnb-286-1-1 -e "ue-list"
```
### 步骤3: 触发Handover
```bash
# 格式: handover <ue-id> <target-gnb-id>
./build/nr-cli UERANSIM-gnb-286-1-1 -e "handover 1 2"
```
## 重要说明
1. **节点发现机制**: UERANSIM使用进程表 `/tmp/UERANSIM.proc-table/` 来发现节点不直接使用IP地址
2. **节点名称**: 必须使用确切的节点名称,如 `UERANSIM-gnb-286-1-1`
3. **UE状态**: UE必须处于已注册并连接到gNB的状态才能执行handover
4. **目标gNB**: 需要有另一个运行的gNB作为handover目标
## 常用命令参考
```bash
# 列出所有节点
./build/nr-cli --dump
# 连接到gNB查看命令
./build/nr-cli UERANSIM-gnb-286-1-1 -e commands
# 查看gNB信息
./build/nr-cli UERANSIM-gnb-286-1-1 -e info
# 查看UE列表
./build/nr-cli UERANSIM-gnb-286-1-1 -e ue-list
# 触发handover
./build/nr-cli UERANSIM-gnb-286-1-1 -e "handover <ue-id> <target-gnb-id>"
# 查看UE状态
./build/nr-cli imsi-286010000000001 -e status
```