Add/Improve utility shell functions
This commit is contained in:
parent
5e653ffac7
commit
0f2a6cf49e
1 changed files with 40 additions and 2 deletions
|
@ -8,6 +8,14 @@ OSMO_HLR="<%= @hlr_db %>"
|
||||||
OSMO_SMS="<%= @sms_db %>"
|
OSMO_SMS="<%= @sms_db %>"
|
||||||
DID="<%= @voip_did %>"
|
DID="<%= @voip_did %>"
|
||||||
|
|
||||||
|
_get_vty_ctrl_ip() {
|
||||||
|
if [ "$1" == "" ]; then
|
||||||
|
echo "127.0.0.1"
|
||||||
|
else
|
||||||
|
echo "127.0.0.$(($1+1))"
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
waitfor0calls () {
|
waitfor0calls () {
|
||||||
while (( $((`fs_cli -x "show calls count" | awk '$1{print $1}'`)) > 0 ))
|
while (( $((`fs_cli -x "show calls count" | awk '$1{print $1}'`)) > 0 ))
|
||||||
do
|
do
|
||||||
|
@ -141,6 +149,34 @@ ns () {
|
||||||
expect -c 'spawn -noecho telnet 0 4245; expect >; send enable\r; expect #; send "show ns\r"; expect #' | grep NSEI | grep ALIVE;
|
expect -c 'spawn -noecho telnet 0 4245; expect >; send enable\r; expect #; send "show ns\r"; expect #' | grep NSEI | grep ALIVE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
mgwc () {
|
||||||
|
echo -n "VI: "
|
||||||
|
expect -c 'spawn -noecho telnet 0 4243; expect >; send enable\r; expect #; send "show mgcp active\r"; expect #' | egrep 'Virtual.*endpoint ' | wc -l
|
||||||
|
echo -n "E1: "
|
||||||
|
expect -c 'spawn -noecho telnet 0 4243; expect >; send enable\r; expect #; send "show mgcp active\r"; expect #' | egrep 'E1.*endpoint ' | wc -l;
|
||||||
|
expect -c 'spawn -noecho telnet 0 4243; expect >; send enable\r; expect #; send "show mgcp\r"; expect #' \
|
||||||
|
| egrep 'E1.*endpoint ' | nl -v0 | grep su16 | awk '{printf( "%x", $1) ; print $0}' > /tmp/list
|
||||||
|
expect -c 'spawn -noecho telnet 0 4243; expect >; send enable\r; expect #; send "show mgcp active\r"; expect #' | grep 'E1.*endpoint '\
|
||||||
|
| awk '{ cmd ="grep "$5" /tmp/list" ; cmd | getline res ; print res} '
|
||||||
|
}
|
||||||
|
|
||||||
|
trx ()
|
||||||
|
{
|
||||||
|
echo "show trx" | nc -q1 0 4242 | egrep '( |Carrier) NM State.*OK' | wc -l
|
||||||
|
}
|
||||||
|
|
||||||
|
lc () {
|
||||||
|
_h=`_get_vty_ctrl_ip $1`
|
||||||
|
expect -c 'set h '$_h'; spawn -noecho telnet $h 4242; expect >; send enable\r; expect #; send "show lchan summary\r"; expect #' | grep TCH
|
||||||
|
}
|
||||||
|
|
||||||
|
rotate_e1_pcap () {
|
||||||
|
_suf=`date +%H_%M_%S`
|
||||||
|
expect -c 'set file '$_suf'; spawn telnet localhost 4242; expect ">"; send "enable\r"; expect "#"; send "configure terminal\r"; expect "#";
|
||||||
|
send "e1_input\r"; expect "#"; send "e1_line 0 pcap /root/cap/abis.$file\r"; expect "#";
|
||||||
|
send "exit \r"; expect "#"; send "exit\r"; expect "#"'
|
||||||
|
}
|
||||||
|
|
||||||
pp () {
|
pp () {
|
||||||
ps awxf | grep [p]ython
|
ps awxf | grep [p]ython
|
||||||
}
|
}
|
||||||
|
@ -175,7 +211,8 @@ bar ()
|
||||||
echo "BTS #?";
|
echo "BTS #?";
|
||||||
return;
|
return;
|
||||||
fi;
|
fi;
|
||||||
expect -c 'set bts '$1'; spawn telnet localhost 4242; expect ">"; send "enable\r"; expect "#"; send "configure terminal\r"; expect "#";
|
_h=`_get_vty_ctrl_ip $2`
|
||||||
|
expect -c 'set bts '$1'; set h '$_h' ; spawn telnet $h 4242; expect ">"; send "enable\r"; expect "#"; send "configure terminal\r"; expect "#";
|
||||||
send "network\r"; expect "#"; send "bts $bts\r"; expect "#"; send "cell barred 1\r"; expect "#"; send "exit \r";
|
send "network\r"; expect "#"; send "bts $bts\r"; expect "#"; send "cell barred 1\r"; expect "#"; send "exit \r";
|
||||||
expect "#"; send "exit\r"; expect "#"; send "exit\r"; expect "#"; send "bts $bts resend-system-information\r"; expect "#"; send "exit\r"; expect "#"'
|
expect "#"; send "exit\r"; expect "#"; send "exit\r"; expect "#"; send "bts $bts resend-system-information\r"; expect "#"; send "exit\r"; expect "#"'
|
||||||
}
|
}
|
||||||
|
@ -186,7 +223,8 @@ unbar ()
|
||||||
echo "BTS #?";
|
echo "BTS #?";
|
||||||
return;
|
return;
|
||||||
fi;
|
fi;
|
||||||
expect -c 'set bts '$1'; spawn telnet localhost 4242; expect ">"; send "enable\r"; expect "#"; send "configure terminal\r"; expect "#";
|
_h=`_get_vty_ctrl_ip $2`
|
||||||
|
expect -c 'set bts '$1'; set h '$_h' ; spawn telnet $h 4242; expect ">"; send "enable\r"; expect "#"; send "configure terminal\r"; expect "#";
|
||||||
send "network\r"; expect "#"; send "bts $bts\r"; expect "#"; send "cell barred 0\r"; expect "#"; send "exit \r";
|
send "network\r"; expect "#"; send "bts $bts\r"; expect "#"; send "cell barred 0\r"; expect "#"; send "exit \r";
|
||||||
expect "#"; send "exit\r"; expect "#"; send "exit\r"; expect "#"; send "bts $bts resend-system-information\r"; expect "#"; send "exit\r"; expect "#"'
|
expect "#"; send "exit\r"; expect "#"; send "exit\r"; expect "#"; send "bts $bts resend-system-information\r"; expect "#"; send "exit\r"; expect "#"'
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue