Skip to content
Snippets Groups Projects
Commit 32fbafb5 authored by Lluis Gifre Renom's avatar Lluis Gifre Renom
Browse files

Context component:

- Corrected viewonly relations in TopologyDeviceModel and TopologyLinkModel
- Corrected parsing of topologydevicemodel relations in Device
parent 380cded0
No related branches found
No related tags found
2 merge requests!235Release TeraFlowSDN 3.0,!147Resolve "Notificatoins from Context are incomplete"
......@@ -195,12 +195,15 @@ def device_set(db_engine : Engine, messagebroker : MessageBroker, request : Devi
stmt = stmt.returning(TopologyDeviceModel.topology_uuid)
topology_uuids = session.execute(stmt).fetchall()
LOGGER.warning('topology_uuids={:s}'.format(str(topology_uuids)))
LOGGER.warning('RAW topology_uuids={:s}'.format(str(topology_uuids)))
if len(topology_uuids) > 0:
topology_uuids = [topology_uuid[0] for topology_uuid in topology_uuids]
LOGGER.warning('NEW topology_uuids={:s}'.format(str(topology_uuids)))
query = session.query(TopologyModel)
query = query.filter(TopologyModel.topology_uuid.in_(topology_uuids))
device_topologies : List[TopologyModel] = query.all()
device_topology_ids = [obj.dump_id() for obj in device_topologies]
LOGGER.warning('device_topology_ids={:s}'.format(str(device_topology_ids)))
else:
device_topology_ids = []
......
......@@ -67,7 +67,7 @@ class TopologyDeviceModel(_Base):
topology_uuid = Column(ForeignKey('topology.topology_uuid', ondelete='RESTRICT'), primary_key=True, index=True)
device_uuid = Column(ForeignKey('device.device_uuid', ondelete='CASCADE' ), primary_key=True, index=True)
topology = relationship('TopologyModel', lazy='selectin') # back_populates='topology_devices'
topology = relationship('TopologyModel', lazy='selectin', viewonly=True) # back_populates='topology_devices'
device = relationship('DeviceModel', lazy='selectin') # back_populates='topology_devices'
class TopologyLinkModel(_Base):
......@@ -76,5 +76,5 @@ class TopologyLinkModel(_Base):
topology_uuid = Column(ForeignKey('topology.topology_uuid', ondelete='RESTRICT'), primary_key=True, index=True)
link_uuid = Column(ForeignKey('link.link_uuid', ondelete='CASCADE' ), primary_key=True, index=True)
topology = relationship('TopologyModel', lazy='selectin') # back_populates='topology_links'
topology = relationship('TopologyModel', lazy='selectin', viewonly=True) # back_populates='topology_links'
link = relationship('LinkModel', lazy='selectin') # back_populates='topology_links'
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