pespin has uploaded this change for review. ( 
https://gerrit.osmocom.org/c/osmo-ttcn3-hacks/+/44089?usp=email )


Change subject: testenv: Update open5gs-dbctl to open5gs main
......................................................................

testenv: Update open5gs-dbctl to open5gs main

Imported from open5gs.git 2a48531401ad5033acd09179588dc8209137b777.
This new version allows adding IMEIs to the EIR database.

Change-Id: Ic28d5d5ce511c0b4698a206ad10ed159954814f7
---
M _testenv/data/scripts/open5gs-dbctl
1 file changed, 42 insertions(+), 1 deletion(-)



  git pull ssh://gerrit.osmocom.org:29418/osmo-ttcn3-hacks 
refs/changes/89/44089/1

diff --git a/_testenv/data/scripts/open5gs-dbctl 
b/_testenv/data/scripts/open5gs-dbctl
index e7de1f1..707df15 100755
--- a/_testenv/data/scripts/open5gs-dbctl
+++ b/_testenv/data/scripts/open5gs-dbctl
@@ -29,7 +29,8 @@
     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"
-
+    echo "   eir add imei {imei status}: adds a PEI (IMEI) to the database 
with default values"
+    echo "   eir add imei {imei status imsi}: adds a PEI (IMEI) to the 
database with default values and a SUPI for the UE"
 }

 while test $# -gt 0; do
@@ -874,4 +875,44 @@
 fi


+if [ "$1" = "eir" ]; then
+    if [ "$#" -lt 5 ]; then
+        echo "open5gs-dbctl: incorrect number of args, see help"
+        exit 1
+    fi
+    if [ "$2" = "add" ] && [ "$3" = "imei" ]; then
+        IMEI=$4
+        STATUS=$5
+            case "$STATUS" in
+            "WHITELISTED" | "BLACKLISTED" | "GREYLISTED")
+                ;;
+            *)
+            echo "open5gs-dbctl: incorrect status, format is 
(WHITELISTED|BLACKLISTED|GREYLISTED)"
+            exit 1
+                ;;
+        esac
+        if [ "$#" -eq 6 ]; then
+            IMSI=$6
+            mongosh --eval "db.eir.insertOne(
+                {
+                    \"_id\": new ObjectId(),
+                    \"pei\": \"imei-$IMEI\",
+                    \"status\": \"$STATUS\",
+                    \"supi\": \"imsi-$IMSI\"
+                }
+                );" $DB_URI
+                exit $?
+        else
+            mongosh --eval "db.eir.insertOne(
+                {
+                    \"_id\": new ObjectId(),
+                    \"pei\": \"imei-$IMEI\",
+                    \"status\": \"$STATUS\"
+                }
+                );" $DB_URI
+            exit $?
+        fi
+    fi
+fi
+
 display_help

--
To view, visit https://gerrit.osmocom.org/c/osmo-ttcn3-hacks/+/44089?usp=email
To unsubscribe, or for help writing mail filters, visit 
https://gerrit.osmocom.org/settings?usp=email

Gerrit-MessageType: newchange
Gerrit-Project: osmo-ttcn3-hacks
Gerrit-Branch: master
Gerrit-Change-Id: Ic28d5d5ce511c0b4698a206ad10ed159954814f7
Gerrit-Change-Number: 44089
Gerrit-PatchSet: 1
Gerrit-Owner: pespin <[email protected]>

Reply via email to