Commit 064600a8 authored by wangyongshou's avatar wangyongshou

modify system config

parent 619c65e5
......@@ -19,6 +19,14 @@ UPFINSTALL="$base/install/upf"
UPF_PKG="upf.tar.gz"
#init value
OS_KERNEL_VERSION_V1="5.3.0-28-generic"
OS_KERNEL_VERSION_V2="5.4.0-80-generic"
OS_ID_VALUE="ubuntu"
OS_VERSION_ID_VALUE="18.04"
OS_ARCH_VALUE="x86_64"
OS_ID=""
OS_VERSION_ID=""
OS_KERNEL_VERSION=""
......@@ -36,6 +44,9 @@ function pre_create(){
#sudo mkdir -p $UPFINSTALL
#fi
rm -f $UPFINSTALL/$UPF_PKG
#re create
mkdir -p $UPFINSTALL
......@@ -233,9 +244,27 @@ function clear_all()
rm -rf $VPPPATH/build/external/downloads/*
}
function system_requirement()
{
echo "Minimum system requirements"
echo ""
echo "ubuntu"
echo "18.04"
echo "5.4.0-80-generic or 5.3.0-28-generic"
echo "x86_64"
echo ""
echo ""
return 0
}
function check_system()
{
echo "check_system..."
echo "check system config"
echo ""
if [ ! -f /etc/os-release ] ; then
echo "ERROR /etc/os-release is not exist....."
......@@ -244,34 +273,58 @@ function check_system()
OS_ID=$(echo `grep '^ID=' /etc/os-release | cut -f2- -d= | sed -e 's/\"//g'`)
OS_VERSION_ID=$(echo `grep '^VERSION_ID=' /etc/os-release | cut -f2- -d= | sed -e 's/\"//g'`)
OS_KERNEL_VERSION=$(echo `uname -r`)
OS_KERNEL_VERSION=$(echo `uname -r | cut -f2- -d= | sed -e 's/\"//g'`)
OS_ARCH=$(echo `uname --m`)
if [ $OS_KERNEL_VERSION != $OS_KERNEL_VERSION_V1 ]; then
if [ $OS_KERNEL_VERSION != $OS_KERNEL_VERSION_V2 ]; then
echo "kernel version error: $OS_KERNEL_VERSION"
echo ""
system_requirement
echo "build, exit..."
exit 0
fi
fi
#ubuntu
if [ $OS_ID == "ubuntu" -a $OS_VERSION_ID == "18.04" -a $OS_KERNEL_VERSION == "5.4.0-80-generic" -a $OS_ARCH == "x86_64" ]; then
if [ $OS_ID == $OS_ID_VALUE -a $OS_VERSION_ID == $OS_VERSION_ID_VALUE -a $OS_ARCH == $OS_ARCH_VALUE ]; then
echo $OS_ID
echo $OS_VERSION_ID
echo $OS_KERNEL_VERSION
echo $OS_ARCH
OS_SYS_TYPE="ubuntu"
else
echo "don't know system"
echo $OS_ID
echo $OS_VERSION_ID
echo $OS_KERNEL_VERSION
echo $OS_ARCH
echo ""
echo "don't support system config"
echo ""
system_requirement
echo "build exit..."
exit 0
fi
return 0
}
function help()
{
echo " "
......
......@@ -15,6 +15,18 @@ ROOT_PATH=/opt/5gc/upf
VPP_PRO="vpp"
N4_PRO="main"
#init value
OS_KERNEL_VERSION_V1="5.3.0-28-generic"
OS_KERNEL_VERSION_V2="5.4.0-80-generic"
OS_ID_VALUE="ubuntu"
OS_VERSION_ID_VALUE="18.04"
OS_ARCH_VALUE="x86_64"
OS_CPU_NUM_VALUE=16
OS_FREE_VALUE=14
OS_ID=""
OS_VERSION_ID=""
OS_KERNEL_VERSION=""
......@@ -108,7 +120,7 @@ function system_requirement()
echo ""
echo "ubuntu"
echo "18.04"
echo "5.4.0-80-generic"
echo "5.4.0-80-generic or 5.3.0-28-generic"
echo "x86_64"
echo "cpu num: 16"
echo "free total mem: 14G"
......@@ -132,7 +144,7 @@ function check_system()
OS_ID=$(echo `grep '^ID=' /etc/os-release | cut -f2- -d= | sed -e 's/\"//g'`)
OS_VERSION_ID=$(echo `grep '^VERSION_ID=' /etc/os-release | cut -f2- -d= | sed -e 's/\"//g'`)
OS_KERNEL_VERSION=$(echo `uname -r`)
OS_KERNEL_VERSION=$(echo `uname -r | cut -f2- -d= | sed -e 's/\"//g'`)
OS_ARCH=$(echo `uname --m`)
OS_CPU_NUM_T=$(echo `cat /proc/cpuinfo| grep "processor"| wc -l`)
......@@ -142,13 +154,29 @@ function check_system()
OS_CPU_NUM=$(echo `echo $OS_CPU_NUM_T| awk '{print int($0)}'`)
OS_FREE=$(echo `echo $OS_FREE_T| awk '{print int($0)}'`)
if [ $OS_KERNEL_VERSION != $OS_KERNEL_VERSION_V1 ]; then
if [ $OS_KERNEL_VERSION != $OS_KERNEL_VERSION_V2 ]; then
echo "kernel version error: $OS_KERNEL_VERSION"
echo ""
system_requirement
echo "exit..."
exit 0
fi
fi
#ubuntu
if [ $OS_ID == "ubuntu" -a $OS_VERSION_ID == "18.04" -a $OS_KERNEL_VERSION == "5.4.0-80-generic" -a $OS_ARCH == "x86_64" -a $OS_CPU_NUM -ge 16 -a $OS_FREE -ge 14 ]; then
if [ $OS_ID == $OS_ID_VALUE -a $OS_VERSION_ID == $OS_VERSION_ID_VALUE -a $OS_ARCH == $OS_ARCH_VALUE -a $OS_CPU_NUM -ge $OS_CPU_NUM_VALUE -a $OS_FREE -ge $OS_FREE_VALUE ]; then
echo $OS_ID
echo $OS_VERSION_ID
echo $OS_KERNEL_VERSION
echo $OS_ARCH
echo "cpu num: $OS_CPU_NUM"
echo "free mem: $OS_FREE"
......@@ -163,12 +191,13 @@ function check_system()
echo $OS_CPU_NUM
echo $OS_FREE
echo ""
echo "don't support system config"
echo ""
system_requirement
echo " exit..."
echo "exit..."
exit 0
fi
......
#!/bin/bash
current="$PWD"
base=$(dirname "$PWD")
#current="$PWD"
#base=$(dirname "$PWD")
base=/opt/5gc/upf
VPPPROCESS="vpp"
N4PROCESS="main"
N4PATH="$base/install/n4"
#N4PATH="$base/install/n4"
DPDK_ENTRY_PCI=""
DPDK_EXPORT_PCI=""
......@@ -16,7 +17,7 @@ CPUNUMBER=""
UPF_CONFIG=$base/etc/upf.conf
VPP_CONFIG=$base/etc/vppe.conf
VPP_N4=$base/etc/n4_config.yaml
CPU_MIN_NUMS=8
#CPU_MIN_NUMS=8
#vpp config
UPF_N3_NAME=""
......@@ -49,6 +50,7 @@ CPU_MASK=""
function start_vppe()
{
echo ""
$base/bin/vpp -c $base/etc/vppe.conf >/dev/null 2>&1 ;
sleep 1s
......@@ -62,6 +64,7 @@ function start_vppe()
function start_n4()
{
echo ""
$base/bin/main -c $base/etc/n4_config.yaml & >/dev/null 2>&1 ;
sleep 1s
......@@ -117,6 +120,21 @@ function close_n4()
exit 0
}
function protect_system_dead()
{
#sysctl -w vm.dirty_background_bytes=0
sysctl -w vm.dirty_background_ratio=10
#sysctl -w vm.dirty_bytes=0
sysctl -w vm.dirty_ratio=20
sysctl -w vm.dirty_writeback_centisecs=500
sysctl -w vm.dirty_expire_centisecs=3000
sysctl -w vm.dirtytime_expire_seconds=43200
sysctl -p
return 0
}
function check_system()
{
CPUCORES=$(echo `cat /proc/cpuinfo| grep "processor"| wc -l`)
......@@ -221,7 +239,6 @@ function set_cpu_interrupt()
while [ $INTE_NUM != 0 ]
do
INTE_NUM=$(($INTE_NUM - 1))
tmp=${CPU_MASK}"F"
CPU_MASK=${tmp}
......@@ -436,8 +453,8 @@ function read_config() {
function chk_net()
{
echo "check net ..."
echo ""
echo "Check the network connection"
ping_gnb_n3=$(echo `/usr/bin/vppctl -s /run/vpp/cli.sock ping $UPF_N3_GW source if_n3 repeat 5`)
loss="*100% packet loss*"
......@@ -461,6 +478,7 @@ function chk_net()
echo "n6 ping: $UPF_N6_IP ping $UPF_N6_GW"
echo ${ping_dn_n6}
echo ""
return 0
......@@ -469,11 +487,13 @@ function chk_net()
function config_upf()
{
echo ""
install_driver
net_bind_driver
read_config
generate_instance
net_bind_vfio_pci
protect_system_dead
}
function clear_upf()
{
......@@ -497,7 +517,7 @@ function help()
function main()
{
check_system
#check_system
if [ $# -eq 0 ];
then
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment