Some cleanup for the db migration script (#956)

This commit is contained in:
Matthew Johnson
2021-04-24 23:25:51 -07:00
committed by GitHub
parent fc27f7499b
commit 72374e439a
4 changed files with 186 additions and 63 deletions

View File

@@ -1,4 +1,3 @@
import mongo
import pymongo
import random
import bson
@@ -8,7 +7,6 @@ class Open5GS:
self.server = server
self.port = port
def GetSubscribers(self):
myclient = pymongo.MongoClient("mongodb://" + str(self.server) + ":" + str(self.port) + "/")
mydb = myclient["open5gs"]
@@ -30,14 +28,12 @@ class Open5GS:
for x in mydoc:
print(x)
return x
def AddSubscriber(self, sub_data):
myclient = pymongo.MongoClient("mongodb://" + str(self.server) + ":" + str(self.port) + "/")
mydb = myclient["open5gs"]
mycol = mydb["subscribers"]
x = mycol.insert_one(sub_data)
print("Added subscriber with Inserted ID : " + str(x.inserted_id))
return x.inserted_id
@@ -53,7 +49,6 @@ class Open5GS:
print(x)
return True
def DeleteSubscriber(self, imsi):
myclient = pymongo.MongoClient("mongodb://" + str(self.server) + ":" + str(self.port) + "/")
mydb = myclient["open5gs"]