From 5748b3f60f85c82fee5272ef902fc3d0ac2f3120 Mon Sep 17 00:00:00 2001 From: Daniel Willmann Date: Fri, 28 Sep 2018 17:38:56 +0200 Subject: osmo-cn-latest: Use osmo-config-merge to configure the MSC Change-Id: I6ccebf041d6e4fd3f9e1c6d898e2787b7de9ccca --- osmo-cn-latest/create_hlr.py | 18 +++++++++++++++++- osmo-cn-latest/osmo-msc.cfg | 30 ------------------------------ osmo-cn-latest/osmo-msc.cfg.base | 30 ++++++++++++++++++++++++++++++ 3 files changed, 47 insertions(+), 31 deletions(-) delete mode 100644 osmo-cn-latest/osmo-msc.cfg create mode 100644 osmo-cn-latest/osmo-msc.cfg.base diff --git a/osmo-cn-latest/create_hlr.py b/osmo-cn-latest/create_hlr.py index b754af7..0a625a9 100755 --- a/osmo-cn-latest/create_hlr.py +++ b/osmo-cn-latest/create_hlr.py @@ -1,5 +1,6 @@ #!/usr/bin/env python +import os, sys import csv import sys import sqlite3 @@ -127,7 +128,22 @@ def main(): infilename = args[0] csvfields = ['name', 'iccid', 'mcc', 'mnc', 'imsi', 'extension', 'smsp', 'ki', 'opc', 'adm1'] - create_hlr_3g("hlr.db") + try: + create_hlr_3g("hlr.db") + except sqlite3.OperationalError: + print("hlr.db already exists, please remove!\n"); + sys.exit(1) + + msc = open("osmo-msc.cfg.patch", "w") + msc.write("network\n") + msc.write(" network country code %s\n" %(options.mcc)) + msc.write(" mobile network code %s\n" %(options.mnc)) + msc.write(" short name OsmoMSC-%s-%s\n" %(options.mcc, options.mnc)) + msc.write(" long name OsmoMSC-%s-%s\n" %(options.mcc, options.mnc)) + msc.close() + + os.system("osmo-config-merge osmo-msc.cfg.base osmo-msc.cfg.patch > osmo-msc.cfg") + inf = open(infilename, "r") outf = open("simcards.csv", "w") diff --git a/osmo-cn-latest/osmo-msc.cfg b/osmo-cn-latest/osmo-msc.cfg deleted file mode 100644 index 8924d1e..0000000 --- a/osmo-cn-latest/osmo-msc.cfg +++ /dev/null @@ -1,30 +0,0 @@ -! -! OsmoMSC configuration saved from vty -! -log file /data/osmo-msc.log - logging filter all 1 - logging color 1 - logging print category 1 - logging timestamp 0 - logging level all everything -! -line vty - no login - bind 0.0.0.0 -! -cs7 instance 0 - asp asp-clnt-OsmoMSC-A-Iu 2905 2904 m3ua - remote-ip 192.168.42.10 -network - network country code 901 - mobile network code 1 - short name OsmoMSC - long name OsmoMSC - encryption a5 0 - rrlp mode none - mm info 1 -msc - mgw remote-ip 127.0.0.1 - assign-tmsi - auth-tuple-max-reuse-count 3 - auth-tuple-reuse-on-error 1 diff --git a/osmo-cn-latest/osmo-msc.cfg.base b/osmo-cn-latest/osmo-msc.cfg.base new file mode 100644 index 0000000..042d847 --- /dev/null +++ b/osmo-cn-latest/osmo-msc.cfg.base @@ -0,0 +1,30 @@ +! +! OsmoMSC configuration saved from vty +! +log file /data/osmo-msc.log + logging filter all 1 + logging color 1 + logging print category 1 + logging timestamp 0 + logging level all everything +! +line vty + no login + bind 0.0.0.0 +! +cs7 instance 0 + asp asp-clnt-OsmoMSC-A-Iu 2905 2904 m3ua + remote-ip 192.168.42.10 +network + network country code 901 + mobile network code 1 + short name OsmoMSC + long name OsmoMSC + encryption a5 0 + rrlp mode none + mm info 1 +msc + mgw remote-ip 127.0.0.1 + assign-tmsi + auth-tuple-max-reuse-count 3 + auth-tuple-reuse-on-error 1 -- cgit v1.2.3