summaryrefslogtreecommitdiffstats
path: root/contrib/vty
blob: 14c4336ab1717d263be04c6475e8b5f2a74cc137 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
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