Feature #4587
open
Add port numbers to /etc/services during installation
Added by laforge almost 4 years ago.
Updated almost 4 years ago.
Description
I think it would be great if we'd add the /etc/services
snippet from Port_Numbers to /etc/services during the installation. This enables people to do telnet localhost osm-msc
or the like, without having to memorize port numbers all the time.
It's a bit ugly as there is no /etc/services.d or the like, so we have to add/patch the services to the file.
In order to do that reasonable, the related postinst script should (for each service)
- check if the entry already exists, and do nothing if it does
- append the entry to the end of the file, if no entry exists yet
We could do this in bulk from libosmocore, or we could add/remove each individual line for each program we install from the respective osmo-* package.
The alternative would be to ship something like an 'osmo-telnet' client program that would have compile-time knowledge about the port numbers. As we already maintain a fork of libtelnet.git on osmocom.org, that may be an option...
Files
vty |
vty |
1.26 KB
|
'expect' script that connects to osmocom vty by name |
neels, 06/08/2020 10:25 AM
|
|
Related: Keith has written an expect script that connects to an osmocom telnet by name, and is also able to establish a desired logging config every time.
Attaching and pasting it. This one contains a few tweaks introduced at 36c3. We could rename to osmo-vty and install from libosmocore?
vty bsc
or
vty osmo-bsc
#!/usr/bin/expect -f
set vty [lindex $argv 0]
set host localhost
switch $vty {
hlr { set port 4258 }
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 }
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 }
}
spawn 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 "#"
switch $vty {
msc {
send "logging level mm info\r"
expect "#"
send "logging level cc info\r"
expect "#"
}
}
send "logging filter all 1\r"
expect "#"
interact
Also available in: Atom
PDF