Improve 'vty' command

This commit is contained in:
Keith Whyte 2023-01-23 23:51:32 +01:00
parent 29832190cf
commit 791f7ac968

View file

@ -23,6 +23,7 @@ set vty [lindex $argv 0]
set lf [lindex $argv 1] set lf [lindex $argv 1]
set all [lindex $argv 2] set all [lindex $argv 2]
set h [lindex $argv 3] set h [lindex $argv 3]
set port 0
if { $lf < 0 } { set lf 1 } if { $lf < 0 } { set lf 1 }
if { $all < 0 } { set all notice } if { $all < 0 } { set all notice }
if { $all == "dq" } { if { $all == "dq" } {
@ -36,10 +37,6 @@ switch $vty {
hlr { set port 4258 } ; # Short names hlr { set port 4258 } ; # Short names
bsc { set port 4242 } bsc { set port 4242 }
mgw { set port 4243 } mgw { set port 4243 }
mgw2 {
set host 127.0.0.2
set port 4243
}
sg { set port 4245 } sg { set port 4245 }
msc { set port 4254 } msc { set port 4254 }
sip { set port 4256 } sip { set port 4256 }
@ -68,6 +65,11 @@ switch $vty {
default { set port 4242 } ; # Default to osmo-bsc / osmo-nitb default { set port 4242 } ; # Default to osmo-bsc / osmo-nitb
} }
if { $port == 0 } {
send "Which vty?\n"
exit
}
spawn -noecho telnet $host $port spawn -noecho telnet $host $port
expect ">" expect ">"
send "enable\r" send "enable\r"
@ -153,5 +155,13 @@ switch $vty {
} }
send "logging filter all $lf\r" send "logging filter all $lf\r"
# If we want to be quiet, some programs don't apply the filter
# So exec these command last, (for easy callback)
if { $lf==0 && ($vty=="hlr" || $vty=="mgw")} {
send "logging level set-all $all\r"
expect "#"
send "logging level set-all fatal\r"
expect "#"
}
expect "#" expect "#"
interact interact