Skip to content
Snippets Groups Projects
Commit 84e1b52f authored by Erik Reid's avatar Erik Reid
Browse files

Merge branch 'develop' of...

Merge branch 'develop' of gitlab.geant.net:live-projects/dashboardv3/inventory-provider into develop
parents 902a8bd4 611df7ce
No related branches found
No related tags found
No related merge requests found
...@@ -143,15 +143,13 @@ def get_interface_services_and_loc(ims_source_equipment, ims_interface, redis): ...@@ -143,15 +143,13 @@ def get_interface_services_and_loc(ims_source_equipment, ims_interface, redis):
for s in json.loads(raw_services.decode('utf-8')): for s in json.loads(raw_services.decode('utf-8')):
related_services.update( related_services.update(
{r['id']: r for r in s['related-services']}) {r['id']: r for r in s['related-services']})
if s['monitored'] and s['circuit_type'] == 'service': if s['circuit_type'] == 'service':
contacts.update(set(s.pop('contacts', set()))) contacts.update(set(s.pop('contacts', set())))
_format_service(s) _format_service(s)
result['services'].append(s) result['services'].append(s)
result['related-services'] = list(related_services.values()) result['related-services'] = list(related_services.values())
result['contacts'] = sorted(list(contacts)) result['contacts'] = sorted(list(contacts))
# non-monitored related services are not added by the worker so don't
# need filtering out here
if not result['services']: if not result['services']:
result.pop('services', None) result.pop('services', None)
if result['related-services']: if result['related-services']:
......
...@@ -571,8 +571,6 @@ def update_circuit_hierarchy_and_port_id_services(self, use_current=False): ...@@ -571,8 +571,6 @@ def update_circuit_hierarchy_and_port_id_services(self, use_current=False):
tls_names = list(ims_data.get_service_types(ds1)) tls_names = list(ims_data.get_service_types(ds1))
customer_contacts = \ customer_contacts = \
{k: v for k, v in ims_data.get_customer_service_emails(ds1)} {k: v for k, v in ims_data.get_customer_service_emails(ds1)}
circuit_ids_not_to_monitor = \
list(ims_data.get_non_monitored_circuit_ids(ds1))
circuit_ids_to_monitor = \ circuit_ids_to_monitor = \
list(ims_data.get_monitored_circuit_ids(ds1)) list(ims_data.get_monitored_circuit_ids(ds1))
...@@ -618,7 +616,6 @@ def update_circuit_hierarchy_and_port_id_services(self, use_current=False): ...@@ -618,7 +616,6 @@ def update_circuit_hierarchy_and_port_id_services(self, use_current=False):
nonlocal hierarchy nonlocal hierarchy
hierarchy = {} hierarchy = {}
for d in ims_data.get_circuit_hierarchy(ds1): for d in ims_data.get_circuit_hierarchy(ds1):
d['monitored'] = d['id'] in circuit_ids_to_monitor
d['contacts'] = customer_contacts.get(d['customerid'], []) d['contacts'] = customer_contacts.get(d['customerid'], [])
hierarchy[d['id']] = d hierarchy[d['id']] = d
logger.debug("hierarchy complete") logger.debug("hierarchy complete")
...@@ -667,25 +664,20 @@ def update_circuit_hierarchy_and_port_id_services(self, use_current=False): ...@@ -667,25 +664,20 @@ def update_circuit_hierarchy_and_port_id_services(self, use_current=False):
c = hierarchy.get(circuit_id, None) c = hierarchy.get(circuit_id, None)
if c: if c:
def _is_rs(candidate): if c['circuit-type'] == 'service':
if candidate['id'] in circuit_ids_not_to_monitor:
return False
if candidate['product'] in tls_names:
return True
# if candidate['speed'] == 'BGP':
# return True
return False
if _is_rs(c):
rs[c['id']] = { rs[c['id']] = {
'id': c['id'], 'id': c['id'],
'name': c['name'], 'name': c['name'],
'status': c['status'], 'circuit_type': c['circuit-type'],
'circuit_type': 'service',
'service_type': c['product'], 'service_type': c['product'],
'project': c['project'], 'project': c['project'],
'contacts': sorted(list(c['contacts'])) 'contacts': sorted(list(c['contacts']))
} }
if c['id'] in circuit_ids_to_monitor:
rs[c['id']]['status'] = c['status']
else:
rs[c['id']]['status'] = 'non-monitored'
if c['sub-circuits']: if c['sub-circuits']:
for sub in c['sub-circuits']: for sub in c['sub-circuits']:
temp_parents = \ temp_parents = \
...@@ -694,10 +686,10 @@ def update_circuit_hierarchy_and_port_id_services(self, use_current=False): ...@@ -694,10 +686,10 @@ def update_circuit_hierarchy_and_port_id_services(self, use_current=False):
return list(rs.values()) return list(rs.values())
def _format_service(s): def _format_service(s):
if s['id'] in circuit_ids_not_to_monitor:
s['monitored'] = False if s['circuit_type'] == 'service' \
else: and s['id'] not in circuit_ids_to_monitor:
s['monitored'] = True s['status'] = 'non-monitored'
pd_a = port_id_details[s['port_a_id']][0] pd_a = port_id_details[s['port_a_id']][0]
location_a = locations.get(pd_a['equipment_name'], None) location_a = locations.get(pd_a['equipment_name'], None)
if location_a: if location_a:
...@@ -758,10 +750,6 @@ def update_circuit_hierarchy_and_port_id_services(self, use_current=False): ...@@ -758,10 +750,6 @@ def update_circuit_hierarchy_and_port_id_services(self, use_current=False):
'name': hierarchy[x]['name'], 'name': hierarchy[x]['name'],
'status': hierarchy[x]['status'] 'status': hierarchy[x]['status']
} }
if c['id'] in circuit_ids_not_to_monitor:
c['monitored'] = False
else:
c['monitored'] = True
circ['fibre-routes'].append(c) circ['fibre-routes'].append(c)
circ['related-services'] = \ circ['related-services'] = \
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment