aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorOliver Smith <osmith@sysmocom.de>2021-12-14 16:27:10 +0100
committerosmith <osmith@sysmocom.de>2022-01-17 09:11:55 +0000
commita3a1a0d94a52f4c7bb566004be21fce9e6850143 (patch)
tree7b9cb00aad07aac43821e10c237c79bb4336040e
parent8fd5098f3f725c5b6119b8b4e86c63ade37d7f8b (diff)
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
-rw-r--r--net/config_2g3g12
-rw-r--r--net/templates/osmo-bsc-nat.cfg21
-rw-r--r--net/templates/osmo-bsc.cfg3
-rw-r--r--net/templates/osmo-msc.cfg4
-rw-r--r--net/templates/osmo-stp-cn.cfg24
-rw-r--r--net/templates/osmo-stp-ran.cfg (renamed from net/templates/osmo-stp.cfg)8
-rwxr-xr-xnet/templates/run.sh25
7 files changed, 92 insertions, 5 deletions
diff --git a/net/config_2g3g b/net/config_2g3g
index 263629f..c1498be 100644
--- a/net/config_2g3g
+++ b/net/config_2g3g
@@ -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
diff --git a/net/templates/osmo-bsc-nat.cfg b/net/templates/osmo-bsc-nat.cfg
new file mode 100644
index 0000000..c9a71da
--- /dev/null
+++ b/net/templates/osmo-bsc-nat.cfg
@@ -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}
diff --git a/net/templates/osmo-bsc.cfg b/net/templates/osmo-bsc.cfg
index ab10a81..98f4e0c 100644
--- a/net/templates/osmo-bsc.cfg
+++ b/net/templates/osmo-bsc.cfg
@@ -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}
diff --git a/net/templates/osmo-msc.cfg b/net/templates/osmo-msc.cfg
index 00bf182..c018c78 100644
--- a/net/templates/osmo-msc.cfg
+++ b/net/templates/osmo-msc.cfg
@@ -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}
diff --git a/net/templates/osmo-stp-cn.cfg b/net/templates/osmo-stp-cn.cfg
new file mode 100644
index 0000000..c84168c
--- /dev/null
+++ b/net/templates/osmo-stp-cn.cfg
@@ -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}
diff --git a/net/templates/osmo-stp.cfg b/net/templates/osmo-stp-ran.cfg
index d7d1515..c753108 100644
--- a/net/templates/osmo-stp.cfg
+++ b/net/templates/osmo-stp-ran.cfg
@@ -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}
diff --git a/net/templates/run.sh b/net/templates/run.sh
index cd0fc72..311cdd9 100755
--- a/net/templates/run.sh
+++ b/net/templates/run.sh
@@ -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