UPF 编译部署文档
虚机配置要求:
系统:ubunto 18.04
vcpu:4核(影响编译速度,可适当提升配置至8核)
内存:4G
Y硬盘:至少 20G
预置条件
获取代码
git clone http://gitlab.sh.99cloud.net/5GS/upf-astri.git
在裸机编译
安装依赖
sudo apt update
sudo apt install make
sudo make install-dep
# 检查是否安装 setuptools 包,如未安装,安装
pip install setuptools
打上 git tag
这一步是给 vpp 赋值版本号是 必须 按照 “v+数字的方式”形如 “V1.0”,在 vpp 编译阶段会解析该 tag,作为版本号
git tag -a v1.0 -m "test"
编译源码
make build-release
生成安装包
make pkg-deb
# 生成安装包目录在
~/upf-astri/build-root/
裸机编译后安装
安装编译s所有生成的 *.deb
cd upf-astri/build-root/
sudo dpkg -i *.deb
在容器内编译
可以提前准备好边缘容器的镜像,fastgate/ubuntu1804:upf,下载较慢可以在 172.18.22.66 上获取镜像 load 到编译机器中。
create container
cd upf-astri
./buildpack
a215761ad1f101536885d5554640f7428f2a8487b41222398e7d5010eb04cc07
root@a215761ad1f1:/opt#
打上 git tag
这一步是给 vpp 赋值版本号是 必须 按照 “v+数字的方式”形如 “V1.0”,在 vpp 编译阶段会解析该 tag,作为版本号
git tag -a v1.0 -m "test"
compile deb
mkdir -p build/external/downloads/
cp /downloads/*tar* build/external/downloads/
make pkg-deb
mkdir dep-deb
cp /dep-deb/*.deb dep-deb/
mv build-root/*.deb .
mv build/external/*.deb .
tar -czf upf_deb_debug.tgz Makefile *.deb dep-deb/
output: upf_deb_debug.tgz
Enter into docker and compile binary
make build
./install.sh local_debug
output: image.tgz
将两个压缩包拷贝出来
docker cp root_upf:/opt/upf_deb.tgz ./
docker cp root_upf:/opt/image.tgz ./
裸机编译后安装
将压缩包拷贝至安装机器或在编译容器所在机器的目录下解压
tar -zxvf upf_deb.tgz
tar -zxvf image.tgz
安装所有生成的 .deb
cd dep-deb & sudo dpkg -i *.deb
cd .. & sudo dpkg -i *.deb
配置和运行
安装完成后,在 /etc/vpp/ ,目录下有 相应的 参考配置文件,对应需要纳管的网卡 pci 修改配置文件
主要需要添加 两个配置文件
startup.conf
upf.conf
startup.conf 实例
# startup.conf 实例
heapsize 4G
unix {
#nodaemon
#interactive cli-listen /run/vpp/cli.sock
cli-listen /run/vpp/cli.sock
log /var/log/vpp/vpp.log
full-coredump
gid vpp
exec /etc/vpp/upf.conf
}
#ulimit -c unlimited
api-trace {
## This stanza controls binary API tracing. Unless there is a very strong reason,
## please leave this feature enabled.
on
## Additional parameters:
##
## To set the number of binary API trace records in the circular buffer, configure nitems
##
## nitems <nnn>
##
## To save the api message table decode tables, configure a filename. Results in /tmp/<filename>
## Very handy for understanding api message changes between versions, identifying missing
## plugins, and so forth.
##
## save-api-table <filename>
}
logging {
default-syslog-log-level info
unthrottle-time 1
}
api-segment {
gid vpp
}
statseg {
size 256m
}
socksvr {
default
}
cpu {
## In the VPP there is one main thread and optionally the user can create worker(s)
## The main thread and worker thread(s) can be pinned to CPU core(s) manually or automatically
## Manual pinning of thread(s) to CPU core(s)
## Set logical CPU core where main thread runs, if main core is not set
## VPP will use core 1 if available
# main-core 1
## Set logical CPU core(s) where worker threads are running
# corelist-workers 2-3,18-19
## Automatic pinning of thread(s) to CPU core(s)
## Sets number of CPU core(s) to be skipped (1 ... N-1)
## Skipped CPU core(s) are not used for pinning main thread and working thread(s).
## The main thread is automatically pinned to the first available CPU core and worker(s)
## are pinned to next free CPU core(s) after core assigned to main thread
#skip-cores 1
## Specify a number of workers to be created
## Workers are pinned to N consecutive CPU cores while skipping "skip-cores" CPU core(s)
## and main thread's CPU core
workers 2
## Specify a number of pfcp threads to be created
pfcp-threads 1
## Set scheduling policy and priority of main and worker threads
## Scheduling policy options are: other (SCHED_OTHER), batch (SCHED_BATCH)
## idle (SCHED_IDLE), fifo (SCHED_FIFO), rr (SCHED_RR)
# scheduler-policy fifo
## Scheduling priority is used only for "real-time policies (fifo and rr),
## and has to be in the range of priorities supported for a particular policy
# scheduler-priority 50
}
dpdk {
# dev default {
## Number of receive queues, enables RSS
## Default is 1
# num-rx-queues 3
## Number of transmit queues, Default is equal
## to number of worker threads or 1 if no workers treads
# num-tx-queues 3
## Number of descriptors in transmit and receive rings
## increasing or reducing number can impact performance
## Default is 1024 for both rx and tx
# num-rx-desc 512
# num-tx-desc 512
## VLAN strip offload mode for interface
## Default is off
# vlan-strip-offload on
# }
## Specify bonded interface and its slaves via PCI addresses
##
## Bonded interface in XOR load balance mode (mode 2) with L3 and L4 headers
# vdev eth_bond0,mode=2,slave=0000:02:00.0,slave=0000:03:00.0,xmit_policy=l34
# vdev eth_bond1,mode=2,slave=0000:02:00.1,slave=0000:03:00.1,xmit_policy=l34
##
## Bonded interface in Active-Back up mode (mode 1)
# vdev eth_bond0,mode=1,slave=0000:02:00.0,slave=0000:03:00.0
# vdev eth_bond1,mode=1,slave=0000:02:00.1,slave=0000:03:00.1
## Change UIO driver used by VPP, Options are: igb_uio, vfio-pci,
## uio_pci_generic or auto (default)
#uio-driver vfio-pci
## Disable mutli-segment buffers, improves performance but
## disables Jumbo MTU support
# no-multi-seg
## Increase number of buffers allocated, needed only in scenarios with
## large number of interfaces and worker threads. Value is per CPU socket.
## Default is 16384
# num-mbufs 128000
## Change hugepages allocation per-socket, needed only if there is need for
## larger number of mbufs. Default is 256M on each detected CPU socket
# socket-mem 2048,2048
## Disables UDP / TCP TX checksum offload. Typically needed for use
## faster vector PMDs (together with no-multi-seg)
# no-tx-checksum-offload
dev 0000:00:06.0 {
num-rx-queues 1
}
dev 0000:00:09.0 {
num-rx-queues 1
}
}
plugins {
plugin gtpu_plugin.so { disable }
}
## Alternate syntax to choose plugin path
# plugin_path /home/bms/vpp/build-root/install-vpp-native/vpp/lib64/vpp_plugins
需要注意:
系统配置项中:
unix {
#nodaemon
#interactive cli-listen /run/vpp/cli.sock
cli-listen /run/vpp/cli.sock
log /var/log/vpp/vpp.log
full-coredump
gid vpp
exec /etc/vpp/upf.conf
}
nodaemon:指的是 不在后台运行,所以在 作为 systemctl 服务时,必须注释掉
exec /etc/vpp/upf.conf : 为运行 upf 配置脚本
网卡配置项中:
dpdk {
dev 0000:00:06.0 {
num-rx-queues 1
}
dev 0000:00:09.0 {
num-rx-queues 1
}
}
dev 为 网卡 pci id 号,对应运行环境修改
插件配置项中:
plugins {
plugin gtpu_plugin.so { disable }
}
gtpu_plugin.so 插件必须 disable 掉, 否则 在 upf node 中 会有冲突插件导致 upf 加载失败; upf 本身没有用到 gtpu_plugin 插件,所以也不影响 upf 功能。
upf.conf 实例
root@vpp-x:/etc/vpp# cat upf.conf
set int ip address VirtualFunctionEthernet0/6/0 192.168.160.148/24
set int state VirtualFunctionEthernet0/6/0 up
set interface mtu ip4 1500 VirtualFunctionEthernet0/6/0
set interface reassembly VirtualFunctionEthernet0/6/0 on
set int state VirtualFunctionEthernet0/9/0 up
set int ip address VirtualFunctionEthernet0/9/0 192.168.20.28/24
upf nwi name epc vrf 0
upf pfcp endpoint ip 192.168.160.148 vrf 0
upf gtpu endpoint ip 192.168.160.148 nwi epc TEID-Range-Indication 2
需要注意:
VirtualFunctionEthernet0/6/0 :为 upf 纳管网卡后的 name 需要严格对应上;如果没对应上 在启动 vpp过程,会卡住一段时间然后报错,在卡住的过程 可以 通过 vppctl show interface 查看
对于 VirtualFunctionEthernet0/6/0 name 中的 0/6/0 是对应着 pci-id的后三段标号 00.06.0
目前,在 vpp 运行一段时间后,会有报错日志,已在 issue http://172.16.30.125/issues/85250 记录,目前还没发现会影响功能,已将问题反馈给 ASTRI 支持同事,ASTRI 表示以前没有关注过这个报错,建议在 upf 使用过程中,检测到影响后随时反馈沟通。
TS
编译报错信息
/root/xyl/upf-astri/src/plugins/upf/upf_conf.c:1:10: fatal error: 'libxml/parser.h' file not found
#include <libxml/parser.h>
^~~~~~~~~~~~~~~~~
需要安装依赖
$ apt install libxml2-dev
$ ln -s /usr/include/libxml2/libxml /usr/include/libxml