add virt-nitb 1/2: initial file copies

Change-Id: Id275a42ca688499e576f3128b5b88355d70db3a2
This commit is contained in:
Neels Hofmeyr 2022-08-29 02:27:38 +02:00
parent ece7ff4d72
commit 5a2efc5f7c
9 changed files with 803 additions and 0 deletions

94
virt-nitb/mobile.cfg Normal file
View File

@ -0,0 +1,94 @@
log stderr
logging filter all 1
logging print file basename
logging print category-hex 0
logging print category 1
logging print level 1
logging timestamp 0
logging color 1
!
logging level set-all notice
logging level lglobal info
logging level lsms info
logging level rsl notice
logging level rr debug
logging level plmn debug
logging level cs debug
logging level nb notice
logging level mm debug
logging level cc debug
logging level ss debug
logging level sms debug
logging level mncc debug
logging level meas debug
logging level pag debug
logging level l1c error
logging level sap debug
logging level sum debug
logging level sim debug
logging level gps debug
logging level mob debug
logging level prim debug
logging level lua debug
!
line vty
no login
!
!gps host localhost:2947
!gps device /dev/ttyACM0
!gps baudrate default
no gps enable
!
no hide-default
!
ms 1
layer2-socket /tmp/osmocom_l2.mobile
sap-socket /tmp/osmocom_sap
sim test
network-selection-mode auto
imei 350608603062429 0
imei-fixed
no emergency-imsi
! sms-service-center +491722270333
no call-waiting
no auto-answer
no force-rekey
no clip
no clir
tx-power auto
no simulated-delay
! stick 791
location-updating
no neighbour-measurement
codec full-speed prefer
codec half-speed
no abbrev
support
sms
a5/1
no a5/2
p-gsm
e-gsm
r-gsm
no gsm-850
dcs
no pcs
class-900 4
class-850 4
class-dcs 1
class-pcs 1
channel-capability sdcch+tchf
full-speech-v1
full-speech-v2
half-speech-v1
min-rxlev -106
dsc-max 90
no skip-max-per-band
test-sim
imsi 901700000000001
ki comp128 ca 7c 00 11 22 33 44 55 66 77 88 99 aa bb cc dd
no barred-access
rplmn 901 70
hplmn-search everywhere
c7-any-timeout 30
no shutdown

194
virt-nitb/osmo-bsc.cfg Normal file
View File

