From 678abdeacfa5019f8cefbc07339f14ec3b5e0731 Mon Sep 17 00:00:00 2001 From: Jasmine Fan <133797328+luyuanfan@users.noreply.github.com> Date: Mon, 22 Dec 2025 23:53:53 -0500 Subject: [PATCH] Add roaming type toggle via command line (#4211) * add TODOs for lbo_roaming_allowed function * complete lbo_roaming_allowed method * edit help text * fix variable name --- misc/db/open5gs-dbctl | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/misc/db/open5gs-dbctl b/misc/db/open5gs-dbctl index 8ea7ccf4a..0a6049161 100755 --- a/misc/db/open5gs-dbctl +++ b/misc/db/open5gs-dbctl @@ -26,6 +26,7 @@ display_help() { echo " showfiltered: shows {imsi key opc apn ip} information of subscriber" echo " ambr_speed {imsi dl_value dl_unit ul_value ul_unit}: Change AMBR speed from a specific user and the unit values are \"[0=bps 1=Kbps 2=Mbps 3=Gbps 4=Tbps ]\"" echo " subscriber_status {imsi subscriber_status_val={0,1} operator_determined_barring={0..8}}: Change TS 29.272 values for Subscriber-Status (7.3.29) and Operator-Determined-Barring (7.3.30)" + echo " lbo_roaming_allowed {imsi lbo_roaming_allowed={0,1}}: Change roaming type for a specific subscriber: 0 = LBO roaming (default), 1 = HR roaming" } @@ -800,6 +801,24 @@ if [ "$1" = "subscriber_status" ]; then echo "open5gs-dbctl: incorrect number of args, format is \"open5gs-dbctl subscriber_status imsi subscriber_status_val={0,1} operator_determined_barring={0..8}" exit 1 fi +if [ "$1" = "lbo_roaming_allowed" ]; then + if [ "$#" -eq 3 ]; then + IMSI=$2 + LBO_ALLOWED=$3 + if [ $LBO_ALLOWED = "1" ]; then + LBO_ALLOWED_BOOL=true + else + LBO_ALLOWED_BOOL=false + fi + mongosh --eval "db.subscribers.updateOne({ \"imsi\": \"$IMSI\"}, + {\$set: { \"slice.0.session.0.lbo_roaming_allowed\": $LBO_ALLOWED_BOOL + } + });" $DB_URI + exit $? + fi + echo "open5gs-dbctl: incorrect number of args, format is \"open5gs-dbctl lbo_roaming_allowed imsi lbo_roaming_allowed={0,1}" + exit 1 +fi if [ "$1" = "showall" ]; then mongosh --eval "db.subscribers.find()" $DB_URI exit $?