目录
注意:如果读者有兴趣部署有更多日志的调试器/开发人员核心网络环境,请参考本教程
在这个演示中,下面列出了使用的图像标记和提交,按照构建图像使用下面的标记构建镜像。
您还可以从docker-hub检索映像。参见检索镜像
在本教程中,我们将探索OAI 5G核心网的切片功能。这里我们验证-
- 基于S-NSSAI的UPF选择
- 基于S-NSSAI的SMF选择
- 基于S-NSSAI的NRF选择(借助NSSF)
- 基于S-NSSAI的AMF选择(借助NSSF -下一版,2022年3月)
- 单个终端与多个S-NSSAI(借助商业工具dsTest)
网络切片是在PLMN中定义的,它包含5GC和5G RAN组件。网络片被标识为单个网络片选择辅助信息(Single Network Slice Selection Assistance Information,S-NSSAI)。S-NSSAI由切片/服务类型(Slice/Service type,SST)和切片区分器(Slice Differentiator,SD)组成。SST是一个强制字段,它根据特性和服务定义预期的切片行为。而SD是一个可选字段,可用于区分多个切片。
目前3GPP允许在终端和网络之间发送的信令消息中的NSSAI中最多有8个S-NSSAI,这意味着单个终端同时最多可以被8个网络切片服务。SST长度为8位;因此它可以提供2^8= 256个SST值,其中有预留值0到127用于标准化SST(例如SST 2 = URLCC, SST 3 = MIoT, SST 4 = V2X等)。
OAI 5G CN切片当前状态
- NSSF(The Network Slice Selection Function,网络切片选择功能)的作用-> NSSF目前支持在pdu会话建立请求时进行切片选择。当AMF没有在本地配置NRF信息时,在NSSF的帮助下,它会根据提供的S-NSSAI发现适当的NRF。
- AMF的作用-> AMF从适当的NRF提供的SMF实列列表中选择第一个可用的SMF。
- SMF -> SMF可以同时关联多个upf,就像上图中的切片2和切片3一样。这里基于S-NSSAI和DNN选择UPF。
如上图所示,配置了3个S-NSSAIs(可以用颜色区分)。
注意:这里我们使用了标准化的SST值(2,3,4),因为rf模拟器只支持SST值1,2,3,4。此外,它仅供数值参考,并不能反映标准的SST行为,例如URLCC, MIoT, V2X等。
- Slice1: [SST=128,SD=128] => NRF1, SMF1, UPF1, GNB1, UE1
- Slice2: [SST=1] => NRF1, SMF2, UPF2, GNB2, UE2
- Slice3: [SST=130,SD=130] => NRF2, SMF3, VPP-UPF3, GNB3, UE3
这里AMF, NSSF, UDM, UDR, AUSF对所有切片都是通用的。切片1和切片2中的SMF和UPF具有相同的NRF,因此两个UPF都可以被两个SMF发现。您可以在日志中验证两个smf是否成功关联到片2和片3中的两个upf。在这里,在单个(NSI) NRF下注册的smf / upf数量是运营商网络规划的一部分。
我们开始吧!!
步骤1到4类似于之前的教程,如极简或基本部署。请按照以下步骤部署OAI 5G核心网组件。
1. 必须要求
创建一个文件夹,您可以在其中存储本教程的所有结果文件,然后将它们与我们提供的结果文件进行比较,我们建议创建完全相同的文件夹,以免随后破坏命令流。
docker-compose-host $: mkdir -p /tmp/oai/slicing-with-nssf
docker-compose-host $: chmod 777 /tmp/oai/slicing-with-nssf
5. 部署5GC
- 我们部署了附加组件oai-nssf的基本版5g核心。我们将使用docker-compose来部署5g核心,如下所示。再说一次,如果这是第一次,或者你计划进行很长一段时间的实验:不设置捕获
docker-compose-host $: docker-compose -f docker-compose-slicing-basic-nrf.yaml up -d
出于CI目的,我们将捕获数据包,并且不会长时间运行它,因此PCAP文件不会太大。
docker-compose-host $: docker-compose -f docker-compose-slicing-basic-nrf.yaml up -d mysql
Creating network "demo-oai-public-net" with driver "bridge"
Creating network "oai-public-access" with the default driver
Creating network "oai-public-core" with the default driver
Creating mysql ... done
我们用一个复杂的过滤器来捕获docker网络上的数据包——>小PCAP文件。
docker-compose-host $: nohup sudo tshark -i demo-oai -f '(not host 192.168.70.145 and not host 192.168.70.154) or (host 192.168.70.145 and icmp)' -w /tmp/oai/slicing-with-nssf/slicing-with-nssf.pcap > /tmp/oai/slicing-with-nssf/slicing-with-nssf.log 2>&1 &
启动成功结果:
docker-compose-host $: docker-compose -f docker-compose-slicing-basic-nrf.yaml up -d
mysql is up-to-date
Creating oai-nrf-slice12 ... done
Creating oai-nssf ... done
Creating oai-ext-dn ... done
Creating oai-nrf-slice3 ... done
Creating oai-spgwu-slice2 ... done
Creating oai-udr ... done
Creating vpp-upf-slice3 ... done
Creating oai-udm ... done
Creating oai-ausf ... done
Creating oai-amf ... done
Creating oai-smf-slice3 ... done
Creating oai-smf-slice1 ... done
Creating oai-smf-slice2 ... done
Creating oai-spgwu-slice1 ... done
docker-compose-host $: sudo chmod 666 /tmp/oai/slicing-with-nssf/slicing-with-nssf.*
输入如下指令检查容器健康状态
docker-compose-host $: docker-compose -f docker-compose-slicing-basic-nrf.yaml ps -a
Name Command State Ports
-----------------------------------------------------------------------------------------------
mysql docker-entrypoint.sh mysqld Up (healthy) 3306/tcp, 33060/tcp
oai-amf /bin/bash /openair-amf/bin ... Up (healthy) 38412/sctp, 80/tcp, 9090/tcp
oai-ausf /bin/bash /openair-ausf/bi ... Up (healthy) 80/tcp
oai-ext-dn /bin/bash -c apt update; ... Up (healthy)
oai-nrf-slice12 /bin/bash /openair-nrf/bin ... Up (healthy) 80/tcp, 9090/tcp
oai-nrf-slice3 /bin/bash /openair-nrf/bin ... Up (healthy) 80/tcp, 9090/tcp
oai-nssf /bin/bash /openair-nssf/bi ... Up (healthy) 80/tcp, 8080/tcp
oai-smf-slice1 /bin/bash /openair-smf/bin ... Up (healthy) 80/tcp, 8805/udp, 9090/tcp
oai-smf-slice2 /bin/bash /openair-smf/bin ... Up (healthy) 80/tcp, 8805/udp, 9090/tcp
oai-smf-slice3 /bin/bash /openair-smf/bin ... Up (healthy) 80/tcp, 8805/udp, 9090/tcp
oai-spgwu-slice1 /openair-spgwu-tiny/bin/en ... Up (healthy) 2152/udp, 8805/udp
oai-spgwu-slice2 /openair-spgwu-tiny/bin/en ... Up (healthy) 2152/udp, 8805/udp
oai-udm /bin/bash /openair-udm/bin ... Up (healthy) 80/tcp
oai-udr /bin/bash /openair-udr/bin ... Up (healthy) 80/tcp
vpp-upf-slice3 /openair-upf/bin/entrypoin ... Up (healthy) 2152/udp, 8085/udp
6. 拉取仿真基站镜像
我们使用3个不同的ran模拟器:ueransim、rfsimulator和gnbsim分别用于片2、片3和片4。它们每个都有自己的一组特性,可以根据需要使用。不同的运行模拟器的使用在这里模拟了真实的部署场景,其中运营商可以在网络中部署多个供应商设备。
$ docker pull rohankharade/gnbsim:latest
$ docker pull rohankharade/ueransim:latest
$ docker pull oaisoftwarealliance/oai-gnb:develop
$ docker pull oaisoftwarealliance/oai-nr-ue:develop
并重新标记它们,以便教程的docker-compose文件工作。
$ docker image tag rohankharade/gnbsim:latest gnbsim:latest
$ docker image tag rohankharade/ueransim:latest ueransim:latest
7. 运行仿真基站容器
部署过程参考docs/DEPLOY_SA5G_SLICING.md · master · oai / cn5g / oai-cn5g-fed · GitLab (eurecom.fr)
实际结果
注意:可能会有一个或多个仿真基站的容器显示不健康,我们只需要重新运行其对应的启动脚本,等待几分钟再查看健康状态即可显示正常。
成功部署后,我们可以在 AMF 验证所有 gnb 和 UE 是否已成功注册到网络:
输入
docker-compose-host $: docker logs oai-amf
8. 数据流测试
本节将进行oai-ext-dn节点与终端UE之间的流量测试
首先可以查看容器日志
docker-compose-host $: docker logs gnbsim 2>&1 | tail -10
docker-compose-host $: docker logs oai-amf 2>&1 | tail -20
# tail10:查询最后10条日志
然后利用外部DN来ping仿真基站
docker-compose-host $: docker exec oai-ext-dn ping -c 4 12.1.1.2
PING 12.1.1.2 (12.1.1.2) 56(84) bytes of data.
64 bytes from 12.1.1.2: icmp_seq=2 ttl=63 time=0.346 ms
64 bytes from 12.1.1.2: icmp_seq=3 ttl=63 time=0.286 ms
64 bytes from 12.1.1.2: icmp_seq=4 ttl=63 time=0.267 ms
--- 12.1.1.2 ping statistics ---
4 packets transmitted, 3 received, 25% packet loss, time 3059ms
rtt min/avg/max/mdev = 0.267/0.299/0.346/0.039 ms
docker-compose-host $: docker exec oai-ext-dn ping -c 4 12.2.1.2
PING 12.2.1.2 (12.2.1.2) 56(84) bytes of data.
64 bytes from 12.2.1.2: icmp_seq=1 ttl=63 time=1.00 ms
64 bytes from 12.2.1.2: icmp_seq=2 ttl=63 time=0.644 ms
64 bytes from 12.2.1.2: icmp_seq=3 ttl=63 time=0.504 ms
64 bytes from 12.2.1.2: icmp_seq=4 ttl=63 time=0.390 ms
--- 12.2.1.2 ping statistics ---
4 packets transmitted, 4 received, 0% packet loss, time 3039ms
rtt min/avg/max/mdev = 0.390/0.635/1.004/0.232 ms
docker-compose-host $: docker exec oai-ext-dn ping -c 4 12.1.1.129
PING 12.1.1.129 (12.1.1.129) 56(84) bytes of data.
64 bytes from 12.1.1.129: icmp_seq=1 ttl=63 time=40.0 ms
64 bytes from 12.1.1.129: icmp_seq=2 ttl=63 time=39.5 ms
64 bytes from 12.1.1.129: icmp_seq=3 ttl=63 time=11.2 ms
64 bytes from 12.1.1.129: icmp_seq=4 ttl=63 time=11.2 ms
--- 12.1.1.129 ping statistics ---
4 packets transmitted, 4 received, 0% packet loss, time 3003ms
rtt min/avg/max/mdev = 11.206/25.511/40.071/14.292 ms
9. 日志输出
docker-compose-host $: docker logs oai-amf > /tmp/oai/slicing-with-nssf/amf.log 2>&1
docker-compose-host $: docker logs oai-ausf > /tmp/oai/slicing-with-nssf/ausf.log 2>&1
docker-compose-host $: docker logs oai-nssf > /tmp/oai/slicing-with-nssf/nssf.log 2>&1
docker-compose-host $: docker logs oai-udm > /tmp/oai/slicing-with-nssf/udm.log 2>&1
docker-compose-host $: docker logs oai-udr > /tmp/oai/slicing-with-nssf/udr.log 2>&1
docker-compose-host $: docker logs oai-nrf-slice12 > /tmp/oai/slicing-with-nssf/nrf-slice12.log 2>&1
docker-compose-host $: docker logs oai-nrf-slice3 > /tmp/oai/slicing-with-nssf/nrf-slice3.log 2>&1
docker-compose-host $: docker logs oai-smf-slice1 > /tmp/oai/slicing-with-nssf/smf-slice1.log 2>&1
docker-compose-host $: docker logs oai-smf-slice2 > /tmp/oai/slicing-with-nssf/smf-slice2.log 2>&1
docker-compose-host $: docker logs oai-smf-slice3 > /tmp/oai/slicing-with-nssf/smf-slice3.log 2>&1
docker-compose-host $: docker logs oai-spgwu-slice1 > /tmp/oai/slicing-with-nssf/spgwu-slice1.log 2>&1
docker-compose-host $: docker logs oai-spgwu-slice2 > /tmp/oai/slicing-with-nssf/spgwu-slice2.log 2>&1
docker-compose-host $: docker logs vpp-upf-slice3 > /tmp/oai/slicing-with-nssf/vpp-upf-slice3.log 2>&1
docker-compose-host $: docker logs gnbsim > /tmp/oai/slicing-with-nssf/gnbsim.log 2>&1
docker-compose-host $: docker logs rfsim5g-oai-gnb > /tmp/oai/slicing-with-nssf/rfsim5g-oai-gnb.log 2>&1
docker-compose-host $: docker logs rfsim5g-oai-nr-ue1 > /tmp/oai/slicing-with-nssf/rfsim5g-oai-nr-ue1.log 2>&1
docker-compose-host $: docker logs ueransim > /tmp/oai/slicing-with-nssf/ueransim.log 2>&1
10. UE与多个S-NSSAIs
OAI 5G CN还支持多片终端。显然,我们已经验证的ran模拟器不支持同时具有多个切片的UE。因此,我们使用商业测试工具dsTest验证了该特性。这个测试用例集成在NSSF和AMF的CI管道中。该管道触发如下图所示的部署场景,其中包含两个部分。在PDU会话建立请求中,AMF使用合适的NRF Id向NSSF查询NSI信息。然后再次在nssi中选择相应的SMF和UPF,基于提供的S-NSSAI。您可以从pcap验证这个场景。
11. 取消部署
11.1 取消部署仿真基站
docker-compose-host $: docker-compose -f docker-compose-slicing-ransim.yaml down -t 0
Stopping ueransim ... done
Stopping rfsim5g-oai-nr-ue1 ... done
Stopping rfsim5g-oai-gnb ... done
Removing ueransim ... done
Removing gnbsim ... done
Removing rfsim5g-oai-nr-ue1 ... done
Removing rfsim5g-oai-gnb ... done
Network demo-oai-public-net is external, skipping
Network oai-public-access is external, skipping
11.2 取消部署5GC
docker-compose-host $: docker-compose -f docker-compose-slicing-basic-nrf.yaml down -t 0
Stopping oai-spgwu-slice1 ... done
Stopping oai-smf-slice3 ... done
Stopping oai-smf-slice1 ... done
Stopping oai-smf-slice2 ... done
Stopping oai-amf ... done
Stopping oai-ausf ... done
Stopping oai-udm ... done
Stopping oai-udr ... done
Stopping vpp-upf-slice3 ... done
Stopping oai-spgwu-slice2 ... done
Stopping oai-nrf-slice12 ... done
Stopping mysql ... done
Stopping oai-nssf ... done
Stopping oai-ext-dn ... done
Stopping oai-nrf-slice3 ... done
Removing oai-spgwu-slice1 ... done
Removing oai-smf-slice3 ... done
Removing oai-smf-slice1 ... done
Removing oai-smf-slice2 ... done
Removing oai-amf ... done
Removing oai-ausf ... done
Removing oai-udm ... done
Removing oai-udr ... done
Removing vpp-upf-slice3 ... done
Removing oai-spgwu-slice2 ... done
Removing oai-nrf-slice12 ... done
Removing mysql ... done
Removing oai-nssf ... done
Removing oai-ext-dn ... done
Removing oai-nrf-slice3 ... done
Removing network demo-oai-public-net
Removing network oai-public-access
Removing network oai-public-core