@ -0,0 +1,194 @@
# DO NET EDIT THIS FILE DIRECTLY!
# This is generated from templates, and manual edits will be overwritten.
stats interval 5
!
stats reporter statsd
disable
remote-ip 127.0.0.1
remote-port 9125
level global
no prefix
enable
!
line vty
no login
!
e1_input
e1_line 0 driver ipa
e1_line 0 port 0
no e1_line 0 keepalive
ipa bind 127.0.0.3
cs7 instance 0
point-code 0.23.3
asp asp-clnt-msc-0 2905 0 m3ua
network
network country code 001
mobile network code 01
encryption a5 1
neci 1
paging any use tch 0
handover 0
periodic location update 12
meas-feed destination 127.0.0.1 8888
bts 0
description my test BTS 0
type sysmobts
band GSM-1800
ip.access unit_id 0 0
location_area_code 23
cell_identity 0
base_station_id_code 0
codec-support fr amr
amr tch-f modes 3
amr tch-f start-mode 3
amr tch-h modes 3
amr tch-h start-mode 3
gprs mode gprs
gprs nsvc 0 remote ip 127.0.0.3
gprs nsvc 0 remote udp port 23000
gprs nsvc 0 local udp port 23000
gprs nsvc 0 nsvci 0
gprs nsei 0
gprs cell bvci 1000
trx 0
arfcn 512
description my test BTS 0
rf_locked 0
nominal power 23
max_power_red 22
timeslot 0
phys_chan_config CCCH+SDCCH4
timeslot 1
phys_chan_config SDCCH8
timeslot 2
phys_chan_config TCH/H
timeslot 3
phys_chan_config TCH/H
timeslot 4
phys_chan_config TCH/H
timeslot 5
phys_chan_config TCH/H
timeslot 6
phys_chan_config TCH/H
timeslot 7
phys_chan_config PDCH
bts 1
description my test BTS 1
type sysmobts
band GSM-1800
ip.access unit_id 1 0
location_area_code 23
cell_identity 1
base_station_id_code 1
codec-support fr amr
amr tch-f modes 3
amr tch-f start-mode 3
amr tch-h modes 3
amr tch-h start-mode 3
gprs mode gprs
gprs nsvc 0 remote ip 127.0.0.3
gprs nsvc 0 remote udp port 7777
gprs nsvc 0 local udp port 23000
gprs nsvc 0 nsvci 1
gprs nsei 1
gprs cell bvci 1001
trx 0
arfcn 514
description my test BTS 1
rf_locked 0
nominal power 23
max_power_red 22
timeslot 0
phys_chan_config CCCH+SDCCH4
timeslot 1
phys_chan_config SDCCH8
timeslot 2
phys_chan_config TCH/H
timeslot 3
phys_chan_config TCH/H
timeslot 4
phys_chan_config TCH/H
timeslot 5
phys_chan_config TCH/H
timeslot 6
phys_chan_config TCH/H
timeslot 7
phys_chan_config PDCH
msc 0
mgw remote-ip 127.0.0.3
mgw remote-port 2427
mgw endpoint-domain bsc
allow-emergency deny
codec-list hr3
amr-config 12_2k forbidden
amr-config 10_2k forbidden
amr-config 7_95k forbidden
amr-config 7_40k forbidden
amr-config 6_70k allowed
amr-config 5_90k allowed
amr-config 5_15k forbidden
amr-config 4_75k forbidden
log stderr
logging filter all 1
logging color 1
logging print level 1
logging print category 1
logging print category-hex 0
logging print file basename last
logging print extended-timestamp 1
logging level set-all debug
logging level hodec info
logging level ho info
logging level nm info
logging level meas info
logging level lmi info
logging level linp notice
logging level lss7 notice
logging level lsccp notice
logging level lsua notice
logging level lm3ua notice
log file current_log/osmo-bsc.log
logging filter all 1
logging color 1
logging print level 1
logging print category 1
logging print category-hex 0
logging print file basename last
logging print extended-timestamp 1
logging level set-all debug
logging level hodec info
logging level ho info
logging level nm info
logging level meas info
logging level lmi info
logging level linp notice
logging level lss7 notice
logging level lsccp notice
logging level lsua notice
logging level lm3ua notice
log gsmtap 127.0.0.9
logging filter all 1
logging color 1
logging print level 1
logging print category 1
logging print category-hex 0
logging print file basename last
logging print extended-timestamp 1
logging level set-all debug
logging level hodec info
logging level ho info
logging level nm info
logging level meas info
logging level lmi info
logging level linp notice
logging level lss7 notice
logging level lsccp notice
logging level lsua notice
logging level lm3ua notice

View File

@ -0,0 +1,60 @@
!
! OsmoBTS (0.4.0.216-bc49-dirty) configuration saved from vty
!!
!
log stderr
logging filter all 1
logging color 0
logging print category 1
logging timestamp 0
logging level rsl info
logging level oml info
logging level rll notice
logging level rr notice
logging level meas notice
logging level pag info
logging level l1c info
logging level l1p info
logging level dsp error
logging level pcu notice
logging level ho debug
logging level trx notice
logging level loop notice
logging level abis debug
logging level rtp notice
logging level sum error
logging level lglobal notice
logging level llapd notice
logging level linp notice
logging level lmux notice
logging level lmi notice
logging level lmib notice
logging level lsms notice
logging level lctrl notice
logging level lgtp notice
logging level lstats error
!
line vty
no login
!
e1_input
e1_line 0 driver ipa
e1_line 0 port 0
no e1_line 0 keepalive
phy 0
instance 0
bts 0
band DCS1800
ipa unit-id 6969 0
oml remote-ip 127.0.0.1
rtp jitter-buffer 100
paging queue-size 200
paging lifetime 0
min-qual-rach 50
min-qual-norm -5
trx 0
power-ramp max-initial 23000 mdBm
power-ramp step-size 2000 mdB
power-ramp step-interval 1
ms-power-control osmo
phy 0 instance 0

28
virt-nitb/osmo-hlr.cfg Normal file
View File

@ -0,0 +1,28 @@
hlr
gsup
bind ip 127.0.0.5
ussd route prefix *0# internal own-msisdn
ussd route prefix *1# internal own-imsi
ussd route prefix *#100# internal own-msisdn
ussd route prefix *#101# internal own-imsi
store-imei
log stderr
logging filter all 1
logging color 1
logging print level 1
logging print category 1
logging print category-hex 0
logging print file basename last
logging print extended-timestamp 1
logging level set-all debug
log gsmtap 127.0.0.9
logging filter all 1
logging color 1
logging print level 1
logging print category 1
logging print category-hex 0
logging print file basename last
logging print extended-timestamp 1
logging level set-all debug

View File

@ -0,0 +1,48 @@
# DO NET EDIT THIS FILE DIRECTLY!
# This is generated from templates, and manual edits will be overwritten.
mgcp
domain bsc
bind ip 127.0.0.3
bind port 2427
rtp net-range 50004 60000
number endpoints 1024
line vty
bind 127.0.0.7
log stderr
logging filter all 1
logging color 1
logging print level 1
logging print category 1
logging print category-hex 0
logging print file basename last
logging print extended-timestamp 1
logging level set-all debug
logging level rtp info
logging level lmgcp info
log file current_log/osmo-mgw-for-bsc.log
logging filter all 1
logging color 1
logging print level 1
logging print category 1
logging print category-hex 0
logging print file basename last
logging print extended-timestamp 1
logging level set-all debug
logging level rtp info
logging level lmgcp info
log gsmtap 127.0.0.9
logging filter all 1
logging color 1
logging print level 1
logging print category 1
logging print category-hex 0
logging print file basename last
logging print extended-timestamp 1
logging level set-all debug
logging level rtp info
logging level lmgcp info

View File

@ -0,0 +1,48 @@
# DO NET EDIT THIS FILE DIRECTLY!
# This is generated from templates, and manual edits will be overwritten.
mgcp
domain msc
bind ip 127.0.0.4
bind port 2427
rtp net-range 50004 60000
number endpoints 1024
line vty
bind 127.0.0.6
log stderr
logging filter all 1
logging color 1
logging print level 1
logging print category 1
logging print category-hex 0
logging print file basename last
logging print extended-timestamp 1
logging level set-all debug
logging level rtp info
logging level lmgcp info
log file current_log/osmo-mgw-for-msc.log
logging filter all 1
logging color 1
logging print level 1
logging print category 1
logging print category-hex 0
logging print file basename last
logging print extended-timestamp 1
logging level set-all debug
logging level rtp info
logging level lmgcp info
log gsmtap 127.0.0.9
logging filter all 1
logging color 1
logging print level 1
logging print category 1
logging print category-hex 0
logging print file basename last
logging print extended-timestamp 1
logging level set-all debug
logging level rtp info
logging level lmgcp info

75
virt-nitb/osmo-msc.cfg Normal file
View File

@ -0,0 +1,75 @@
# DO NET EDIT THIS FILE DIRECTLY!
# This is generated from templates, and manual edits will be overwritten.
network
network country code 001
mobile network code 01
authentication required
encryption a5 1
short name 35c3
long name 35c3
mm info 1
msc
mncc internal
mgw remote-ip 127.0.0.4
mgw remote-port 2427
mgw endpoint-domain msc
check-imei-rqd 1
# For nano3G:
iu rab-assign-addr-enc x213
mncc-int
default-codec tch-f fr
default-codec tch-h amr
smpp
local-tcp-ip 127.0.0.1 2775
system-id test-msc
policy closed
no smpp-first
hlr
remote-ip 127.0.0.5
log stderr
logging filter all 1
logging color 1
logging print level 1
logging print category 1
logging print category-hex 0
logging print file basename last
logging print extended-timestamp 1
logging level set-all debug
logging level linp notice
logging level lss7 notice
logging level lsccp notice
logging level lsua notice
logging level lm3ua notice
log file current_log/osmo-msc.log
logging filter all 1
logging color 1
logging print level 1
logging print category 1
logging print category-hex 0
logging print file basename last
logging print extended-timestamp 1
logging level set-all debug
logging level linp notice
logging level lss7 notice
logging level lsccp notice
logging level lsua notice
logging level lm3ua notice
log gsmtap 127.0.0.9
logging filter all 1
logging color 1
logging print level 1
logging print category 1
logging print category-hex 0
logging print file basename last
logging print extended-timestamp 1
logging level set-all debug
logging level linp notice
logging level lss7 notice
logging level lsccp notice
logging level lsua notice
logging level lm3ua notice

