feat(sol006): sol006 migration
[osm/MON.git] / osm_mon / collector / infra_collectors / base_osinfra.py
index 37b9293..1c1999c 100644 (file)
@@ -49,7 +49,7 @@ class BaseOpenStackInfraCollector(BaseVimInfraCollector):
         if self.vim_account['_admin']['projects_read']:
             vim_project_id = self.vim_account['_admin']['projects_read'][0]
         else:
-            vim_project_id = None
+            vim_project_id = ''
         vim_tags = {
             'vim_account_id': self.vim_account['_id'],
             'project_id': vim_project_id
@@ -64,7 +64,7 @@ class BaseOpenStackInfraCollector(BaseVimInfraCollector):
             if vnfr['_admin']['projects_read']:
                 vnfr_project_id = vnfr['_admin']['projects_read'][0]
             else:
-                vnfr_project_id = None
+                vnfr_project_id = ''
             for vdur in vnfr['vdur']:
                 if 'vim-id' not in vdur:
                     log.debug("Field vim-id is not present in vdur")
@@ -76,7 +76,7 @@ class BaseOpenStackInfraCollector(BaseVimInfraCollector):
                     'nsr_id': nsr_id,
                     'ns_name': ns_name,
                     'vnf_member_index': vnf_member_index,
-                    'vdur_name': vdur['name'],
+                    'vdur_name': vdur.get("name", ""),
                     'project_id': vnfr_project_id
                 }
                 try:
@@ -100,8 +100,8 @@ class BaseOpenStackInfraCollector(BaseVimInfraCollector):
 
     def _build_keystone_client(self, vim_account: dict) -> keystone_client.Client:
         sess = OpenstackUtils.get_session(vim_account)
-        return keystone_client.Client(session=sess)
+        return keystone_client.Client(session=sess, timeout=10)
 
     def _build_nova_client(self, vim_account: dict) -> nova_client.Client:
         sess = OpenstackUtils.get_session(vim_account)
-        return nova_client.Client("2", session=sess)
+        return nova_client.Client("2", session=sess, timeout=10)