Prevent connect a node to himself

Fix https://github.com/GNS3/gns3-gui/issues/1553
This commit is contained in:
Julien Duponchelle committed 2016-10-03 12:31:01 +02:00
1 parent 420168015c
commit 99bdf37ec3
7 files changed
+79 -7

No files matched your search

+3
View File
@@ -61,6 +61,9 @@ class Link:
self._link_type = port.link_type
for other_node in self._nodes:
if other_node["node"] == node:
raise aiohttp.web.HTTPConflict(text="Cannot connect to itself")
if node.node_type in ["nat", "cloud"]:
if other_node["node"].node_type in ["nat", "cloud"]:
raise aiohttp.web.HTTPConflict(text="It's not allowed to connect a {} to a {}".format(other_node["node"].node_type, node.node_type))