Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
O
OpenXG-UPF
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
1
Issues
1
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Metrics
Environments
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
OpenXG
OpenXG-UPF
Commits
4ab49901
Commit
4ab49901
authored
Dec 22, 2020
by
吴洲洋
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
delete script_bak
parent
082d98e1
Changes
8
Show whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
0 additions
and
904 deletions
+0
-904
scripts_bak/.upf_config.sh.swp
scripts_bak/.upf_config.sh.swp
+0
-0
scripts_bak/arp_config.sh
scripts_bak/arp_config.sh
+0
-21
scripts_bak/nat_config.sh
scripts_bak/nat_config.sh
+0
-45
scripts_bak/readme.txt
scripts_bak/readme.txt
+0
-0
scripts_bak/run_upf.sh
scripts_bak/run_upf.sh
+0
-0
scripts_bak/start_5g.sh
scripts_bak/start_5g.sh
+0
-837
scripts_bak/upf_config.sh
scripts_bak/upf_config.sh
+0
-1
scripts_bak/yq
scripts_bak/yq
+0
-0
No files found.
scripts_bak/.upf_config.sh.swp
deleted
100644 → 0
View file @
082d98e1
File deleted
scripts_bak/arp_config.sh
deleted
100644 → 0
View file @
082d98e1
#!/bin/bash
base
=
$(
cd
$(
dirname
$0
)
;
pwd
)
UEIP
=
192.169.0.0
PREFIX
=
24
INTER
=
enp5s0f1
MAC
=
VPPEXPORT
=
192.168.30.10
echo
"
$base
"
echo
"
$UEIP
"
echo
"
$PREFIX
"
echo
"
$INTER
"
echo
"
$MAC
"
#./setuniarp vppout de:dd:91:00:f6:42 192.169.0.0/24
echo
"
$base
"
/setuniarp
$INTER
$MAC
"
$UEIP
/
$PREFIX
"
"
$base
"
/setuniarp
$INTER
$MAC
"
$UEIP
/
$PREFIX
"
$VPPEXPORT
scripts_bak/nat_config.sh
deleted
100644 → 0
View file @
082d98e1
#!/bin/bash
UE_IP
=
192.169.0.0
UE_IP_PREFIX
=
24
SNAT_INTER
=
enp67s0f0
SNAT_IP
=
192.168.2.129
VPPHOST
=
enp5s0f1
DPDK_EXPORT
=
enp3s0f0
DPDK_ENTRY
=
enp3s0f1
echo
"
$UE_IP
"
echo
"
$UE_IP_PREFIX
"
echo
"
$SNAT_INTER
"
echo
"
$SNAT_IP
"
echo
"
$VPPHOST
"
echo
"
$DPDK_EXPORT
"
echo
"
$DPDK_ENTRY
"
echo
start_ip_link
`
date
`
>>
/opt/5gc/upf/ip_link.log
sudo
ifconfig
$DPDK_EXPORT
down
sudo
ifconfig
$DPDK_ENTRY
down
#vpphost
#sudo ifconfig $VPPHOST 192.168.30.11 up;
#sudo ifconfig $VPPHOST mtu 1400 up;
#sudo route add -net "$UE_IP/$UE_IP_PREFIX" dev $VPPHOST
#sudo route add -net "$UE_IP/$UE_IP_PREFIX" gateway 192.168.30.10
#nat interface
#sudo ifconfig "$SNAT_INTER" mtu 1400 up;
sudo
ethtool
-K
"
$SNAT_INTER
"
gro off
;
sudo
ethtool
-K
"
$SNAT_INTER
"
tso off
;
sudo
ethtool
-K
"
$SNAT_INTER
"
sg off
;
#del
sudo
iptables
-t
nat
-D
POSTROUTING
-s
"
$UE_IP
/
$UE_IP_PREFIX
"
-j
SNAT
--to-source
"
$SNAT_IP
"
iptables
-t
mangle
-D
POSTROUTING
-p
tcp
--tcp-flags
SYN,RST SYN
-o
"
$SNAT_INTER
"
-j
TCPMSS
--set-mss
1300
#add
sudo
iptables
-t
nat
-A
POSTROUTING
-s
"
$UE_IP
/
$UE_IP_PREFIX
"
-j
SNAT
--to-source
"
$SNAT_IP
"
iptables
-t
mangle
-A
POSTROUTING
-p
tcp
--tcp-flags
SYN,RST SYN
-o
"
$SNAT_INTER
"
-j
TCPMSS
--set-mss
1300
#system
echo
"1"
>
/proc/sys/net/ipv4/ip_forward
echo
end_ip_link
`
date
`
>>
/opt/5gc/upf/ip_link.log
scripts_bak/readme.txt
deleted
100644 → 0
View file @
082d98e1
scripts_bak/run_upf.sh
deleted
100644 → 0
View file @
082d98e1
scripts_bak/start_5g.sh
deleted
100755 → 0
View file @
082d98e1
#!/bin/bash
UDMUSERNAME
=
""
UDMREMOTEHOST
=
""
UDMPROCESS
=
"/opt/5gc/udm//libs/ld-linux-x86-64.so.2*"
UDMLOGPATH
=
"/opt/5gc/log/udm.log"
UDMINTER
=
""
UDMSCRIPT
=
"/opt/5gc/service/udm.service"
SMFUSERNAME
=
""
SMFREMOTEHOST
=
""
SMFPROCESS
=
"/opt/5gc/smf//libs/ld-linux-x86-64.so.2*"
SMFLOGPATH
=
"/opt/5gc/log/smf.log"
SMFINTER
=
""
SMFSCRIPT
=
"/opt/5gc/service/smf.service"
AMFUSERNAME
=
""
AMFREMOTEHOST
=
""
AMFLOGPATH
=
"/opt/5gc/log/amf.log"
AMFPROCESS
=
"/opt/5gc/amf//libs/ld-linux-x86-64.so.2*"
AMFINTER
=
""
AMFSCRIPT
=
"/opt/5gc/service/amf.service"
GNBUSERNAME
=
""
GNBREMOTEHOST
=
""
GNBLOGPATH
=
"/tmp/gnb0.log"
GNBPROCESS
=
"lteenb-avx2"
GNBCMD
=
"/opt/5gc/service/gnb.service"
UPFUSERNAME
=
""
UPFREMOTEHOST
=
""
VPPPROCESS
=
"vpp"
VPPLOGPATH
=
"/var/log/upf/vpp/vpp.log"
VPPINTER
=
"enp1s0f0"
VPPCMD
=
"/usr/bin/vpp -c /etc/vpp/startup.conf "
N4PROCESS
=
"main"
N4LOGPATH
=
"/var/log/upf/5gn4/logrus.log"
N4INTER
=
""
N4CMD
=
"/opt/5gc/upf/n4/main -c /opt/5gc/upf/n4/n4_config.yaml"
IPLINK
=
"/opt/5gc/upf/ip_link.sh"
INSTALLDPDK
=
"/opt/5gc/upf/script/install_dpdk_kmod.sh"
UNINSTALLDPDK
=
"/opt/5gc/upf/unbind.sh"
ARPPROCESS
=
"setuniarp"
ARPCMD
=
"/opt/5gc/upf/setuniarp/arp_run.sh"
function
read_yaml
()
{
UDMUSERNAME
=
$(
/opt/5gc/support-system/yq r /opt/5gc/support-system/configure.yaml udm.username
)
UDMREMOTEHOST
=
$(
/opt/5gc/support-system/yq r /opt/5gc/support-system/configure.yaml udm.remoteHost
)
SMFUSERNAME
=
$(
/opt/5gc/support-system/yq r /opt/5gc/support-system/configure.yaml smf.username
)
SMFREMOTEHOST
=
$(
/opt/5gc/support-system/yq r /opt/5gc/support-system/configure.yaml smf.remoteHost
)
SMFINTER
=
$(
/opt/5gc/support-system/yq r /opt/5gc/support-system/configure.yaml smf.inter
)
AMFUSERNAME
=
$(
/opt/5gc/support-system/yq r /opt/5gc/support-system/configure.yaml amf.username
)
AMFREMOTEHOST
=
$(
/opt/5gc/support-system/yq r /opt/5gc/support-system/configure.yaml amf.remoteHost
)
AMFINTER
=
$(
/opt/5gc/support-system/yq r /opt/5gc/support-system/configure.yaml amf.inter
)
GNBUSERNAME
=
$(
/opt/5gc/support-system/yq r /opt/5gc/support-system/configure.yaml gnb.username
)
GNBREMOTEHOST
=
$(
/opt/5gc/support-system/yq r /opt/5gc/support-system/configure.yaml gnb.remoteHost
)
GNBINTER
=
$(
/opt/5gc/support-system/yq r /opt/5gc/support-system/configure.yaml gnb.inter
)
UPFUSERNAME
=
$(
/opt/5gc/support-system/yq r /opt/5gc/support-system/configure.yaml upf.username
)
UPFREMOTEHOST
=
$(
/opt/5gc/support-system/yq r /opt/5gc/support-system/configure.yaml upf.remoteHost
)
N4INTER
=
$(
/opt/5gc/support-system/yq r /opt/5gc/support-system/configure.yaml upf.n4inter
)
}
function
start_vpp
()
{
cmd
=
"
$VPPCMD
"
installDPDK
=
"
$INSTALLDPDK
"
uninstallDPDK
=
"
$UNINSTALLDPDK
"
iplink
=
"
$IPLINK
"
$iplink
#$uninstallDPDK >/dev/null 2>&1 &
$installDPDK
$cmd
>
/dev/null 2>&1 &
sleep
10s
pid
=
$(
pidof
$VPPPROCESS
)
if
test
-z
"
$pid
"
;
then
echo
"vpp startup failed"
exit
1
else
echo
"vpp
$pid
startup success"
exit
2
fi
}
function
close_vpp
()
{
pid
=
$(
pidof
$VPPPROCESS
)
if
test
-z
"
$pid
"
;
then
echo
"vpp
$pid
is not startup"
exit
1
else
echo
"kill vpp
$pid
"
kill
-9
${
pid
}
exit
2
fi
}
function
monitor_vpp
()
{
pid
=
$(
pidof
$VPPPROCESS
)
if
test
-z
"
$pid
"
;
then
echo
"vpp
$pid
is not startup"
exit
1
else
echo
"vpp
$pid
is live"
exit
2
fi
}
function
start_vpp_log
()
{
inter
=
$VPPINTER
pcap
=
"/root/vpp/vpp.pcap"
ntpdate cn.pool.ntp.org
>
/dev/null 2>&1 &
mkdir
vpp
tcpdump
-i
$inter
-w
$pcap
>
/dev/null 2>&1 &
}
function
close_vpp_log
()
{
logPath
=
$VPPLOGPATH
pcap
=
"/root/vpp/vpp.pcap"
current
=
$1
tpid
=
$(
pidof tcpdump
)
if
test
-z
"
$tpid
"
;
then
echo
"
$remoteHost
tcpdump
$tpid
is not startup"
else
echo
"kill tcpdump
$tpid
"
kill
-9
${
tpid
}
fi
if
test
-e
$logPath
;
then
mkdir
-p
/opt/5gc/history/
$current
echo
"copy
$logPath
to /opt/5gc/history/
$current
"
cp
$logPath
/opt/5gc/history/
$current
# rm -rf $logPath
else
echo
"
$VPPPROCESS
log file isn't exit"
fi
if
test
-e
$pcap
;
then
echo
"copy
$pcap
to /opt/5gc/history/
$current
"
cp
$pcap
/opt/5gc/history/
$current
# rm -rf vpp
else
echo
"
$VPPPROCESS
pcap file isn't exit"
fi
}
function
start_n4
()
{
username
=
$UPFUSERNAME
remoteHost
=
$UPFREMOTEHOST
cmd
=
"
$N4CMD
"
$cmd
>
/dev/null 2>&1 &
sleep
1s
pid2
=
$(
pidof
$N4PROCESS
)
if
test
-z
"
$pid2
"
;
then
echo
"n4 startup failed"
exit
1
else
echo
"n4
$pid2
startup success"
exit
2
fi
}
function
close_n4
()
{
pid
=
$(
pidof
$N4PROCESS
)
if
test
-z
"
$pid
"
;
then
echo
"n4
$pid
is not startup"
exit
1
else
echo
"kill n4
$pid
"
kill
-9
${
pid
}
exit
2
fi
}
function
monitor_n4
()
{
pid
=
$(
pidof
$N4PROCESS
)
if
test
-z
"
$pid
"
;
then
echo
"n4
$pid
is not startup"
exit
1
else
echo
"n4
$pid
is live"
exit
2
fi
}
function
start_n4_log
()
{
inter
=
$N4INTER
pcap
=
"/root/n4/n4.pcap"
ntpdate cn.pool.ntp.org
>
/dev/null 2>&1 &
mkdir
/root/n4/
tcpdump
-i
$inter
-w
$pcap
>
/dev/null 2>&1 &
}
function
close_n4_log
()
{
logPath
=
$N4LOGPATH
pcap
=
"/root/n4/n4.pcap"
current
=
$1
tpid
=
$(
pidof tcpdump
)
if
test
-z
"
$tpid
"
;
then
echo
"
$remoteHost
tcpdump
$tpid
is not startup"
else
echo
"kill tcpdump
$tpid
"
kill
-9
${
tpid
}
fi
if
test
-e
$logPath
;
then
mkdir
-p
/opt/5gc/history/
$current
echo
"copy
$logPath
to /opt/5gc/history/
$current
"
cp
$logPath
/opt/5gc/history/
$current
# rm -rf $logPath
else
echo
"
$N4PROCESS
log file isn't exit"
fi
if
test
-e
$pcap
;
then
echo
"copy
$pcap
to /opt/5gc/history/
$current
"
cp
$pcap
/opt/5gc/history/
$current
# rm -rf $pcap
else
echo
"N4 pcap file isn't exit"
fi
}
function
start_arp
()
{
cmd
=
"
$ARPCMD
"
$cmd
>
/dev/null 2>&1 &
sleep
1s
pid2
=
$(
pidof
$ARPPROCESS
)
if
test
-z
"
$pid2
"
;
then
echo
"arp startup failed"
exit
1
else
echo
"arp
$pid2
startup success"
exit
2
fi
}
function
close_arp
()
{
pid
=
$(
pidof
$ARPPROCESS
)
if
test
-z
"
$pid
"
;
then
echo
"arp
$pid
is not startup"
exit
1
else
echo
"kill arp
$pid
"
kill
-9
${
pid
}
exit
2
fi
}
function
monitor_arp
()
{
pid
=
$(
pidof
$ARPPROCESS
)
if
test
-z
"
$pid
"
;
then
echo
"arp
$pid
is not startup"
exit
1
else
echo
"arp
$pid
is live"
exit
2
fi
}
function
start_udm
()
{
username
=
$UDMUSERNAME
remoteHost
=
$UDMREMOTEHOST
cmd
=
"
$UDMSCRIPT
start"
ssh
$username
@
$remoteHost
$cmd
>
/dev/null 2>&1 &
sleep
1s
pid
=
$(
ssh
$username
@
$remoteHost
"
$UDMSCRIPT
status && echo 0"
)
if
[
$pid
-eq
0
]
;
then
echo
"udm
$pid
is startup success"
exit
2
else
echo
"udm
$pid
is not startup "
exit
1
fi
}
function
close_udm
()
{
username
=
$UDMUSERNAME
remoteHost
=
$UDMREMOTEHOST
pid
=
$(
ssh
$username
@
$remoteHost
"
$UDMSCRIPT
status && echo 0"
)
if
[
$pid
-eq
0
]
;
then
ssh
$username
@
$remoteHost
"
$UDMSCRIPT
stop;echo
$?
"
echo
"udm
$pid
is stop success"
exit
2
else
echo
"udm
$pid
is not startup "
exit
1
fi
}
function
monitor_udm
()
{
username
=
$UDMUSERNAME
remoteHost
=
$UDMREMOTEHOST
echo
$UDMSCRIPT
pid
=
$(
ssh
$username
@
$remoteHost
"
$UDMSCRIPT
status && echo 0"
)
if
[
$pid
-eq
0
]
;
then
echo
"udm
$pid
is startup success"
exit
2
else
echo
"udm
$pid
is not startup "
exit
1
fi
}
function
start_udm_log
()
{
username
=
$UDMUSERNAME
remoteHost
=
$UDMREMOTEHOST
inter
=
$UDMINTER
pcap
=
"/root/udm/udm.pcap"
ssh
$username
@
$remoteHost
"ntpdate cn.pool.ntp.org > /dev/null 2>&1 &"
sh
$username
@
$remoteHost
"mkdir udm"
ssh
$username
@
$remoteHost
"tcpdump -i
$inter
-w
$pcap
> /dev/null 2>&1 &"
}
function
close_udm_log
()
{
username
=
$UDMUSERNAME
remoteHost
=
$UDMREMOTEHOST
logPath
=
$UDMLOGPATH
pcap
=
"/root/udm/udm.pcap"
current
=
$1
tpid
=
$(
ssh
$username
@
$remoteHost
"pidof tcpdump"
)
if
test
-z
"
$tpid
"
;
then
echo
"
$remoteHost
tcpdump
$tpid
is not startup"
else
echo
"kill tcpdump
$tpid
"
ssh
$username
@
$remoteHost
"kill -9
${
tpid
}
"
fi
if
ssh
$username
@
$remoteHost
test
-e
$logPath
;
then
mkdir
-p
/opt/5gc/history/
$current
echo
"copy
$logPath
to /opt/5gc/history/
$current
"
scp
$username
@
$remoteHost
:
$logPath
/opt/5gc/history/
$current
ssh
$username
@
$remoteHost
"rm -rf
$logPath
"
else
echo
"
$UDMPROCESS
log file isn't exit"
fi
if
ssh
$username
@
$remoteHost
test
-e
$pcap
;
then
echo
"copy
$pcap
to /opt/5gc/history/
$current
"
scp
$username
@
$remoteHost
:
$pcap
/opt/5gc/history/
$current
ssh
$username
@
$remoteHost
"rm -rf udm"
else
echo
"udm pcap file isn't exit"
fi
}
function
start_smf
()
{
username
=
$SMFUSERNAME
remoteHost
=
$SMFREMOTEHOST
cmd
=
"
$SMFSCRIPT
start"
ssh
$username
@
$remoteHost
$cmd
>
/dev/null 2>&1 &
sleep
1s
pid
=
$(
ssh
$username
@
$remoteHost
"
$SMFSCRIPT
status && echo 0"
)
if
[
$pid
-eq
0
]
;
then
echo
"smf
$pid
is startup success"
exit
2
else
echo
"smf
$pid
is not startup "
exit
1
fi
}
function
close_smf
()
{
username
=
$SMFUSERNAME
remoteHost
=
$SMFREMOTEHOST
pid
=
$(
ssh
$username
@
$remoteHost
"
$SMFSCRIPT
status && echo 0"
)
if
[
$pid
-eq
0
]
;
then
ssh
$username
@
$remoteHost
"
$SMFSCRIPT
stop"
echo
"smf
$pid
is stop success"
exit
2
else
echo
"smf
$pid
is not startup "
exit
1
fi
}
function
monitor_smf
()
{
username
=
$SMFUSERNAME
remoteHost
=
$SMFREMOTEHOST
pid
=
$(
ssh
$username
@
$remoteHost
"
$SMFSCRIPT
status && echo 0"
)
if
[
$pid
-eq
0
]
;
then
echo
"smf
$pid
is stop success"
exit
2
else
echo
"smf
$pid
is not startup "
exit
1
fi
}
function
start_smf_log
()
{
username
=
$SMFUSERNAME
remoteHost
=
$SMFREMOTEHOST
inter
=
$SMFINTER
pcap
=
"/root/smf/smf.pcap"
ssh
$username
@
$remoteHost
"ntpdate cn.pool.ntp.org > /dev/null 2>&1 &"
ssh
$username
@
$remoteHost
"rm -rf /root/smf/"
ssh
$username
@
$remoteHost
"mkdir -p /root/smf/"
ssh
$username
@
$remoteHost
"tcpdump -i
$inter
-w
$pcap
> /dev/null 2>&1 &"
}
function
close_smf_log
()
{
username
=
$SMFUSERNAME
remoteHost
=
$SMFREMOTEHOST
logPath
=
$SMFLOGPATH
pcap
=
"/root/smf/smf.pcap"
current
=
$1
tpid
=
$(
ssh
$username
@
$remoteHost
"pidof tcpdump"
)
if
test
-z
"
$tpid
"
;
then
echo
"
$remoteHost
tcpdump
$tpid
is not startup"
else
echo
"kill tcpdump
$tpid
"
ssh
$username
@
$remoteHost
"kill -9
${
tpid
}
"
fi
if
ssh
$username
@
$remoteHost
test
-e
$logPath
;
then
mkdir
-p
/opt/5gc/history/
$current
echo
"copy
$logPath
to /opt/5gc/history/
$current
"
scp
$username
@
$remoteHost
:
$logPath
/opt/5gc/history/
$current
ssh
$username
@
$remoteHost
"rm -rf
$logPath
"
else
echo
"
$UDMPROCESS
log file isn't exit"
fi
if
ssh
$username
@
$remoteHost
test
-e
$pcap
;
then
echo
"copy
$pcap
to /opt/5gc/history/
$current
"
scp
$username
@
$remoteHost
:
$pcap
/opt/5gc/history/
$current
ssh
$username
@
$remoteHost
"rm -rf smf"
else
echo
"smf pcap file isn't exit"
fi
}
function
start_amf
()
{
username
=
$AMFUSERNAME
remoteHost
=
$AMFREMOTEHOST
cmd
=
"
$AMFSCRIPT
start"
ssh
$username
@
$remoteHost
$cmd
>
/dev/null 2>&1 &
sleep
1s
pid
=
$(
ssh
$username
@
$remoteHost
"
$AMFSCRIPT
status && echo 0"
)
if
[
$pid
-eq
0
]
;
then
echo
"amf
$pid
is stop success"
exit
2
else
echo
"amf
$pid
is not startup "
exit
1
fi
}
function
close_amf
()
{
username
=
$AMFUSERNAME
remoteHost
=
$AMFREMOTEHOST
pid
=
$(
ssh
$username
@
$remoteHost
"
$AMFSCRIPT
status && echo 0"
)
if
[
$pid
-eq
0
]
;
then
ssh
$username
@
$remoteHost
"
$AMFSCRIPT
stop"
echo
"amf
$pid
is stop success"
exit
2
else
echo
"amf
$pid
is not startup "
exit
1
fi
}
function
monitor_amf
()
{
username
=
$AMFUSERNAME
remoteHost
=
$AMFREMOTEHOST
pid
=
$(
ssh
$username
@
$remoteHost
"
$AMFSCRIPT
status && echo 0"
)
if
[
$pid
-eq
0
]
;
then
echo
"amf
$pid
is stop success"
exit
2
else
echo
"amf
$pid
is not startup "
exit
1
fi
}
function
start_amf_log
()
{
username
=
$AMFUSERNAME
remoteHost
=
$AMFREMOTEHOST
inter
=
$AMFINTER
pcap
=
"/root/amf/amf.pcap"
ssh
$username
@
$remoteHost
"ntpdate cn.pool.ntp.org > /dev/null 2>&1 &"
ssh
$username
@
$remoteHost
"rm -rf /root/amf/"
ssh
$username
@
$remoteHost
"mkdir -p /root/amf/"
ssh
$username
@
$remoteHost
"tcpdump -i
$inter
-w
$pcap
> /dev/null 2>&1 &"
}
function
close_amf_log
()
{
username
=
$AMFUSERNAME
remoteHost
=
$AMFREMOTEHOST
logPath
=
$AMFLOGPATH
pcap
=
"/root/amf/amf.pcap"
current
=
$1
tpid
=
$(
ssh
$username
@
$remoteHost
"pidof tcpdump"
)
if
test
-z
"
$tpid
"
;
then
echo
"
$remoteHost
tcpdump
$tpid
is not startup"
else
echo
"kill tcpdump
$tpid
"
ssh
$username
@
$remoteHost
"kill -9
${
tpid
}
"
fi
if
ssh
$username
@
$remoteHost
test
-e
$logPath
;
then
mkdir
-p
/opt/5gc/history/
$current
echo
"copy
$logPath
to /opt/5gc/history/
$current
"
scp
$username
@
$remoteHost
:
$logPath
/opt/5gc/history/
$current
ssh
$username
@
$remoteHost
"rm -rf
$logPath
"
else
echo
"
$AMFPROCESS
log file isn't exit"
fi
if
ssh
$username
@
$remoteHost
test
-e
$pcap
;
then
echo
"copy
$pcap
to /opt/5gc/history/
$current
"
scp
$username
@
$remoteHost
:
$pcap
/opt/5gc/history/
$current
ssh
$username
@
$remoteHost
"rm -rf amf"
else
echo
"amf pcap file isn't exit"
fi
}
function
start_gnb
()
{
username
=
$GNBUSERNAME
remoteHost
=
$GNBREMOTEHOST
cmd
=
"
$GNBCMD
start"
ssh
$username
@
$remoteHost
$cmd
>
/dev/null 2>&1 &
sleep
6s
pid
=
$(
ssh
$username
@
$remoteHost
"pidof
$GNBPROCESS
"
)
if
test
-z
"
$pid
"
;
then
echo
"gnb
$pid
is not startup"
exit
1
else
echo
"gnb
$pid
is live"
exit
2
fi
}
function
close_gnb
()
{
username
=
$GNBUSERNAME
remoteHost
=
$GNBREMOTEHOST
pid
=
$(
ssh
$username
@
$remoteHost
"pidof
$GNBPROCESS
"
)
if
test
-z
"
$pid
"
;
then
echo
"gnb
$pid
is not startup"
exit
1
else
echo
"kill gnb
$pid
"
ssh
$username
@
$remoteHost
"
$GNBCMD
stop"
exit
2
fi
}
function
monitor_gnb
()
{
username
=
$GNBUSERNAME
remoteHost
=
$GNBREMOTEHOST
pid
=
$(
ssh
$username
@
$remoteHost
"pidof
$GNBPROCESS
"
)
if
test
-z
"
$pid
"
;
then
echo
"gnb
$pid
is not startup"
exit
1
else
echo
"kill gnb
$pid
"
exit
2
fi
}
function
start_gnb_log
()
{
username
=
$GNBUSERNAME
remoteHost
=
$GNBREMOTEHOST
inter
=
$GNBINTER
pcap
=
"/root/gnb/gnb.pcap"
ssh
$username
@
$remoteHost
"ntpdate cn.pool.ntp.org > /dev/null 2>&1 &"
ssh
$username
@
$remoteHost
"rm -rf /root/gnb/"
ssh
$username
@
$remoteHost
"mkdir /root/gnb/"
ssh
$username
@
$remoteHost
"tcpdump -i
$inter
-w
$pcap
> /dev/null 2>&1 &"
}
function
close_gnb_log
()
{
username
=
$GNBUSERNAME
remoteHost
=
$GNBREMOTEHOST
logPath
=
$GNBLOGPATH
pcap
=
"/root/gnb/gnb.pcap"
current
=
$1
tpid
=
$(
ssh
$username
@
$remoteHost
"pidof tcpdump"
)
if
test
-z
"
$tpid
"
;
then
echo
"
$remoteHost
tcpdump
$tpid
is not startup"
else
echo
"kill tcpdump
$tpid
"
ssh
$username
@
$remoteHost
"kill -9
${
tpid
}
"
fi
if
ssh
$username
@
$remoteHost
test
-e
$logPath
;
then
mkdir
-p
/opt/5gc/history/
$current
echo
"copy
$logPath
to /opt/5gc/history/
$current
"
scp
$username
@
$remoteHost
:
$logPath
/opt/5gc/history/
$current
ssh
$username
@
$remoteHost
"rm -rf
$logPath
"
else
echo
"
$GNBPROCESS
log file isn't exit"
fi
if
ssh
$username
@
$remoteHost
test
-e
$pcap
;
then
echo
"copy
$pcap
to /opt/5gc/history/
$current
"
scp
$username
@
$remoteHost
:
$pcap
/opt/5gc/history/
$current
ssh
$username
@
$remoteHost
"rm -rf gnb"
else
echo
"GNB pcap file isn't exit"
fi
}
function
main
()
{
read_yaml
current
=
$(
date
"+%Y-%m-%d_%H:%M"
)
until
[
-z
"
$1
"
]
;
do
case
"
$1
"
in
--start_5g
)
start_udm
start_smf
start_amf
start_vpp
start_n4
start_arp
start_gnb
shift
;;
--close_5g
)
close_udm
close_smf
close_amf
close_vpp
close_n4
close_arp
close_gnb
shift
;;
--close_5g_tcpdump
)
close_udm_log
"
$current
"
close_smf_log
"
$current
"
close_amf_log
"
$current
"
close_vpp_log
"
$current
"
close_n4_log
"
$current
"
close_arp_log
"
$current
"
close_gnb_log
"
$current
"
shift
;;
--start_5g_tcpdump
)
start_udm_log
start_smf_log
start_amf_log
start_vpp_log
start_n4_log
# start_gnb_log
shift
;;
--monitor_5g
)
monitor_udm
monitor_smf
monitor_amf
monitor_vpp
monitor_n4
monitor_arp
monitor_gnb
shift
;;
--start_udm
)
start_udm
shift
;;
--start_smf
)
start_smf
shift
;;
--start_amf
)
start_amf
shift
;;
--start_vpp
)
start_vpp
shift
;;
--start_n4
)
start_n4
shift
;;
--start_arp
)
start_arp
shift
;;
--start_gnb
)
start_gnb
shift
;;
--close_udm
)
close_udm
shift
;;
--close_smf
)
close_smf
shift
;;
--close_amf
)
close_amf
shift
;;
--close_vpp
)
close_vpp
shift
;;
--close_n4
)
close_n4
shift
;;
--close_arp
)
close_arp
shift
;;
--close_gnb
)
close_gnb
shift
;;
--monitor_udm
)
monitor_udm
shift
;;
--monitor_smf
)
monitor_smf
shift
;;
--monitor_amf
)
monitor_amf
shift
;;
--monitor_vpp
)
monitor_vpp
shift
;;
--monitor_n4
)
monitor_n4
shift
;;
--monitor_arp
)
monitor_arp
shift
;;
--monitor_gnb
)
monitor_gnb
shift
;;
--start_udm_log
)
start_udm_log
shift
;;
--start_smf_log
)
start_smf_log
shift
;;
--start_amf_log
)
start_amf_log
shift
;;
--start_vpp_log
)
start_vpp_log
shift
;;
--start_n4_log
)
start_n4_log
shift
;;
--start_gnb_log
)
start_gnb_log
shift
;;
--close_udm_log
)
close_udm_log
"
$current
"
shift
;;
--close_smf_log
)
close_smf_log
"
$current
"
shift
;;
--close_amf_log
)
close_amf_log
"
$current
"
shift
;;
--close_vpp_log
)
close_vpp_log
"
$current
"
shift
;;
--close_n4_log
)
close_n4_log
"
$current
"
shift
;;
--close_gnb_log
)
close_gnb_log
"
$current
"
shift
;;
esac
done
exit
0
}
main
"
$@
"
scripts_bak/upf_config.sh
deleted
100644 → 0
View file @
082d98e1
这个文件调用 arp_config、nat_config等脚本,实现统一的upf配置。
\ No newline at end of file
scripts_bak/yq
deleted
100755 → 0
View file @
082d98e1
File deleted
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment