Commit 633defb0 authored by Lluis Gifre Renom's avatar Lluis Gifre Renom
Browse files

Context component:

- Corrected parsing of topologydevicemodel relations in Device
parent 32fbafb5
Loading
Loading
Loading
Loading
+1 −2
Original line number Original line Diff line number Diff line
@@ -185,6 +185,7 @@ def device_set(db_engine : Engine, messagebroker : MessageBroker, request : Devi
            endpoint_updates = session.execute(stmt).fetchall()
            endpoint_updates = session.execute(stmt).fetchall()
            updated_endpoints = any([(updated_at > created_at) for created_at,updated_at in endpoint_updates])
            updated_endpoints = any([(updated_at > created_at) for created_at,updated_at in endpoint_updates])


        device_topology_ids = []
        if not updated or len(related_topologies) > 1:
        if not updated or len(related_topologies) > 1:
            # Only update topology-device relations when device is created (not updated) or when endpoints are
            # Only update topology-device relations when device is created (not updated) or when endpoints are
            # modified (len(related_topologies) > 1).
            # modified (len(related_topologies) > 1).
@@ -204,8 +205,6 @@ def device_set(db_engine : Engine, messagebroker : MessageBroker, request : Devi
                device_topologies : List[TopologyModel] = query.all()
                device_topologies : List[TopologyModel] = query.all()
                device_topology_ids = [obj.dump_id() for obj in device_topologies]
                device_topology_ids = [obj.dump_id() for obj in device_topologies]
                LOGGER.warning('device_topology_ids={:s}'.format(str(device_topology_ids)))
                LOGGER.warning('device_topology_ids={:s}'.format(str(device_topology_ids)))
            else:
                device_topology_ids = []


        changed_config_rules = upsert_config_rules(session, config_rules, device_uuid=device_uuid)
        changed_config_rules = upsert_config_rules(session, config_rules, device_uuid=device_uuid)