Adds support for VNF metric based alarming
[osm/MON.git] / osm_mon / core / common_db.py
index 5a76536..beaac3d 100644 (file)
@@ -30,8 +30,7 @@ class CommonDbClient:
     def __init__(self):
         cfg = Config.instance()
         self.common_db = dbmongo.DbMongo()
-        self.common_db.db_connect({'host': cfg.MONGO_URI.split(':')[0],
-                                   'port': int(cfg.MONGO_URI.split(':')[1]),
+        self.common_db.db_connect({'uri': cfg.MONGO_URI,
                                    'name': 'osm',
                                    'commonkey': cfg.OSMMON_DATABASE_COMMONKEY})
 
@@ -62,13 +61,13 @@ class CommonDbClient:
                                          {"_id": nslcmop_id})
         return nslcmop
 
-    def get_vdur(self, nsr_id, member_index, vdu_name):
+    def get_vdur(self, nsr_id, member_index, vdur_name):
         vnfr = self.get_vnfr(nsr_id, member_index)
         for vdur in vnfr['vdur']:
-            if vdur['name'] == vdu_name:
+            if vdur['name'] == vdur_name:
                 return vdur
-        raise ValueError('vdur not found for nsr-id %s, member_index %s and vdu_name %s', nsr_id, member_index,
-                         vdu_name)
+        raise ValueError('vdur not found for nsr-id %s, member_index %s and vdur_name %s', nsr_id, member_index,
+                         vdur_name)
 
     def decrypt_vim_password(self, vim_password: str, schema_version: str, vim_id: str):
         return self.common_db.decrypt(vim_password, schema_version, vim_id)