mirror of
https://github.com/open5gs/open5gs.git
synced 2026-04-28 03:19:31 +00:00
Added editing subscribers with PythonAPI Interface
Using the UpdateSubscriber call. Input variables are the IMSI and the subscriber data, which is the same as the outputted data of GetSubscriber.
This commit is contained in:
parent
1e56141d1e
commit
85dbeb05cc
1 changed files with 11 additions and 2 deletions
|
|
@ -42,6 +42,17 @@ class Open5GS:
|
|||
print("Added subscriber with Inserted ID : " + str(x.inserted_id))
|
||||
return x.inserted_id
|
||||
|
||||
def UpdateSubscriber(self, imsi, sub_data):
|
||||
myclient = pymongo.MongoClient("mongodb://" + str(self.server) + ":" + str(self.port) + "/")
|
||||
mydb = myclient["open5gs"]
|
||||
mycol = mydb["subscribers"]
|
||||
print("Attempting to update IMSI " + str(imsi))
|
||||
newvalues = { "$set": sub_data }
|
||||
myquery = { "imsi": str(imsi)}
|
||||
x = mycol.update_one(myquery, newvalues)
|
||||
print(x)
|
||||
return True
|
||||
|
||||
|
||||
def DeleteSubscriber(self, imsi):
|
||||
myclient = pymongo.MongoClient("mongodb://" + str(self.server) + ":" + str(self.port) + "/")
|
||||
|
|
@ -51,5 +62,3 @@ class Open5GS:
|
|||
x = mycol.delete_many(myquery)
|
||||
print(x.deleted_count, " subscribers deleted.")
|
||||
return x.deleted_count
|
||||
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue