mirror of
https://github.com/GNS3/gns3-server
synced 2024-11-28 11:18:11 +00:00
Allow projects to be opened even when a node port is already used.
This commit is contained in:
parent
6a8f220ff1
commit
e1c8df170a
@ -132,6 +132,13 @@ class Link:
|
||||
"""
|
||||
return self._filters
|
||||
|
||||
@property
|
||||
def nodes(self):
|
||||
"""
|
||||
Get the current nodes attached to this link
|
||||
"""
|
||||
return self._nodes
|
||||
|
||||
def get_active_filters(self):
|
||||
"""
|
||||
Return the active filters.
|
||||
|
@ -782,7 +782,14 @@ class Project:
|
||||
yield from link.update_filters(link_data["filters"])
|
||||
for node_link in link_data["nodes"]:
|
||||
node = self.get_node(node_link["node_id"])
|
||||
port = node.get_port(node_link["adapter_number"], node_link["port_number"])
|
||||
if port.link is not None:
|
||||
# the node port is already attached to another link
|
||||
continue
|
||||
yield from link.add_node(node, node_link["adapter_number"], node_link["port_number"], label=node_link.get("label"), dump=False)
|
||||
if len(link.nodes) != 2:
|
||||
# a link should have 2 attached nodes, this can happen with corrupted projects
|
||||
yield from self.delete_link(link.id)
|
||||
for drawing_data in topology.get("drawings", []):
|
||||
yield from self.add_drawing(dump=False, **drawing_data)
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user