Commit a02136f1 authored by Lluis Gifre Renom's avatar Lluis Gifre Renom
Browse files

Device component:

- Code cleanup
parent 530c51ba
Loading
Loading
Loading
Loading
+0 −8
Original line number Diff line number Diff line
@@ -303,18 +303,12 @@ def populate_endpoints(
    # Topologically sort new_sub_devices so that controllers (those referenced by other
    # devices via their controller_id) come before the devices that depend on them.

    LOGGER.info('new_sub_devices.keys={:s}'.format(str(new_sub_devices.keys())))
    graph : Dict[str, Set[str]] = dict()
    for dev_uuid, sub_device in new_sub_devices.items():
        ctrl_uuid = get_device_controller_uuid(sub_device)
        LOGGER.info('dev_uuid={:s}, ctrl_uuid={:s}'.format(str(dev_uuid), str(ctrl_uuid)))
        if ctrl_uuid is None: continue # sub_device has no controller
        predecesors = graph.setdefault(dev_uuid, set())
        LOGGER.info('dev_uuid={:s} predecesors={:s}'.format(str(dev_uuid), str(predecesors)))
        predecesors.add(ctrl_uuid)
        LOGGER.info('graph={:s}'.format(str(graph)))

    LOGGER.info('final graph={:s}'.format(str(graph)))

    try:
        ts = TopologicalSorter(graph)
@@ -327,8 +321,6 @@ def populate_endpoints(
        LOGGER.exception(msg)
        errors.append(msg)

    LOGGER.info('sorted_sub_device_uuids={:s}'.format(str(sorted_sub_device_uuids)))

    return errors

def populate_endpoint_monitoring_resources(device_with_uuids : Device, monitoring_loops : MonitoringLoops) -> None: