diff --git a/gns3server/controller/udp_link.py b/gns3server/controller/udp_link.py index 5a5176e8..2c5bb0b8 100644 --- a/gns3server/controller/udp_link.py +++ b/gns3server/controller/udp_link.py @@ -61,7 +61,7 @@ class UDPLink(Link): "rport": self._node2_port, "type": "nio_udp" } - yield from node1.post("/adapters/{adapter_number}/ports/{port_number}/nio".format(adapter_number=adapter_number1, port_number=port_number1), data=data) + yield from node1.post("/adapters/{adapter_number}/ports/{port_number}/nio".format(adapter_number=adapter_number1, port_number=port_number1), data=data, timeout=120) data = { "lport": self._node2_port, @@ -70,10 +70,10 @@ class UDPLink(Link): "type": "nio_udp" } try: - yield from node2.post("/adapters/{adapter_number}/ports/{port_number}/nio".format(adapter_number=adapter_number2, port_number=port_number2), data=data) + yield from node2.post("/adapters/{adapter_number}/ports/{port_number}/nio".format(adapter_number=adapter_number2, port_number=port_number2), data=data, timeout=120) except Exception as e: # We clean the first NIO - yield from node1.delete("/adapters/{adapter_number}/ports/{port_number}/nio".format(adapter_number=adapter_number1, port_number=port_number1)) + yield from node1.delete("/adapters/{adapter_number}/ports/{port_number}/nio".format(adapter_number=adapter_number1, port_number=port_number1), timeout=120) raise e self._created = True @@ -91,7 +91,7 @@ class UDPLink(Link): except IndexError: return try: - yield from node1.delete("/adapters/{adapter_number}/ports/{port_number}/nio".format(adapter_number=adapter_number1, port_number=port_number1)) + yield from node1.delete("/adapters/{adapter_number}/ports/{port_number}/nio".format(adapter_number=adapter_number1, port_number=port_number1), timeout=120) # If the node is already delete (user selected multiple element and delete all in the same time) except aiohttp.web.HTTPNotFound: pass @@ -103,7 +103,7 @@ class UDPLink(Link): except IndexError: return try: - yield from node2.delete("/adapters/{adapter_number}/ports/{port_number}/nio".format(adapter_number=adapter_number2, port_number=port_number2)) + yield from node2.delete("/adapters/{adapter_number}/ports/{port_number}/nio".format(adapter_number=adapter_number2, port_number=port_number2), timeout=120) # If the node is already delete (user selected multiple element and delete all in the same time) except aiohttp.web.HTTPNotFound: pass diff --git a/tests/controller/test_udp_link.py b/tests/controller/test_udp_link.py index a31db818..3e0d060c 100644 --- a/tests/controller/test_udp_link.py +++ b/tests/controller/test_udp_link.py @@ -54,7 +54,7 @@ def test_create(async_run, project): async_run(link.add_node(node1, 0, 4)) @asyncio.coroutine - def compute1_callback(path, data={}): + def compute1_callback(path, data={}, **kwargs): """ Fake server """ @@ -64,7 +64,7 @@ def test_create(async_run, project): return response @asyncio.coroutine - def compute2_callback(path, data={}): + def compute2_callback(path, data={}, **kwargs): """ Fake server """ @@ -84,13 +84,13 @@ def test_create(async_run, project): "rhost": "192.168.1.2", "rport": 2048, "type": "nio_udp" - }) + }, timeout=120) compute2.post.assert_any_call("/projects/{}/vpcs/nodes/{}/adapters/3/ports/1/nio".format(project.id, node2.id), data={ "lport": 2048, "rhost": "192.168.1.1", "rport": 1024, "type": "nio_udp" - }) + }, timeout=120) def test_create_one_side_failure(async_run, project): @@ -115,7 +115,7 @@ def test_create_one_side_failure(async_run, project): async_run(link.add_node(node1, 0, 4)) @asyncio.coroutine - def compute1_callback(path, data={}): + def compute1_callback(path, data={}, **kwargs): """ Fake server """ @@ -125,7 +125,7 @@ def test_create_one_side_failure(async_run, project): return response @asyncio.coroutine - def compute2_callback(path, data={}): + def compute2_callback(path, data={}, **kwargs): """ Fake server """ @@ -148,15 +148,15 @@ def test_create_one_side_failure(async_run, project): "rhost": "192.168.1.2", "rport": 2048, "type": "nio_udp" - }) + }, timeout=120) compute2.post.assert_any_call("/projects/{}/vpcs/nodes/{}/adapters/3/ports/1/nio".format(project.id, node2.id), data={ "lport": 2048, "rhost": "192.168.1.1", "rport": 1024, "type": "nio_udp" - }) + }, timeout=120) # The link creation has failed we rollback the nio - compute1.delete.assert_any_call("/projects/{}/vpcs/nodes/{}/adapters/0/ports/4/nio".format(project.id, node1.id)) + compute1.delete.assert_any_call("/projects/{}/vpcs/nodes/{}/adapters/0/ports/4/nio".format(project.id, node1.id), timeout=120) def test_delete(async_run, project): @@ -175,8 +175,8 @@ def test_delete(async_run, project): async_run(link.delete()) - compute1.delete.assert_any_call("/projects/{}/vpcs/nodes/{}/adapters/0/ports/4/nio".format(project.id, node1.id)) - compute2.delete.assert_any_call("/projects/{}/vpcs/nodes/{}/adapters/3/ports/1/nio".format(project.id, node2.id)) + compute1.delete.assert_any_call("/projects/{}/vpcs/nodes/{}/adapters/0/ports/4/nio".format(project.id, node1.id), timeout=120) + compute2.delete.assert_any_call("/projects/{}/vpcs/nodes/{}/adapters/3/ports/1/nio".format(project.id, node2.id), timeout=120) def test_choose_capture_side(async_run, project):