Commit 3149592b authored by wangyongshou's avatar wangyongshou

modify more config problem

parent e556ceae
......@@ -55,9 +55,10 @@ function config_file(){
cp -f $current/new_run_upf.sh $UPFINSTALL/scripts
#etc
cp -f $configure/template/n4_config.yaml $UPFINSTALL/etc
cp -f $configure/template/vppe.conf $UPFINSTALL/etc
cp -f $configure/upf.conf $UPFINSTALL/etc
cp -f $configure/template/n4_config.yaml $UPFINSTALL/etc
cp -f $configure/template/startup_debug.template $UPFINSTALL/etc
#cp -f $configure/template/vppe.conf $UPFINSTALL/etc
cp -f $configure/upf.conf $UPFINSTALL/etc
#tools
cp -f /sbin/ethtool $UPFINSTALL/tools
......
......@@ -9,7 +9,9 @@
current="$PWD"
base=$(dirname "$PWD")
ROOT_PATH=/opt/5gc/test
VPP_PRO="vpp"
N4_PRO="main"
function pre_install()
......
......@@ -3,7 +3,6 @@
current="$PWD"
base=$(dirname "$PWD")
#UPF_CONFIG=$base/etc/upf.conf
VPPPROCESS="vpp"
N4PROCESS="main"
......@@ -38,6 +37,10 @@ UPF_N4_SMF=""
UPF_N4_UPF=""
UPF_N4_LOGSIZE=""
UPF_N3_DRIVER=""
UPF_N6_DRIVER=""
UPF_INTER_IP=""
UPF_INTER_PCI=""
......@@ -184,7 +187,9 @@ function is_configured(){
}
function generate_instance()
{
{
cp -f $base/etc/startup_debug.template $base/etc/vppe.conf
CPUCORES=$(echo `cat /proc/cpuinfo| grep "processor"| wc -l`)
UPF_MAINCORE=`expr $CPUCORES - 3`
......@@ -197,12 +202,12 @@ function generate_instance()
sed -i s/@MAINCORE@/${UPF_MAINCORE}/ $VPP_CONFIG > /dev/null 2>&1;
sed -i s/@WORKERCORE@/${UPF_WORKERCORE}/ $VPP_CONFIG > /dev/null 2>&1;
sed -i s/@N3_PCI@/${UPF_N3_PCI}/ $VPP_CONFIG > /dev/null 2>&1;
sed -i s/@N6_PCI@/${UPF_N6_PCI}/ $VPP_CONFIG > /dev/null 2>&1;
sed -i s/@PCI_ADDR_ID_ENTRY@/${UPF_N3_PCI}/ $VPP_CONFIG > /dev/null 2>&1;
sed -i s/@PCI_ADDR_ID_EXPORT@/${UPF_N6_PCI}/ $VPP_CONFIG > /dev/null 2>&1;
sed -i s/@N3_IP@/${UPF_N3_IP}/ $VPP_CONFIG > /dev/null 2>&1;
sed -i s/@N6_IP@/${UPF_N6_IP}/ $VPP_CONFIG > /dev/null 2>&1;
sed -i s/@N3_GW@/${UPF_N3_GW}/ $VPP_CONFIG > /dev/null 2>&1;
sed -i s/@N6_GW@/${UPF_N6_GW}/ $VPP_CONFIG > /dev/null 2>&1;
sed -i s/@VPPHOST_IP@/${UPF_N6_GW}/ $VPP_CONFIG > /dev/null 2>&1;
#n4 config
sed -i s/@gnb@/${UPF_N4_GNB}/ $VPP_N4 > /dev/null 2>&1;
......@@ -213,11 +218,11 @@ function generate_instance()
echo "config finished"
}
function get_bus()
function get_driver()
{
UPF_N3_DRIVER=$(echo `$base/tools/ethtool -i $UPF_N3_NAME | grep "driver" | awk '{print $2}'`)
if [[ $UPF_N3_DRIVER == "" ]]; then
echo "ERROR N3 $UPF_N3_NAME cat not bus"
echo "ERROR N3 $UPF_N3_NAME cat not driver"
exit 0
else
echo "$UPF_N3_NAME pci $UPF_N3_DRIVER"
......@@ -225,7 +230,7 @@ function get_bus()
UPF_N6_DRIVER=$(echo `$base/tools/ethtool -i $UPF_N6_NAME | grep "driver" | awk '{print $2}'`)
if [[ $UPF_N6_DRIVER == "" ]]; then
echo "ERROR N6 $UPF_N6_NAME cat not bus"
echo "ERROR N6 $UPF_N6_NAME cat not driver"
exit 0
else
echo "$UPF_N6_NAME pci $UPF_N6_DRIVER"
......@@ -251,18 +256,34 @@ function get_pci()
fi
}
function get_inter_info_from_netcard()
{
while read line
do
eval "$line"
done < $base/etc/netcard.conf
UPF_N3_PCI=$upf_n3_pci
UPF_N6_PCI=$upf_n6_pci
UPF_N3_DRIER=$upf_n3_driver
UPF_N6_DRIER=$upf_n6_driver
}
function get_inter_info()
{
if [ -f $base/etc/netcard.conf ] ; then
return 0
fi
#if [ -f $base/etc/netcard.conf ] ; then
# return 0
#fi
get_driver
get_pci
get_bus
#netcard.conf
cd $base/etc
rm -rf netcard.conf
touch netcard.conf
chmod a+x netcard.conf
......@@ -277,6 +298,39 @@ function get_inter_info()
cd ..
}
function check_inter_info()
{
if [[ $UPF_N3_PCI == "" ]]; then
echo "ERROR N3 $UPF_N3_NAME can not get pci"
echo "reboot"
exit 0
else
echo "$UPF_N3_NAME pci $UPF_N3_PCI"
fi
if [[ $UPF_N6_PCI == "" ]]; then
echo "ERROR N6 $UPF_N6_NAME can not get pci"
echo "reboot"
exit 0
else
echo "$UPF_N6_NAME pci $UPF_N6_PCI"
fi
if [[ $UPF_N3_DRIVER == "" ]]; then
echo "ERROR N3 $UPF_N3_NAME cat not get driver "
echo "reboot"
exit 0
else
echo "$UPF_N3_NAME pci $UPF_N3_DRIVER"
fi
if [[ $UPF_N6_DRIVER == "" ]]; then
echo "ERROR N6 $UPF_N6_NAME can not get driver "
echo "reboot"
exit 0
else
echo "$UPF_N6_NAME pci $UPF_N6_DRIVER"
fi
}
#read upf.txt
function read_config() {
......@@ -307,7 +361,19 @@ function read_config() {
UPF_CPU=$vpp_cpu
echo "vpp_cpu:$UPF_CPU"
get_inter_info
if [ -f $base/etc/netcard.conf ] ; then
get_inter_info_from_netcard
else
get_inter_info
fi
check_inter_info
echo "upf_n3_pci:$UPF_N3_PCI"
echo "upf_n6_pci:$UPF_N6_PCI"
echo "upf_n3_driver:$UPF_N3_DRIVER"
echo "upf_n6_driver:$UPF_N6_DRIVER"
echo ""
echo "n4 config"
......@@ -330,15 +396,20 @@ function config_upf()
install_driver
read_config
is_configured
result=$?
if [ $result -eq 0 ] ; then
generate_instance
fi
#is_configured
#result=$?
#if [ $result -eq 0 ] ; then
generate_instance
#fi
net_state
}
function clear_upf()
{
close_upf
rm -rf $/base/*
}
function help()
{
echo "help---"
......@@ -380,6 +451,10 @@ function main()
exit 0
shift
;;
--clear-upf)
clear_upf
shift
;;
esac
done
return 0
......
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