53
virt-nitb/osmo-stp.cfg Normal file
View File

@ -0,0 +1,53 @@
# DO NET EDIT THIS FILE DIRECTLY!
# This is generated from templates, and manual edits will be overwritten.
cs7 instance 0
xua rkm routing-key-allocation dynamic-permitted
listen m3ua 2905
accept-asp-connections dynamic-permitted
log stderr
logging filter all 1
logging color 1
logging print level 1
logging print category 1
logging print category-hex 0
logging print file basename last
logging print extended-timestamp 1
logging level set-all debug
logging level linp notice
logging level lss7 notice
logging level lsccp notice
logging level lsua notice
logging level lm3ua notice
log file current_log/osmo-stp.log
logging filter all 1
logging color 1
logging print level 1
logging print category 1
logging print category-hex 0
logging print file basename last
logging print extended-timestamp 1
logging level set-all debug
logging level linp notice
logging level lss7 notice
logging level lsccp notice
logging level lsua notice
logging level lm3ua notice
log gsmtap 127.0.0.9
logging filter all 1
logging color 1
logging print level 1
logging print category 1
logging print category-hex 0
logging print file basename last
logging print extended-timestamp 1
logging level set-all debug
logging level linp notice
logging level lss7 notice
logging level lsccp notice
logging level lsua notice
logging level lm3ua notice

203
virt-nitb/run.sh Executable file
View File

@ -0,0 +1,203 @@
#!/usr/bin/env bash
if ! ../fill_config.py --check-stale; then
echo
echo "WARNING: STALE CONFIGS - your net configs are older than the templates they should be based on!"
echo " * Hit enter to continue, and use the stale config files"
echo " * Hit ^C and run 'make regen' to regenerate your configs"
read enter_to_continue
fi
dev="eth0"
apn="apn0"
sudo true || exit 1
if [ -z "$(sudo iptables -L -t nat | grep MASQUERADE)" ]; then
sudo iptables -t nat -A POSTROUTING -s 192.168.42.0/24 -o $dev -j MASQUERADE
fi
if [ "$(sudo cat /proc/sys/net/ipv4/ip_forward)" = "0" ]; then
sudo sh -c "echo 1 > /proc/sys/net/ipv4/ip_forward"
fi
if [ -z "$(ip tuntap show | grep $apn)" ]; then
sudo ip tuntap add dev $apn mode tun user $USER group $USER
sudo ip addr add 192.168.42.0/24 dev $apn
sudo ip link set $apn up
fi
if [ -z "$(ip addr show | grep "127.0.0.3")" ]; then
echo "No interface has IP address 127.0.0.3! Hit enter to continue anyway."
read enter_to_continue
fi
if [ -z "$(ip addr show | grep "127.0.0.4")" ]; then
echo "No interface has IP address 127.0.0.4! Hit enter to 'ip addr add 127.0.0.4/32 dev $dev'"
read enter_to_continue
sudo ip addr add 127.0.0.4/32 dev $dev
fi
logdir="current_log"
mkdir -p "$logdir"
find_term() {
# Find a terminal program and write to the global "terminal" variable
local programs="urxvt xterm"
local program
for program in $programs; do
terminal="$(which $program)"
[ -n "$terminal" ] && return
done
# No terminal found
echo "ERROR: Couldn't find terminal program! Looked for: $programs"
exit 1
}
term() {
title="$2"
if [ -z "$title" ]; then
title="$(basename $@)"
fi
exec $terminal -title "CN:$title" -e sh -c "export LD_LIBRARY_PATH='/usr/local/lib'; $1; echo; while true; do echo 'q Enter to close'; read q_to_close; if [ \"x\$q_to_close\" = xq ]; then break; fi; done"
}
find_term
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"
mgw4msc="osmo-mgw -c osmo-mgw-for-msc.cfg"
#mgw4bsc="gdb -ex run --args osmo-mgw -c osmo-mgw-for-bsc.cfg"
#mgw4bsc="strace osmo-mgw -c osmo-mgw-for-bsc.cfg"
mgw4bsc="osmo-mgw -c osmo-mgw-for-bsc.cfg"
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 -c osmo-bsc.cfg"
if [ "xinternal" != "xinternal" ]; then
sipcon="osmo-sip-connector -c osmo-sip-connector.cfg"
case "kamailio" in
"kamailio")
# Require kamailio (PATH hack is needed for Debian)
kamailio="$(PATH="$PATH:/usr/sbin:/sbin" which kamailio)"
if [ -z "$kamailio" ]; then
echo "ERROR: kamailio is not installed."
echo "After installing it, make sure that it does *not* run as daemon."
exit 1
fi
kamailio="$kamailio -f kamailio.cfg -D -e -E"
;;
"freeswitch")
if [ -z "$(which freeswitch)" ]; then
echo "ERROR: freeswitch is not installed."
echo "Guide: https://freeswitch.org/confluence/display/FREESWITCH/Debian+10+Buster"
echo "After installing it, make sure that it does *not* run as daemon."
exit 1
fi
;;
"none")
;;
*)
echo "ERROR: unknown value kamailio for SIPCON_SERVER!"
exit 1
;;
esac
fi
sudo tcpdump -i $dev -n -w current_log/$dev.single.pcap -U not port 22 &
sudo tcpdump -i lo -n -w current_log/lo.single.pcap -U not port 22 &
term "$ggsn" GGSN &
sleep .2
term "$stp" STP &
sleep .2
term "$hlr" HLR &
sleep .2
term "$sgsn" SGSN &
sleep .2
term "$gbproxy" GBPROXY &
sleep .2
term "$mgw4msc" MGW4MSC &
sleep .2
term "$mgw4bsc" MGW4BSC &
sleep .2
term "$msc" MSC &
sleep 2
term "$hnbgw" HNBGW &
sleep .2
term "$bsc" BSC &
if [ "xinternal" != "xinternal" ]; then
sleep .2
term "$sipcon" SIPCON &
sleep .2
case "kamailio" in
"kamailio") term "$kamailio" KAMAILIO &;;
"freeswitch") term "./freeswitch/freeswitch.sh" FREESWITCH &;;
esac
fi
#ssh bts rm /tmp/bts.log /tmp/pcu.log
#ssh bts neels/run_remote.sh &
echo enter to close
read enter_to_close
echo Closing...
#ssh bts neels/stop_remote.sh
kill %1 %2 %3 %4 %5 %6 %7 %8 %9 %10 %11 %12 %13 %14
killall osmo-msc
killall osmo-bsc
killall osmo-gbproxy
killall osmo-sgsn
#killall osmo-hnbgw
killall osmo-mgw
killall osmo-hlr
killall -9 osmo-stp
sudo killall tcpdump
killall osmo-ggsn
if [ "xinternal" != "xinternal" ]; then
# 'killall' seems to work only with the shortened name
killall osmo-sip-connec
killall "kamailio"
fi
set +e
cp *.cfg "$logdir"/
echo
echo enter name to save log
read log_name
if [ -n "$log_name" ]; then
newlogdir="log/$log_name"
#scp "bts:/tmp/{bts,pcu}.log" "bts:neels/osmo-{bts,pcu}.cfg" "$logdir"
else
newlogdir="autolog/log_$(date +%Y-%m-%d_%H-%M-%S)"
fi
mkdir -p "$(dirname "$newlogdir")"
mergecap -w "$logdir/trace.pcap" "$logdir/"*.single.pcap && rm -f "$logdir/"*.single.pcap
if [ -x "$newlogdir" ]; then
echo "already exists, move it manually: $newlogdir"
else
echo mv "$logdir" "$newlogdir"
mv "$logdir" "$newlogdir"
mkdir -p "$logdir"
logdir="$newlogdir"
fi
rm lastlog
ln -s "$logdir" lastlog