diff --git a/gns3server/controller/compute.py b/gns3server/controller/compute.py index 5e78780b..0ed27a3e 100644 --- a/gns3server/controller/compute.py +++ b/gns3server/controller/compute.py @@ -228,7 +228,7 @@ class Compute: Check if remote server is accessible """ if not self._connected: - response = yield from self._run_http_query("GET", "/server/version") + response = yield from self._run_http_query("GET", "/version") if "version" not in response.json: raise aiohttp.web.HTTPConflict(text="The server {} is not a GNS3 server".format(self._id)) diff --git a/gns3server/handlers/api/compute/version_handler.py b/gns3server/handlers/api/compute/version_handler.py index a84e507a..b45f4aa9 100644 --- a/gns3server/handlers/api/compute/version_handler.py +++ b/gns3server/handlers/api/compute/version_handler.py @@ -25,7 +25,7 @@ from aiohttp.web import HTTPConflict class VersionHandler: @Route.get( - r"/server/version", + r"/version", description="Retrieve the server version number", output=VERSION_SCHEMA) def version(request, response): @@ -35,7 +35,7 @@ class VersionHandler: response.json({"version": __version__, "local": local_server}) @Route.post( - r"/server/version", + r"/version", description="Check if version is the same as the server", output=VERSION_SCHEMA, input=VERSION_SCHEMA, diff --git a/gns3server/handlers/api/controller/server_handler.py b/gns3server/handlers/api/controller/server_handler.py index f81af854..69d9e91c 100644 --- a/gns3server/handlers/api/controller/server_handler.py +++ b/gns3server/handlers/api/controller/server_handler.py @@ -33,7 +33,7 @@ class ServerHandler: @classmethod @Route.post( - r"/server/shutdown", + r"/shutdown", description="Shutdown the local server", status_codes={ 201: "Server is shutting down", @@ -71,7 +71,7 @@ class ServerHandler: response.set_status(201) @Route.get( - r"/server/version", + r"/version", description="Retrieve the server version number", output=VERSION_SCHEMA) def version(request, response): @@ -81,7 +81,7 @@ class ServerHandler: response.json({"version": __version__, "local": local_server}) @Route.post( - r"/server/version", + r"/version", description="Check if version is the same as the server", output=VERSION_SCHEMA, input=VERSION_SCHEMA, diff --git a/tests/compute/qemu/test_qemu_vm.py b/tests/compute/qemu/test_qemu_vm.py index 157abb53..1b901c8a 100644 --- a/tests/compute/qemu/test_qemu_vm.py +++ b/tests/compute/qemu/test_qemu_vm.py @@ -200,7 +200,7 @@ def test_add_nio_binding_udp(vm, loop): @pytest.mark.skipif(sys.platform.startswith("win"), reason="Not supported on Windows") def test_add_nio_binding_ethernet(vm, loop, ethernet_device): with patch("gns3server.compute.base_manager.BaseManager.has_privileged_access", return_value=True): - nio = Qemu.instance().create_nio(vm.qemu_path, {"type": "nio_generic_ethernet", "ethernet_device": ethernet_device}) + nio = Qemu.instance().create_nio(vm.qemu_path, {"type": "nio_ethernet", "ethernet_device": ethernet_device}) loop.run_until_complete(asyncio.async(vm.adapter_add_nio_binding(0, nio))) assert nio.ethernet_device == ethernet_device diff --git a/tests/handlers/api/compute/test_iou.py b/tests/handlers/api/compute/test_iou.py index 12b6f361..b24b4fbe 100644 --- a/tests/handlers/api/compute/test_iou.py +++ b/tests/handlers/api/compute/test_iou.py @@ -220,24 +220,24 @@ def test_iou_nio_create_udp(http_compute, vm): def test_iou_nio_create_ethernet(http_compute, vm, ethernet_device): - response = http_compute.post("/projects/{project_id}/iou/nodes/{node_id}/adapters/1/ports/0/nio".format(project_id=vm["project_id"], node_id=vm["node_id"]), {"type": "nio_generic_ethernet", + response = http_compute.post("/projects/{project_id}/iou/nodes/{node_id}/adapters/1/ports/0/nio".format(project_id=vm["project_id"], node_id=vm["node_id"]), {"type": "nio_ethernet", "ethernet_device": ethernet_device, }, example=True) assert response.status == 201 assert response.route == "/projects/{project_id}/iou/nodes/{node_id}/adapters/{adapter_number:\d+}/ports/{port_number:\d+}/nio" - assert response.json["type"] == "nio_generic_ethernet" + assert response.json["type"] == "nio_ethernet" assert response.json["ethernet_device"] == ethernet_device def test_iou_nio_create_ethernet_different_port(http_compute, vm, ethernet_device): - response = http_compute.post("/projects/{project_id}/iou/nodes/{node_id}/adapters/0/ports/3/nio".format(project_id=vm["project_id"], node_id=vm["node_id"]), {"type": "nio_generic_ethernet", + response = http_compute.post("/projects/{project_id}/iou/nodes/{node_id}/adapters/0/ports/3/nio".format(project_id=vm["project_id"], node_id=vm["node_id"]), {"type": "nio_ethernet", "ethernet_device": ethernet_device, }, example=False) assert response.status == 201 assert response.route == "/projects/{project_id}/iou/nodes/{node_id}/adapters/{adapter_number:\d+}/ports/{port_number:\d+}/nio" - assert response.json["type"] == "nio_generic_ethernet" + assert response.json["type"] == "nio_ethernet" assert response.json["ethernet_device"] == ethernet_device diff --git a/tests/handlers/api/compute/test_qemu.py b/tests/handlers/api/compute/test_qemu.py index 9459a2b9..07ac8087 100644 --- a/tests/handlers/api/compute/test_qemu.py +++ b/tests/handlers/api/compute/test_qemu.py @@ -183,7 +183,7 @@ def test_qemu_nio_create_udp(http_compute, vm): def test_qemu_nio_create_ethernet(http_compute, vm): http_compute.put("/projects/{project_id}/qemu/nodes/{node_id}".format(project_id=vm["project_id"], node_id=vm["node_id"]), {"adapters": 2}) - response = http_compute.post("/projects/{project_id}/qemu/nodes/{node_id}/adapters/1/ports/0/nio".format(project_id=vm["project_id"], node_id=vm["node_id"]), {"type": "nio_generic_ethernet", + response = http_compute.post("/projects/{project_id}/qemu/nodes/{node_id}/adapters/1/ports/0/nio".format(project_id=vm["project_id"], node_id=vm["node_id"]), {"type": "nio_ethernet", "ethernet_device": "eth0", }, example=True) diff --git a/tests/handlers/api/controller/test_server.py b/tests/handlers/api/controller/test_server.py index e522ec0b..039e3a68 100644 --- a/tests/handlers/api/controller/test_server.py +++ b/tests/handlers/api/controller/test_server.py @@ -36,17 +36,17 @@ def test_shutdown_local(http_controller, web_server, config): web_server.shutdown_server.return_value = hello() config.set("Server", "local", True) - response = http_controller.post('/server/shutdown', example=True) + response = http_controller.post('/shutdown', example=True) assert response.status == 201 assert web_server.shutdown_server.called def test_shutdown_non_local(http_controller, web_server, config): """ - Dissalow shutdown of a non local GNS3 server + Disallow shutdown of a non local GNS3 server """ WebServer._instance = MagicMock() config.set("Server", "local", False) - response = http_controller.post('/server/shutdown') + response = http_controller.post('/shutdown') assert response.status == 403 assert not web_server.shutdown_server.called