From 737664a3d47a8c62452e79c5d2a18355694d2704 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Konrad=20Go=C5=82awski?= Date: Thu, 12 Oct 2023 11:35:53 +0200 Subject: [PATCH 1/5] Add Qemu IGB network device --- gns3server/schemas/qemu_template.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/gns3server/schemas/qemu_template.py b/gns3server/schemas/qemu_template.py index 89bc55b2..0fc16b3d 100644 --- a/gns3server/schemas/qemu_template.py +++ b/gns3server/schemas/qemu_template.py @@ -65,8 +65,8 @@ QEMU_TEMPLATE_PROPERTIES = { "description": "QEMU adapter type", "type": "string", "enum": ["e1000", "e1000-82544gc", "e1000-82545em", "e1000e", "i82550", "i82551", "i82557a", "i82557b", "i82557c", "i82558a", - "i82558b", "i82559a", "i82559b", "i82559c", "i82559er", "i82562", "i82801", "ne2k_pci", "pcnet", "rocker", "rtl8139", - "virtio", "virtio-net-pci", "vmxnet3"], + "i82558b", "i82559a", "i82559b", "i82559c", "i82559er", "i82562", "i82801", "igb", "ne2k_pci", "pcnet", "rocker", + "rtl8139", "virtio", "virtio-net-pci", "vmxnet3"], "default": "e1000" }, "mac_address": { From 0d15f40930b6522bfe61e79d13cb94611c3c8ebd Mon Sep 17 00:00:00 2001 From: grossmj Date: Mon, 23 Oct 2023 15:16:49 +1000 Subject: [PATCH 2/5] Change "ip cef" to "no ip cef" in IOU default configs. Fixes #2298 --- gns3server/configs/iou_l2_base_startup-config.txt | 3 ++- gns3server/configs/iou_l3_base_startup-config.txt | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/gns3server/configs/iou_l2_base_startup-config.txt b/gns3server/configs/iou_l2_base_startup-config.txt index 501355f6..4a09db82 100644 --- a/gns3server/configs/iou_l2_base_startup-config.txt +++ b/gns3server/configs/iou_l2_base_startup-config.txt @@ -13,7 +13,8 @@ logging console discriminator EXCESS ! no ip icmp rate-limit unreachable ! -ip cef +! due to some bugs with IOU, try to change the following line to 'ip cef' if your routing does not work +no ip cef no ip domain-lookup ! ! diff --git a/gns3server/configs/iou_l3_base_startup-config.txt b/gns3server/configs/iou_l3_base_startup-config.txt index 81d574ff..67628f77 100644 --- a/gns3server/configs/iou_l3_base_startup-config.txt +++ b/gns3server/configs/iou_l3_base_startup-config.txt @@ -12,7 +12,8 @@ no ip icmp rate-limit unreachable ! ! ! -ip cef +! due to some bugs with IOU, try to change the following line to 'ip cef' if your routing does not work +no ip cef no ip domain-lookup ! ! From 4af5edbc037110907573240b9259450e0d00551b Mon Sep 17 00:00:00 2001 From: grossmj Date: Mon, 23 Oct 2023 15:21:06 +1000 Subject: [PATCH 3/5] Install aiohttp 3.9.0b0 when running on Python 3.12 --- requirements.txt | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/requirements.txt b/requirements.txt index 416969f9..da720397 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,6 +1,7 @@ jsonschema>=4.17.3,<4.18; python_version >= '3.7' # v4.17.3 is the last version to support Python 3.7 jsonschema==3.2.0; python_version < '3.7' # v3.2.0 is the last version to support Python 3.6 -aiohttp>=3.8.5,<3.9 +aiohttp>=3.8.5,<3.9; python_version < '3.12' +aiohttp==3.9.0b0; python_version == '3.12' aiohttp-cors>=0.7.0,<0.8 aiofiles>=23.2.1,<23.3; python_version >= '3.7' aiofiles==0.8.0; python_version < '3.7' # v0.8.0 is the last version to support Python 3.6 From 34ee75e1f1eabb7d24f035d3deeddf6ca5a3a9ea Mon Sep 17 00:00:00 2001 From: grossmj Date: Mon, 23 Oct 2023 16:12:12 +1000 Subject: [PATCH 4/5] Fix tests running on Python 3.12 --- tests/compute/qemu/test_qemu_vm.py | 25 +++++++++++++------------ tests/handlers/api/compute/test_qemu.py | 4 ++-- 2 files changed, 15 insertions(+), 14 deletions(-) diff --git a/tests/compute/qemu/test_qemu_vm.py b/tests/compute/qemu/test_qemu_vm.py index dcd4eac0..4b7c0685 100644 --- a/tests/compute/qemu/test_qemu_vm.py +++ b/tests/compute/qemu/test_qemu_vm.py @@ -208,18 +208,18 @@ async def test_termination_callback_error(vm, tmpdir): async def test_reload(vm): - with asyncio_patch("gns3server.compute.qemu.QemuVM._control_vm") as mock: + with asyncio_patch("gns3server.compute.qemu.QemuVM._control_vm") as m: await vm.reload() - assert mock.called_with("system_reset") + m.assert_called_with("system_reset") -async def test_suspend(vm): +async def test_suspend(vm, running_subprocess_mock): - control_vm_result = MagicMock() - control_vm_result.match.group.decode.return_value = "running" - with asyncio_patch("gns3server.compute.qemu.QemuVM._control_vm", return_value=control_vm_result) as mock: - await vm.suspend() - assert mock.called_with("system_reset") + vm._process = running_subprocess_mock + with asyncio_patch("gns3server.compute.qemu.QemuVM._get_vm_status", return_value="running"): + with asyncio_patch("gns3server.compute.qemu.QemuVM._control_vm") as m: + await vm.suspend() + m.assert_called_with("stop") async def test_add_nio_binding_udp(vm): @@ -490,14 +490,15 @@ def test_json(vm, compute_project): assert json["project_id"] == compute_project.id -async def test_control_vm(vm): +async def test_control_vm(vm, running_subprocess_mock): - vm._process = MagicMock() + vm._process = running_subprocess_mock + vm._monitor = 4242 reader = MagicMock() writer = MagicMock() with asyncio_patch("asyncio.open_connection", return_value=(reader, writer)): res = await vm._control_vm("test") - assert writer.write.called_with("test") + writer.write.assert_called_with(b"test\n") assert res is None @@ -514,7 +515,7 @@ async def test_control_vm_expect_text(vm, running_subprocess_mock): vm._monitor = 4242 res = await vm._control_vm("test", [b"epic"]) - assert writer.write.called_with("test") + writer.write.assert_called_with(b"test\n") assert res == "epic product" diff --git a/tests/handlers/api/compute/test_qemu.py b/tests/handlers/api/compute/test_qemu.py index 95611f10..752ff9a0 100644 --- a/tests/handlers/api/compute/test_qemu.py +++ b/tests/handlers/api/compute/test_qemu.py @@ -255,7 +255,7 @@ async def test_qemu_list_binaries(compute_api, vm): with asyncio_patch("gns3server.compute.qemu.Qemu.binary_list", return_value=ret) as mock: response = await compute_api.get("/qemu/binaries".format(project_id=vm["project_id"])) - assert mock.called_with(None) + mock.assert_called_with(None) assert response.status == 200 assert response.json == ret @@ -271,7 +271,7 @@ async def test_qemu_list_binaries_filter(compute_api, vm): with asyncio_patch("gns3server.compute.qemu.Qemu.binary_list", return_value=ret) as mock: response = await compute_api.get("/qemu/binaries".format(project_id=vm["project_id"]), body={"archs": ["i386"]}) assert response.status == 200 - assert mock.called_with(["i386"]) + mock.assert_called_with(["i386"]) assert response.json == ret From c759c4e3f607684e57ebd8ac3362e564bd164d3e Mon Sep 17 00:00:00 2001 From: grossmj Date: Mon, 23 Oct 2023 16:17:31 +1000 Subject: [PATCH 5/5] Upgrade to actions/checkout@v3 and actions/setup-python@v3 --- .github/workflows/testing.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/testing.yml b/.github/workflows/testing.yml index f7398a5a..6763ce51 100644 --- a/.github/workflows/testing.yml +++ b/.github/workflows/testing.yml @@ -19,9 +19,9 @@ jobs: python-version: ["3.6", "3.7", "3.8", "3.9", "3.10", "3.11", "3.12"] steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v3 - name: Set up Python ${{ matrix.python-version }} - uses: actions/setup-python@v2 + uses: actions/setup-python@v3 with: python-version: ${{ matrix.python-version }} - name: Install dependencies