From 791f7ac968a70344aa6fb1e30338a87d0655d800 Mon Sep 17 00:00:00 2001 From: Keith Whyte Date: Mon, 23 Jan 2023 23:51:32 +0100 Subject: [PATCH] Improve 'vty' command --- modules/rhizo_base/files/vty | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) diff --git a/modules/rhizo_base/files/vty b/modules/rhizo_base/files/vty index 0877cb5..6d9c5f2 100755 --- a/modules/rhizo_base/files/vty +++ b/modules/rhizo_base/files/vty @@ -23,6 +23,7 @@ set vty [lindex $argv 0] set lf [lindex $argv 1] set all [lindex $argv 2] set h [lindex $argv 3] +set port 0 if { $lf < 0 } { set lf 1 } if { $all < 0 } { set all notice } if { $all == "dq" } { @@ -36,10 +37,6 @@ switch $vty { hlr { set port 4258 } ; # Short names bsc { set port 4242 } mgw { set port 4243 } - mgw2 { - set host 127.0.0.2 - set port 4243 - } sg { set port 4245 } msc { set port 4254 } sip { set port 4256 } @@ -68,6 +65,11 @@ switch $vty { default { set port 4242 } ; # Default to osmo-bsc / osmo-nitb } +if { $port == 0 } { + send "Which vty?\n" + exit +} + spawn -noecho telnet $host $port expect ">" send "enable\r" @@ -153,5 +155,13 @@ switch $vty { } 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 "#" interact