From e5971a2375165fda8f9897b8c1019a42137bee09 Mon Sep 17 00:00:00 2001 From: Keith Whyte Date: Wed, 9 Jun 2021 01:29:01 +0200 Subject: [PATCH] Add LAC swapping for osmo-msc Make LAC config availble to the shell. Run a script on MSC restart to change the lac and write a state flag to disk. Due to the fact that osmo-msc may restart due to crash or power outage hence loosing all VLR state, force all UE to send a LUR by changing the LAC on all BTS via CTRL commands to osmo-bsc. --- modules/rhizo_base/files/bin/swap_lac.sh | 21 +++++++++++++++++++ .../files/systemd/osmo-msc.override | 1 + modules/rhizo_base/templates/vars.sh.erb | 2 ++ 3 files changed, 24 insertions(+) create mode 100755 modules/rhizo_base/files/bin/swap_lac.sh diff --git a/modules/rhizo_base/files/bin/swap_lac.sh b/modules/rhizo_base/files/bin/swap_lac.sh new file mode 100755 index 0000000..8c2ee47 --- /dev/null +++ b/modules/rhizo_base/files/bin/swap_lac.sh @@ -0,0 +1,21 @@ +#!/bin/bash + +. /home/rhizomatica/bin/vars.sh + +_ALT_LAC="" +if [ -f /etc/osmocom/alt_lac ]; then + _ALT_LAC=$(cat /etc/osmocom/alt_lac) +fi + +if [ "$_ALT_LAC" == "" ]; then + _ALT_LAC=1 +else + _ALT_LAC="" +fi +echo $_ALT_LAC > /etc/osmocom/alt_lac +/bin/sync +for bts in "${!BTS[@]}" ; do + echo "BTS $bts:" + /usr/bin/osmo_ctrl.py -d 127.0.0.1 -p 4249 -s bts.$bts.location-area-code $_ALT_LAC${LAC[$bts]} + /usr/bin/osmo_ctrl.py -d 0 -p 4249 -s bts.$bts.send-new-system-informations 1 +done diff --git a/modules/rhizo_base/files/systemd/osmo-msc.override b/modules/rhizo_base/files/systemd/osmo-msc.override index 79771bc..234bf8a 100644 --- a/modules/rhizo_base/files/systemd/osmo-msc.override +++ b/modules/rhizo_base/files/systemd/osmo-msc.override @@ -1,3 +1,4 @@ [Service] ExecStart= ExecStart=/usr/bin/osmo-msc -c /etc/osmocom/osmo-msc.cfg -l /var/lib/osmocom/sms.db +ExecStartPost=/home/rhizomatica/bin/swap_lac.sh diff --git a/modules/rhizo_base/templates/vars.sh.erb b/modules/rhizo_base/templates/vars.sh.erb index d0f1be9..eb4c979 100644 --- a/modules/rhizo_base/templates/vars.sh.erb +++ b/modules/rhizo_base/templates/vars.sh.erb @@ -14,10 +14,12 @@ DID[<%= index %>]=<%= did %> #BTSs IP addresses (for amps etc) declare -a BTS +declare -a LAC declare -a BTS_MASTER <% @bts.each_with_index do |bts, index| -%> BTS[<%= index %>]=<%= bts["ip"] %> +LAC[<%= index %>]=<%= bts["lac"] %> <% if bts ["model"] == '2050M' -%> BTS_MASTER[<%= index %>]=<%= bts["ip"] %> <% end -%>