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

Keith Whyte gerrit-no-reply at lists.osmocom.org
Wed May 8 22:53:43 UTC 2019


Keith Whyte has submitted this change and it was merged. ( 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(-)

Approvals:
  Harald Welte: Looks good to me, but someone else must approve
  Daniel Willmann: Looks good to me, approved
  Pau Espin Pedrol: Looks good to me, but someone else must approve
  Mykola Shchetinin: Looks good to me, but someone else must approve
  Jenkins Builder: Verified



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: merged
Gerrit-Change-Id: Ice4532be7cb3139da29cb9d84dd4769e8d826dfa
Gerrit-Change-Number: 13756
Gerrit-PatchSet: 2
Gerrit-Owner: Keith Whyte <keith at rhizomatica.org>
Gerrit-Reviewer: Daniel Willmann <dwillmann at sysmocom.de>
Gerrit-Reviewer: Harald Welte <laforge at gnumonks.org>
Gerrit-Reviewer: Jenkins Builder (1000002)
Gerrit-Reviewer: Keith Whyte <keith at rhizomatica.org>
Gerrit-Reviewer: Mykola Shchetinin <mykola at pentonet.com>
Gerrit-Reviewer: Pau Espin Pedrol <pespin at sysmocom.de>
Gerrit-CC: Vadim Yanitskiy <axilirator at gmail.com>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osmocom.org/pipermail/gerrit-log/attachments/20190508/184b168a/attachment.html>


More information about the gerrit-log mailing list