def __init__(self, config: Config):
self.conf = config
self.common_db = CommonDbClient(self.conf)
def __init__(self, config: Config):
self.conf = config
self.common_db = CommonDbClient(self.conf)
def create_dashboards(self):
# TODO lavado: migrate these methods to mongo change streams
# Lists all dashboards and OSM resources for later comparisons
def create_dashboards(self):
# TODO lavado: migrate these methods to mongo change streams
# Lists all dashboards and OSM resources for later comparisons
project_id = project['_id']
# Collect Project IDs for periodical dashboard clean-up
osm_resource_uids.append(project_id)
project_id = project['_id']
# Collect Project IDs for periodical dashboard clean-up
osm_resource_uids.append(project_id)
log.debug('Created dashboard for Project: %s', project_id)
else:
log.debug('Dashboard already exists')
log.debug('Created dashboard for Project: %s', project_id)
else:
log.debug('Dashboard already exists')
# Collect NS IDs for periodical dashboard clean-up
osm_resource_uids.append(nsr_id)
# Check if the NSR's VNFDs contain metrics
# Collect NS IDs for periodical dashboard clean-up
osm_resource_uids.append(nsr_id)
# Check if the NSR's VNFDs contain metrics
log.debug('Created dashboard for NS: %s', nsr_id)
else:
log.debug('Dashboard already exists')
log.debug('Created dashboard for NS: %s', nsr_id)
else:
log.debug('Dashboard already exists')
# Delete obsolete dashboards
for dashboard_uid in dashboard_uids:
if dashboard_uid not in osm_resource_uids:
# Delete obsolete dashboards
for dashboard_uid in dashboard_uids:
if dashboard_uid not in osm_resource_uids:
log.debug('Deleted obsolete dashboard: %s', dashboard_uid)
else:
log.debug('All dashboards in use')
log.debug('Deleted obsolete dashboard: %s', dashboard_uid)
else:
log.debug('All dashboards in use')