Skip to content
Snippets Groups Projects
Commit ef9952fc authored by Robert Latta's avatar Robert Latta
Browse files

added UNKNOWN location if equipment not found

parent 14eeb4d5
No related branches found
No related tags found
No related merge requests found
...@@ -274,6 +274,19 @@ def get_node_locations(ds: IMS): ...@@ -274,6 +274,19 @@ def get_node_locations(ds: IMS):
} }
}) })
yield ('UNKNOWN_LOC', {
'equipment-name': 'UNKNOWN',
'status': 'unknown',
'pop': {
'name': 'UNKNOWN',
'city': 'UNKNOWN',
'country': 'UNKNOWN',
'abbreviation': 'UNKNOWN',
'longitude': 0,
'latitude': 0,
}
})
# End of Dashboard V3 stuff # End of Dashboard V3 stuff
......
...@@ -472,6 +472,7 @@ def update_circuit_hierarchy_and_port_id_services(self, use_current=False): ...@@ -472,6 +472,7 @@ def update_circuit_hierarchy_and_port_id_services(self, use_current=False):
locations = {k: v for k, v in ims_data.get_node_locations(ds1)} locations = {k: v for k, v in ims_data.get_node_locations(ds1)}
tls_names = list(ims_data.get_service_types(ds1)) tls_names = list(ims_data.get_service_types(ds1))
customer_contacts = ims_data.get_customer_service_emails(ds1)
hierarchy = None hierarchy = None
port_id_details = defaultdict(list) port_id_details = defaultdict(list)
port_id_services = defaultdict(list) port_id_services = defaultdict(list)
...@@ -572,7 +573,11 @@ def update_circuit_hierarchy_and_port_id_services(self, use_current=False): ...@@ -572,7 +573,11 @@ def update_circuit_hierarchy_and_port_id_services(self, use_current=False):
'name': c['name'], 'name': c['name'],
'status': c['status'], 'status': c['status'],
'circuit_type': 'service', 'circuit_type': 'service',
'project': c['project'] 'project': c['project'],
'contacts': customer_contacts.get(
circ['customerid'],
[]
)
} }
elif c['sub-circuits']: elif c['sub-circuits']:
for sub in c['sub-circuits']: for sub in c['sub-circuits']:
...@@ -583,7 +588,14 @@ def update_circuit_hierarchy_and_port_id_services(self, use_current=False): ...@@ -583,7 +588,14 @@ def update_circuit_hierarchy_and_port_id_services(self, use_current=False):
def _format_service(s): def _format_service(s):
pd_a = port_id_details[s['port_a_id']][0] pd_a = port_id_details[s['port_a_id']][0]
loc_a = locations[pd_a['equipment_name']]['pop'] location_a = locations.get(pd_a['equipment_name'], None)
if location_a:
loc_a = location_a['pop']
else:
loc_a = locations['UNKNOWN_LOC']['pop']
logger.warning(
f'Unable to find location for {pd_a["equipment_name"]} - '
f'Service ID {s["id"]}')
s['pop_name'] = loc_a['name'] s['pop_name'] = loc_a['name']
s['pop_abbreviation'] = loc_a['abbreviation'] s['pop_abbreviation'] = loc_a['abbreviation']
s['equipment'] = pd_a['equipment_name'] s['equipment'] = pd_a['equipment_name']
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment