Change in libosmocore[master]: Add expect script: 'vty' for easy access to all vtys

This is merely a historical archive of years 2008-2021, before the migration to mailman3.

A maintained and still updated list archive can be found at https://lists.osmocom.org/hyperkitty/list/gerrit-log@lists.osmocom.org/.

Keith Whyte gerrit-no-reply at lists.osmocom.org
Tue Apr 23 18:39:45 UTC 2019


Keith Whyte has uploaded this change for review. ( https://gerrit.osmocom.org/13756


Change subject: Add expect script: 'vty' for easy access to all vtys
......................................................................

Add expect script: 'vty' for easy access to all vtys

This expect script can be run as:
 ./vty bsc
 ./vty msc
 ./vty sip ...

etc (no need to remember ports)

Change-Id: Ice4532be7cb3139da29cb9d84dd4769e8d826dfa
---
A contrib/vty
1 file changed, 87 insertions(+), 0 deletions(-)



  git pull ssh://gerrit.osmocom.org:29418/libosmocore refs/changes/56/13756/1

diff --git a/contrib/vty b/contrib/vty
new file mode 100755
index 0000000..14c4336
--- /dev/null
+++ b/contrib/vty
@@ -0,0 +1,87 @@
+#!/usr/bin/expect -f
+
+# This expect script can be run as:
+# ./vty bsc
+# ./vty msc
+# ./vty sip ... etc
+# (no need to remember ports)
+#
+# One can edit the script itself to configure the preferred
+# logging configuration for each component.
+#
+# The last command to be issued will be logging filter all 1
+# This allows for easy recall and issuing of
+# 'logging filter all 0' to disable logging.
+# As an alternative one call call this script as
+# ./vty bsc 0 to disable logging on startup via the filter.
+#
+# Requires expect, available on most distributions.
+
+set host localhost
+set vty [lindex $argv 0]
+set lf [lindex $argv 1]
+if { $lf < 0 } { set lf 1 }
+set host localhost
+
+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 }
+ gg    { set port 4260 }
+ ggsn  { set port 4260 }
+ hnbgw { set port 4261 }
+
+ osmo-hlr           { set port 4258 } ; # Same but with full names of osmo-daemons:
+ osmo-bsc           { set port 4242 }
+ osmo-mgw           { set port 4243 }
+ osmo-mgw-for-bsc   { set port 4243 }
+ osmo-mgw-for-msc   {
+                     set host 127.0.0.2
+                     set port 4243
+                    }
+ osmo-sgsn          { set port 4245 }
+ osmo-msc           { set port 4254 }
+ osmo-sip-connector { set port 4256 }
+ osmo-ggsn          { set port 4260 }
+ osmo-hnbgw         { set port 4262 }
+ default            { set port 4242 } ; # Default to osmo-bsc / osmo-nitb
+}
+
+spawn -noecho telnet localhost $port
+expect ">"
+send "enable\r"
+expect "#"
+send "logging enable\r"
+expect "#"
+send "logging print category 1\r"
+expect "#"
+send "logging print category-hex 0\r"
+expect "#"
+send "logging print level 1\r"
+expect "#"
+send "logging print file basename last\r"
+expect "#"
+send "logging print extended-timestamp 1\r"
+expect "#"
+send "logging level set-all notice\r"
+expect "#"
+
+# Customise logging configuration per daemon here:
+switch $vty {
+ msc {
+  send "logging level mm info\r"
+  expect "#"
+  send "logging level cc info\r"
+  expect "#"
+ }
+}
+send "logging filter all $lf\r"
+expect "#"
+interact

-- 
To view, visit https://gerrit.osmocom.org/13756
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings

Gerrit-Project: libosmocore
Gerrit-Branch: master
Gerrit-MessageType: newchange
Gerrit-Change-Id: Ice4532be7cb3139da29cb9d84dd4769e8d826dfa
Gerrit-Change-Number: 13756
Gerrit-PatchSet: 1
Gerrit-Owner: Keith Whyte <keith at rhizomatica.org>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osmocom.org/pipermail/gerrit-log/attachments/20190423/4575d310/attachment.htm>


More information about the gerrit-log mailing list