Change in osmo-dev[master]: net: add osmo-bsc-nat

This is merely a historical archive of years 2008-2021, before the migration to mailman3.

A maintained and still updated list archive can be found at https://lists.osmocom.org/hyperkitty/list/gerrit-log@lists.osmocom.org/.

osmith gerrit-no-reply at lists.osmocom.org
Tue Dec 21 19:57:47 UTC 2021


osmith has uploaded this change for review. ( https://gerrit.osmocom.org/c/osmo-dev/+/26668 )


Change subject: net: add osmo-bsc-nat
......................................................................

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
---
M net/config_2g3g
A net/templates/osmo-bsc-nat.cfg
M net/templates/osmo-bsc.cfg
M net/templates/osmo-msc.cfg
A net/templates/osmo-stp-cn.cfg
R net/templates/osmo-stp-ran.cfg
M net/templates/run.sh
7 files changed, 92 insertions(+), 5 deletions(-)



  git pull ssh://gerrit.osmocom.org:29418/osmo-dev refs/changes/68/26668/1

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 @@
 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 @@
  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
similarity index 70%
rename from net/templates/osmo-stp.cfg
rename to 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 @@
 #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 @@
 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 -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

-- 
To view, visit https://gerrit.osmocom.org/c/osmo-dev/+/26668
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings

Gerrit-Project: osmo-dev
Gerrit-Branch: master
Gerrit-Change-Id: I8bfbd00bfeeebc6e1b87a8cd6333212db4380653
Gerrit-Change-Number: 26668
Gerrit-PatchSet: 1
Gerrit-Owner: osmith <osmith at sysmocom.de>
Gerrit-MessageType: newchange
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osmocom.org/pipermail/gerrit-log/attachments/20211221/2449c6ce/attachment.htm>


More information about the gerrit-log mailing list