diff --git a/gns3server/controller/node.py b/gns3server/controller/node.py index 2311d698..81453d9d 100644 --- a/gns3server/controller/node.py +++ b/gns3server/controller/node.py @@ -54,7 +54,15 @@ class Node: self._compute = compute self._node_type = node_type - self._name = name + self._label = { + "y": -25, + "text": "", + "style": "font-size: 10;font-familly: Verdana", + "x": -17, + "rotation": 0 + } + self._name = None + self.name = name self._console = None self._console_type = None self._properties = {} @@ -67,13 +75,7 @@ class Node: self._y = 0 self._z = 0 self._symbol = ":/symbols/computer.svg" - self._label = { - "y": -25, - "text": "", - "style": "font-size: 10;font-familly: Verdana", - "x": -17, - "rotation": 0 - } + # Update node properties with additional elements for prop in kwargs: try: diff --git a/tests/controller/test_node.py b/tests/controller/test_node.py index 5b525feb..e1e1a98b 100644 --- a/tests/controller/test_node.py +++ b/tests/controller/test_node.py @@ -51,10 +51,10 @@ def node(compute, project): def test_eq(compute, project, node, controller): - assert node == Node(project, compute, "demo", node_id=node.id, node_type="qemu") + assert node == Node(project, compute, "demo1", node_id=node.id, node_type="qemu") assert node != "a" - assert node != Node(project, compute, "demo", node_id=str(uuid.uuid4()), node_type="qemu") - assert node != Node(Project(str(uuid.uuid4()), controller=controller), compute, "demo", node_id=node.id, node_type="qemu") + assert node != Node(project, compute, "demo2", node_id=str(uuid.uuid4()), node_type="qemu") + assert node != Node(Project(str(uuid.uuid4()), controller=controller), compute, "demo3", node_id=node.id, node_type="qemu") def test_json(node, compute): diff --git a/tests/controller/test_udp_link.py b/tests/controller/test_udp_link.py index c3f71253..2aa19561 100644 --- a/tests/controller/test_udp_link.py +++ b/tests/controller/test_udp_link.py @@ -116,16 +116,16 @@ def test_choose_capture_side(async_run, project): assert link._choose_capture_side()["node"] == node_iou - node_vpcs = Node(project, compute1, "node1", node_type="vpcs") - node_vpcs2 = Node(project, compute1, "node2", node_type="vpcs") + node_vpcs = Node(project, compute1, "node3", node_type="vpcs") + node_vpcs2 = Node(project, compute1, "node4", node_type="vpcs") link = UDPLink(project) async_run(link.add_node(node_vpcs, 0, 4)) async_run(link.add_node(node_vpcs2, 3, 1)) # Capture should run on the local node - node_iou = Node(project, compute1, "node1", node_type="iou") - node_iou2 = Node(project, compute2, "node2", node_type="iou") + node_iou = Node(project, compute1, "node5", node_type="iou") + node_iou2 = Node(project, compute2, "node6", node_type="iou") link = UDPLink(project) async_run(link.add_node(node_iou, 0, 4))