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

corrected deletion key; added location info to services

parent 04b3a824
No related branches found
No related tags found
No related merge requests found
......@@ -550,38 +550,48 @@ def update_interfaces_to_services(self, use_current=False):
rp = r.pipeline()
# scan with bigger batches, to mitigate network latency effects
for key in r.scan_iter('ims:port_id_services:*', count=2000):
for key in r.scan_iter('ims:interface_services:*', count=2000):
rp.delete(key)
rp.execute()
locations = {k: v for k, v in ims_data.get_node_locations(ds)}
port_id_details = {d['port_id']: d for d in ims_data.get_port_details(ds)}
for service in ims_data.get_port_id_services(ds):
port_id_services[service["port_a_id"]].append(service)
rp = r.pipeline()
def _format_service(s, port, loc):
s['pop_name'] = loc['name']
s['pop_abbreviation'] = loc['abbreviation']
s['equipment'] = '' # this is redundant I believe
def _format_service(s):
pd_a = port_id_details[s['port_a_id']]
loc_a = locations[pd_a['equipment_name']]['pop']
s['pop_name'] = loc_a['name']
s['pop_abbreviation'] = loc_a['abbreviation']
s['equipment'] = pd_a['equipment_name']
s['card_d'] = '' # this is redundant I believe
s['port'] = port # this is redundant I believe
s['port'] = pd_a['interface_name']
s['logical_unit'] = '' # this is redundant I believe
if 'port_b_id' in s:
pd_b = port_id_details[s['port_b_id']]
loc_b = locations[pd_b['equipment_name']]['pop']
s['other_end_pop_name'] = loc_a['name']
s['other_end_pop_abbreviation'] = loc_b['abbreviation']
s['other_end_equipment'] = pd_b['equipment_name']
s['other_end_port'] = pd_b['interface_name']
else:
s['other_end_pop_name'] = ''
s['other_end_pop_abbreviation'] = ''
s['other_end_equipment'] = ''
s['other_end_port'] = ''
s['other_end_pop_name'] = '' # redundant
s['other_end_pop_abbreviation'] = '' # redundant
s['other_end_equipment'] = '' # this is redundant I believe
s['other_end_card_d'] = '' # this is redundant I believe
s['other_end_port'] = '' # this is redundant I believe
s['other_end_logical_unit'] = '' # this is redundant I believe
s['manufacturer'] = '' # this is redundant I believe
s.pop('port_a_id', None)
s.pop('port_b_id', None)
for port_info in ims_data.get_port_details(ds):
location = locations[port_info['equipment_name']]['pop']
for port_info in port_id_details.values():
services = []
for service in port_id_services[port_info['port_id']]:
_format_service(service, port_info['interface_name'], location)
_format_service(service)
services.append(service)
rp.set(
......
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