net: add osmo-bsc-nat

Make STP_CN_IP and STP_RAN_IP configurable. If they are not set to the
same IP, run a second OsmoSTP and OsmoBSCNAT to connect both OsmoSTP.

Related: OS#2545
Change-Id: I8bfbd00bfeeebc6e1b87a8cd6333212db4380653
This commit is contained in:
Oliver Smith 2021-12-14 16:27:10 +01:00 committed by osmith
parent 8fd5098f3f
commit a3a1a0d94a
7 changed files with 92 additions and 5 deletions

View File

@ -109,6 +109,18 @@ GGSN_GTP_STATE_DIR=/tmp
SIPCON_SIP="${TO_SIP_IP}"
SIPCON_SIP_PORT="5060"
STP_CN_IP="127.0.0.1"
STP_RAN_IP="127.0.0.1"
# Set STP_CN_IP different from STP_RAN_IP, to run a second OsmoSTP and
# OsmoBSCNAT to connect both
# STP_RAN_IP="127.0.0.2"
# Enabled only when STP_CN_IP != STP_RAN_IP
BSCNAT_CN_PC="${BSC_PC}"
BSCNAT_CN_IP="127.0.0.3"
BSCNAT_RAN_PC="${MSC_PC}"
BSCNAT_RAN_IP="127.0.0.4"
# PBX_SERVER:
# "kamailio" -- launch kamailio
# "freeswitch" -- launch freeswitch

View File

@ -0,0 +1,21 @@
${include(common_template_warning)}
cs7 instance 0
point-code ${BSCNAT_CN_PC}
asp asp-clnt-OsmoBSCNAT-CN 2905 0 m3ua
remote-ip ${STP_CN_IP}
local-ip ${BSCNAT_CN_IP}
cs7 instance 1
point-code ${BSCNAT_RAN_PC}
asp asp-clnt-OsmoBSCNAT-RAN 2905 0 m3ua
remote-ip ${STP_RAN_IP}
local-ip ${BSCNAT_RAN_IP}
bsc-nat
cs7-instance-cn 0
cs7-instance-ran 1
${foreach(LOG_OUTPUT)}
log ${LOG_OUTPUTn_TYPE}
${include(common_logging)}
${foreach_end}

View File

@ -19,7 +19,8 @@ e1_input
ipa bind ${BSC_IP}
cs7 instance 0
point-code ${BSC_PC}
asp asp-clnt-msc-0 2905 0 m3ua
asp asp-clnt-bsc-0 2905 0 m3ua
remote-ip ${STP_RAN_IP}
network
network country code ${MCC}
mobile network code ${MNC}

View File

@ -1,4 +1,8 @@
${include(common_template_warning)}
cs7 instance 0
point-code ${MSC_PC}
asp asp-clnt-msc-0 2905 0 m3ua
remote-ip ${STP_CN_IP}
network
network country code ${MCC}
mobile network code ${MNC}

View File

@ -0,0 +1,24 @@
${include(common_template_warning)}
# By default, osmo-dev starts one osmo-stp with this config. If STP_CN_IP and
# STP_RAN_IP are changed to be different, osmo-dev starts two osmo-stp, one
# with this config and another one with osmo-stp-ran.cfg.
line vty
bind ${STP_CN_IP}
cs7 instance 0
xua rkm routing-key-allocation dynamic-permitted
listen m3ua 2905
accept-asp-connections dynamic-permitted
local-ip ${STP_CN_IP}
${foreach(LOG_OUTPUT)}
log ${LOG_OUTPUTn_TYPE}
${include(common_logging)}
logging level linp notice
logging level lss7 notice
logging level lsccp notice
logging level lsua notice
logging level lm3ua notice
${foreach_end}

View File

@ -1,8 +1,16 @@
${include(common_template_warning)}
# This file does not get used by default, only if STP_CN_IP and STP_RAN_IP are
# changed to be different!
line vty
bind ${STP_RAN_IP}
cs7 instance 0
xua rkm routing-key-allocation dynamic-permitted
listen m3ua 2905
accept-asp-connections dynamic-permitted
local-ip ${STP_RAN_IP}
${foreach(LOG_OUTPUT)}
log ${LOG_OUTPUTn_TYPE}

View File

@ -81,8 +81,10 @@ mgw4msc="osmo-mgw -c osmo-mgw-for-msc.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"
stp4cn="osmo-stp -c osmo-stp-cn.cfg"
stp4ran="osmo-stp -c osmo-stp-ran.cfg"
bsc="LD_LIBRARY_PATH=/usr/local/lib gdb -ex run --args osmo-bsc -c osmo-bsc.cfg"
bscnat="osmo-bsc-nat"
if [ "x${MSC_MNCC}" != "xinternal" ]; then
sipcon="osmo-sip-connector -c osmo-sip-connector.cfg"
@ -123,9 +125,23 @@ PIDS=""
term "$ggsn" GGSN &
PIDS="$PIDS $!"
sleep .2
term "$stp" STP &
PIDS="$PIDS $!"
if [ "${STP_CN_IP}" = "${STP_RAN_IP}" ]; then
sleep .2
term "$stp4cn" STP &
PIDS="$PIDS $!"
else
sleep .2
term "$stp4cn" STP4CN &
PIDS="$PIDS $!"
sleep .2
term "$stp4ran" STP4RAN &
PIDS="$PIDS $!"
sleep .2
term "$bscnat" BSCNAT &
PIDS="$PIDS $!"
fi
sleep .2
term "$hlr" HLR &
@ -199,6 +215,7 @@ killall osmo-hlr
killall -9 osmo-stp
sudo killall tcpdump
killall osmo-ggsn
killall osmo-bsc-nat
if [ "x${MSC_MNCC}" != "xinternal" ]; then
# 'killall' seems to work only with the shortened name