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

worker prep for gws-direct

parent 733b7bc2
No related branches found
No related tags found
No related merge requests found
...@@ -579,6 +579,7 @@ def update_circuit_hierarchy_and_port_id_services(self, use_current=False): ...@@ -579,6 +579,7 @@ def update_circuit_hierarchy_and_port_id_services(self, use_current=False):
port_id_services = defaultdict(list) port_id_services = defaultdict(list)
interface_services = defaultdict(list) interface_services = defaultdict(list)
access_services = {} access_services = {}
gws_indirect_services = {}
def _convert_to_bits(value, unit): def _convert_to_bits(value, unit):
unit = unit.lower() unit = unit.lower()
...@@ -765,6 +766,10 @@ def update_circuit_hierarchy_and_port_id_services(self, use_current=False): ...@@ -765,6 +766,10 @@ def update_circuit_hierarchy_and_port_id_services(self, use_current=False):
if circ['service_type'].lower() == 'geant ip': if circ['service_type'].lower() == 'geant ip':
access_services[circ['id']] = circ access_services[circ['id']] = circ
if circ['service_type'].lower() == 'gws - indirect' \
and circ['status'].lower() == 'operational':
gws_indirect_services[circ['id']] = circ
interface_services[k].extend(circuits) interface_services[k].extend(circuits)
if use_current: if use_current:
...@@ -782,6 +787,8 @@ def update_circuit_hierarchy_and_port_id_services(self, use_current=False): ...@@ -782,6 +787,8 @@ def update_circuit_hierarchy_and_port_id_services(self, use_current=False):
rp = r.pipeline() rp = r.pipeline()
for k in r.scan_iter('ims:access_services:*', count=1000): for k in r.scan_iter('ims:access_services:*', count=1000):
rp.delete(k) rp.delete(k)
for k in r.scan_iter('ims:gws_indirect:*', count=1000):
rp.delete(k)
rp.execute() rp.execute()
rp = r.pipeline() rp = r.pipeline()
for circ in hierarchy.values(): for circ in hierarchy.values():
...@@ -810,6 +817,18 @@ def update_circuit_hierarchy_and_port_id_services(self, use_current=False): ...@@ -810,6 +817,18 @@ def update_circuit_hierarchy_and_port_id_services(self, use_current=False):
'speed_value': v['calculated-speed'], 'speed_value': v['calculated-speed'],
'speed_unit': 'n/a' 'speed_unit': 'n/a'
})) }))
for v in gws_indirect_services.values():
rp.set(
f'ims:gws_indirect:{v["name"]}',
json.dumps({
'id': v['id'],
'name': v['name'],
'customer': v['project'],
'hostname': v['equipment'],
'interface_name': v['port'],
'speed_value': v['calculated-speed']
}))
rp.execute() rp.execute()
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment