mirror of https://gerrit.osmocom.org/osmo-dev
net: move cmds for network components to config
Instead of hardcoding wrappers such as gdb for various commands in run.sh, put all commands into a config file so the user can add gdb/valgrind/strace/udtrace/... to the program they are currently interested in debugging in their own config. Change-Id: Ifce731ab61d263e9df7a8dc87dd572ca3d30f8dd
This commit is contained in:
parent
bb0d4d3ebe
commit
ef92c180d7
25
net/README
25
net/README
|
@ -131,6 +131,31 @@ inside that session. Switch to the first window (^B + 0) and hit enter to close
|
||||||
all windows and the whole tmux session. This does work over SSH.
|
all windows and the whole tmux session. This does work over SSH.
|
||||||
|
|
||||||
|
|
||||||
|
=== Wrap commands in gdb, valgrind, udtrace etc.
|
||||||
|
|
||||||
|
During development it's useful to wrap Osmocom programs inside gdb, valgrind or
|
||||||
|
other tools. For each program where you want to do this, copy the CMD_ line
|
||||||
|
from config_2g3g to your config and adjust it accordingly.
|
||||||
|
|
||||||
|
==== Examples: gdb, valgrind, strace
|
||||||
|
|
||||||
|
CMD_MSC="LD_LIBRARY_PATH=/usr/local/lib gdb -ex run --args osmo-msc"
|
||||||
|
CMD_MSC="valgrind osmo-msc"
|
||||||
|
CMD_MSC="strace osmo-msc"
|
||||||
|
|
||||||
|
==== Example: udtrace
|
||||||
|
|
||||||
|
To use udtrace on the MNCC socket, use the following with an adjusted
|
||||||
|
/path/to/udtrace. Explanation of the enviornment variables:
|
||||||
|
- LD_LIBRARY_PATH allows linking to titan if udtrace was compiled with titan
|
||||||
|
support
|
||||||
|
- LD_PRELOAD of libasan allows building osmo-msc with the sanitize.opts
|
||||||
|
- the tee saves the stderr logging as well as the udtrace output to new file
|
||||||
|
current_log/osmo-msc.out, since udtrace will not show in osmo-msc.log
|
||||||
|
|
||||||
|
CMD_MSC="LD_LIBRARY_PATH=/usr/lib/titan LD_PRELOAD=/usr/lib/x86_64-linux-gnu/libasan.so.5:/path/to/udtrace/libudtrace.so osmo-msc 2>&1 | tee -a current_log/osmo-msc.out"
|
||||||
|
|
||||||
|
|
||||||
=== Logging and pcaps
|
=== Logging and pcaps
|
||||||
|
|
||||||
The run.sh script automatically stores all configs, logs and pcap traces in
|
The run.sh script automatically stores all configs, logs and pcap traces in
|
||||||
|
|
|
@ -167,3 +167,22 @@ PBX_LO_IP=127.0.0.8
|
||||||
LOG_OUTPUT0_TYPE=stderr
|
LOG_OUTPUT0_TYPE=stderr
|
||||||
LOG_OUTPUT1_TYPE=file current_log/${_name}.log
|
LOG_OUTPUT1_TYPE=file current_log/${_name}.log
|
||||||
LOG_OUTPUT2_TYPE=gsmtap 127.0.0.9
|
LOG_OUTPUT2_TYPE=gsmtap 127.0.0.9
|
||||||
|
|
||||||
|
# Commands to execute for various network components. In your config, you can
|
||||||
|
# wrap these in gdb, valgrind, strace, udtrace etc. See README for details.
|
||||||
|
CMD_BSC="osmo-bsc"
|
||||||
|
CMD_BSCNAT="osmo-bsc-nat"
|
||||||
|
CMD_BTS="osmo-bts-virtual"
|
||||||
|
CMD_FREESWITCH="./freeswitch/freeswitch.sh"
|
||||||
|
CMD_GBPROXY="osmo-gbproxy"
|
||||||
|
CMD_GGSN="osmo-ggsn"
|
||||||
|
CMD_HLR="osmo-hlr"
|
||||||
|
CMD_HNBGW="osmo-hnbgw"
|
||||||
|
CMD_KAMAILIO="kamailio"
|
||||||
|
CMD_MGW="osmo-mgw"
|
||||||
|
CMD_MS="mobile"
|
||||||
|
CMD_MSC="osmo-msc"
|
||||||
|
CMD_SGSN="osmo-sgsn"
|
||||||
|
CMD_SIPCON="osmo-sip-connector"
|
||||||
|
CMD_STP="osmo-stp"
|
||||||
|
CMD_VIRTPHY="virtphy"
|
||||||
|
|
|
@ -184,41 +184,15 @@ read_log_name() {
|
||||||
find_term
|
find_term
|
||||||
kill_pids
|
kill_pids
|
||||||
|
|
||||||
hnbgw="osmo-hnbgw"
|
|
||||||
msc="gdb -ex run --args $(which osmo-msc)"
|
|
||||||
# To enable udtrace on osmo-msc MNCC socket, use this with adjusted /path/to/udtrace:
|
|
||||||
# - LD_LIBRARY_PATH allows linking to titan if udtrace was compiled with titan support.
|
|
||||||
# - LD_PRELOAD of libasan allows building osmo-msc with the sanitize.opts.
|
|
||||||
# - the tee saves the stderr logging as well as the udtrace output to new file current_log/osmo-msc.out, since udtrace
|
|
||||||
# will not show in osmo-msc.log
|
|
||||||
#msc="LD_LIBRARY_PATH=/usr/lib/titan LD_PRELOAD=/usr/lib/x86_64-linux-gnu/libasan.so.5:/path/to/udtrace/libudtrace.so osmo-msc 2>&1 | tee -a current_log/osmo-msc.out"
|
|
||||||
gbproxy="osmo-gbproxy"
|
|
||||||
sgsn="osmo-sgsn"
|
|
||||||
ggsn="osmo-ggsn"
|
|
||||||
#mgw="gdb -ex run --args osmo-mgw"
|
|
||||||
#mgw="strace osmo-mgw"
|
|
||||||
mgw="osmo-mgw"
|
|
||||||
hlr="LD_LIBRARY_PATH=/usr/local/lib gdb -ex run --args osmo-hlr --db-upgrade"
|
|
||||||
stp="osmo-stp"
|
|
||||||
bsc="LD_LIBRARY_PATH=/usr/local/lib gdb -ex run --args osmo-bsc"
|
|
||||||
bscnat="osmo-bsc-nat"
|
|
||||||
bts="osmo-bts-virtual"
|
|
||||||
virtphy="virtphy -D lo"
|
|
||||||
ms="mobile -c mobile.cfg"
|
|
||||||
|
|
||||||
if [ "x${MSC_MNCC}" != "xinternal" ]; then
|
if [ "x${MSC_MNCC}" != "xinternal" ]; then
|
||||||
sipcon="osmo-sip-connector -c osmo-sip-connector.cfg"
|
|
||||||
|
|
||||||
case "${PBX_SERVER}" in
|
case "${PBX_SERVER}" in
|
||||||
"kamailio")
|
"kamailio")
|
||||||
# Require kamailio (PATH hack is needed for Debian)
|
# Require kamailio (PATH hack is needed for Debian)
|
||||||
kamailio="$(PATH="$PATH:/usr/sbin:/sbin" which kamailio)"
|
if [ -z "$(PATH="$PATH:/usr/sbin:/sbin" which kamailio)" ]; then
|
||||||
if [ -z "$kamailio" ]; then
|
|
||||||
echo "ERROR: kamailio is not installed."
|
echo "ERROR: kamailio is not installed."
|
||||||
echo "After installing it, make sure that it does *not* run as daemon."
|
echo "After installing it, make sure that it does *not* run as daemon."
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
kamailio="$kamailio -f kamailio.cfg -D -e -E"
|
|
||||||
;;
|
;;
|
||||||
"freeswitch")
|
"freeswitch")
|
||||||
if [ -z "$(which freeswitch)" ]; then
|
if [ -z "$(which freeswitch)" ]; then
|
||||||
|
@ -246,59 +220,59 @@ echo "$!" > "$PIDFILE_TCPDUMP_DEV"
|
||||||
sudo tcpdump -i lo -n -w current_log/lo.single.pcap -U not port 22 &
|
sudo tcpdump -i lo -n -w current_log/lo.single.pcap -U not port 22 &
|
||||||
echo "$!" > "$PIDFILE_TCPDUMP_LO"
|
echo "$!" > "$PIDFILE_TCPDUMP_LO"
|
||||||
|
|
||||||
term "$ggsn" GGSN
|
term "${CMD_GGSN}" GGSN
|
||||||
|
|
||||||
if [ "${STP_CN_IP}" = "${STP_RAN_IP}" ]; then
|
if [ "${STP_CN_IP}" = "${STP_RAN_IP}" ]; then
|
||||||
term "$stp -c osmo-stp-cn.cfg" STP
|
term "${CMD_STP} -c osmo-stp-cn.cfg" STP
|
||||||
else
|
else
|
||||||
term "$stp -c osmo-stp-cn.cfg" STP4CN
|
term "${CMD_STP} -c osmo-stp-cn.cfg" STP4CN
|
||||||
term "$stp -c osmo-stp-ran.cfg" STP4RAN
|
term "${CMD_STP} -c osmo-stp-ran.cfg" STP4RAN
|
||||||
term "$mgw -c osmo-mgw-for-bsc-nat.cfg" MGW4BSCNAT
|
term "${CMD_MGW} -c osmo-mgw-for-bsc-nat.cfg" MGW4BSCNAT
|
||||||
term "$bscnat" BSCNAT
|
term "${CMD_BSCNAT}" BSCNAT
|
||||||
fi
|
fi
|
||||||
|
|
||||||
term "$hlr" HLR
|
term "${CMD_HLR} --db-upgrade" HLR
|
||||||
term "$sgsn" SGSN
|
term "${CMD_SGSN}" SGSN
|
||||||
|
|
||||||
if [ "${GBPROXY_RUN_IN_OSMO_DEV}" = 1 ]; then
|
if [ "${GBPROXY_RUN_IN_OSMO_DEV}" = 1 ]; then
|
||||||
term "$gbproxy" GBPROXY
|
term "${CMD_GBPROXY}" GBPROXY
|
||||||
fi
|
fi
|
||||||
|
|
||||||
term "$mgw -c osmo-mgw-for-msc.cfg" MGW4MSC
|
term "${CMD_MGW} -c osmo-mgw-for-msc.cfg" MGW4MSC
|
||||||
term "$msc" MSC
|
term "${CMD_MSC}" MSC
|
||||||
term "$hnbgw" HNBGW
|
term "${CMD_HNBGW}" HNBGW
|
||||||
|
|
||||||
|
|
||||||
if [ "$BSC_COUNT" = 1 ]; then
|
if [ "$BSC_COUNT" = 1 ]; then
|
||||||
term "$mgw -c osmo-mgw-for-bsc-0.cfg" MGW4BSC
|
term "${CMD_MGW} -c osmo-mgw-for-bsc-0.cfg" MGW4BSC
|
||||||
term "$bsc -c osmo-bsc-0.cfg" BSC
|
term "${CMD_BSC} -c osmo-bsc-0.cfg" BSC
|
||||||
else
|
else
|
||||||
term "$mgw -c osmo-mgw-for-bsc-0.cfg" MGW4BSC0
|
term "${CMD_MGW} -c osmo-mgw-for-bsc-0.cfg" MGW4BSC0
|
||||||
term "$mgw -c osmo-mgw-for-bsc-1.cfg" MGW4BSC1
|
term "${CMD_MGW} -c osmo-mgw-for-bsc-1.cfg" MGW4BSC1
|
||||||
term "$bsc -c osmo-bsc-0.cfg" BSC0
|
term "${CMD_BSC} -c osmo-bsc-0.cfg" BSC0
|
||||||
term "$bsc -c osmo-bsc-1.cfg" BSC1
|
term "${CMD_BSC} -c osmo-bsc-1.cfg" BSC1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
${foreach(BTS)}
|
${foreach(BTS)}
|
||||||
if [ "${BTSn_RUN_IN_OSMO_DEV}" = 1 ]; then
|
if [ "${BTSn_RUN_IN_OSMO_DEV}" = 1 ]; then
|
||||||
term "$bts -c osmo-bts-${BTSn}.cfg" BTS${BTSn}
|
term "${CMD_BTS} -c osmo-bts-${BTSn}.cfg" BTS${BTSn}
|
||||||
fi
|
fi
|
||||||
${foreach_end}
|
${foreach_end}
|
||||||
|
|
||||||
if [ "${MS_RUN_IN_OSMO_DEV}" = 1 ]; then
|
if [ "${MS_RUN_IN_OSMO_DEV}" = 1 ]; then
|
||||||
term "$virtphy" VIRTPHY
|
term "${CMD_VIRTPHY} -D lo" VIRTPHY
|
||||||
term "$ms" MS
|
term "${CMD_MS} -c mobile.cfg" MS
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ "x${MSC_MNCC}" != "xinternal" ]; then
|
if [ "x${MSC_MNCC}" != "xinternal" ]; then
|
||||||
term "$sipcon" SIPCON
|
term "${CMD_SIPCON} -c osmo-sip-connector.cfg" SIPCON
|
||||||
|
|
||||||
case "${PBX_SERVER}" in
|
case "${PBX_SERVER}" in
|
||||||
"kamailio")
|
"kamailio")
|
||||||
term "$kamailio" KAMAILIO
|
term "${CMD_KAMAILIO} -f kamailio.cfg -D -e -E" KAMAILIO
|
||||||
;;
|
;;
|
||||||
"freeswitch")
|
"freeswitch")
|
||||||
term "./freeswitch/freeswitch.sh" FREESWITCH
|
term "${CMD_FREESWITCH}" FREESWITCH
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
fi
|
fi
|
||||||
|
|
Loading…
Reference in New Issue