Skip to content
Snippets Groups Projects
Commit 8c0a6057 authored by Sam Roberts's avatar Sam Roberts
Browse files

connect everything back together in prep for IMS task splitting

parent 691fd01b
No related branches found
No related tags found
1 merge request!22Feature/pol1 744 fix speed issues
...@@ -703,15 +703,14 @@ def _load_interfaces( ...@@ -703,15 +703,14 @@ def _load_interfaces(
def _add_speeds(config, interfaces): def _add_speeds(config, interfaces):
netconf_interfaces_all = list(common.load_json_docs(config, 'netconf-interfaces:all')) netconf_interfaces_all = list(common.load_json_docs(config, 'netconf-interfaces:all'))
try: try:
all_netconf_interfaces = netconf_interfaces_all[0] all_netconf_interfaces = netconf_interfaces_all[0]['value']
except IndexError: except IndexError:
all_netconf_interfaces = [] all_netconf_interfaces = []
netconf_interface_index = {} netconf_interface_index = {}
for netconf_interface_doc in all_netconf_interfaces: for nc_ifc in all_netconf_interfaces:
nc_ifc = netconf_interface_doc['value'] if 'hostname' in nc_ifc and 'name' in nc_ifc:
if 'router' in nc_ifc and 'name' in nc_ifc: netconf_interface_index[f"{nc_ifc['hostname']}---{nc_ifc['name']}"] = nc_ifc
netconf_interface_index[f"{nc_ifc['router']}---{nc_ifc['name']}"] = nc_ifc
for ifc in interfaces: for ifc in interfaces:
nc_ifc = netconf_interface_index.get(f"{ifc['router']}---{ifc['name']}", {}) nc_ifc = netconf_interface_index.get(f"{ifc['router']}---{ifc['name']}", {})
......
...@@ -451,7 +451,6 @@ def update_entry_point(self): ...@@ -451,7 +451,6 @@ def update_entry_point(self):
chord( chord(
( (
ims_task.s().on_error(task_error_handler.s()), ims_task.s().on_error(task_error_handler.s()),
chord((
chord( chord(
(reload_router_config_chorded.s(r) for r in routers), (reload_router_config_chorded.s(r) for r in routers),
empty_task.si('router tasks complete') empty_task.si('router tasks complete')
...@@ -460,8 +459,7 @@ def update_entry_point(self): ...@@ -460,8 +459,7 @@ def update_entry_point(self):
(reload_lab_router_config_chorded.s(r) (reload_lab_router_config_chorded.s(r)
for r in lab_routers), for r in lab_routers),
empty_task.si('lab router tasks complete') empty_task.si('lab router tasks complete')
)) )
),
), ),
final_task.si().on_error(task_error_handler.s()) final_task.si().on_error(task_error_handler.s())
)() )()
...@@ -1464,8 +1462,8 @@ def collate_netconf_interfaces_all_cache(warning_callback=lambda s: None): ...@@ -1464,8 +1462,8 @@ def collate_netconf_interfaces_all_cache(warning_callback=lambda s: None):
key = k.decode('utf-8') key = k.decode('utf-8')
doc_str = r.get(key).decode('utf-8') doc_str = r.get(key).decode('utf-8')
doc = json.loads(doc_str) doc = json.loads(doc_str)
doc['hostname'] = k.split(':')[1] # get hostname part of key doc['hostname'] = key.split(':')[1] # get hostname part of key
yield json.loads(doc_str) yield doc
netconf_all_key = 'netconf-interfaces:all' netconf_all_key = 'netconf-interfaces:all'
lab_netconf_all_key = 'lab:netconf-interfaces:all' lab_netconf_all_key = 'lab:netconf-interfaces:all'
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please to comment