+ # Get all vim ids regiestered in osm and create their corresponding vim session objects
+ # Vim ids and their corresponding session objects are stored in vim-session-map
+ # It optimizes the number of authentication tokens created in vim for metric colleciton
+ vim_sess_map.clear()
+ vims = self.common_db.get_vim_accounts()
+ for vim in vims:
+ vim_type = CollectorService._get_vim_type(self.conf, vim["_id"])
+ if vim_type in VIM_INFRA_COLLECTORS:
+ collector = VIM_INFRA_COLLECTORS[vim_type](self.conf, vim["_id"])
+ vim_sess = collector.vim_session if vim_type == "openstack" else None
+ # Populate the vim session map with vim ids and corresponding session objects
+ # vim session objects are stopred only for vim type openstack
+ if vim_sess:
+ vim_sess_map[vim["_id"]] = vim_sess
+