82 Commits

Author SHA1 Message Date
YueGuobin
9721660cc3
Expose full interface address list and link state in cloud node API
Each host interface surfaced by the cloud node now reports:
- ip_addresses: every IPv4 and IPv6 address (previously only a single
  IPv4 was collected internally and then dropped before the response)
- status / speed / mtu / flags: operational state and link attributes
  sourced from psutil.net_if_stats(), with flags normalized to a list

The legacy ip_address / netmask / mac_address fields are preserved so
existing callers (compute link detection, GNS3 VM, VMware, has_netmask)
keep working. The new fields travel through the existing interfaces
payload that the controller forwards verbatim, so no controller-side
change is required and the PUT / ports_mapping flow is unaffected.
2026-07-10 13:56:07 +08:00
YueGuobin
ced73574b4
Fix delay filter validation: ensure delay: [0, X] returns proper error message
This fix addresses the issue where delay: [0, X] configurations were being
silently dropped instead of returning validation errors.

Changes:
- Created new utility function filter_inactive_filters() in packet_filter_validation.py
- Implemented smart filtering logic for delay filter that checks both latency and jitter:
  * delay: [0, 0] → User wants to disable delay, filter out silently
  * delay: [0, X] where X > 0 → Invalid config, keep for validation error
  * delay: [X, X] where X > 0 → Normal configuration, validate normally
- Simplified link.py update_filters() method to use the new utility function
- Added comprehensive tests for the new filtering logic

Before this fix:
- delay: [0, 100] would be silently dropped with no error message
- Users wouldn't know their configuration was invalid

After this fix:
- delay: [0, 100] returns proper error: "delay parameter Latency must be between 1 and 32767 ms, got: 0"
- delay: [0, 0] is correctly handled as intentional disable
- Normal delay configurations continue to work as expected
2026-05-31 22:35:58 +08:00
YueGuobin
0aa0467b02
Fix delay latency minimum: ubridge rejects latency <= 0
Align validation rules with ubridge source: delay latency must be > 0
(packet_filter.c delay_setup line 182). Update FILTERS definition in
link.py and test cases accordingly.
2026-05-30 01:21:00 +08:00
YueGuobin
7bcb96a368
Improve packet filter validation: use tcpdump, handle multi-line BPF, safe project load
Changes:
- Replace tshark BPF validation with tcpdump -d (calls pcap_compile
  internally like ubridge, returns instantly without waiting for traffic)
- Support multi-line BPF expressions: split on newlines and validate
  each line individually
- Always validate, never save invalid filters on error
- Drop invalid filters during project load with warning (prevents
  old topologies with bad filters from failing to open)
- Simplify test cases (no longer depend on tshark availability)
2026-05-30 01:02:21 +08:00
YueGuobin
87f38b1507
Add packet filter parameter validation to prevent ubridge errors
This commit implements comprehensive parameter validation for GNS3 packet
filters at the API layer, preventing invalid parameters from reaching
ubridge and causing technical errors.

## Changes

### New Features
- **Add packet filter validation module** (`gns3server/utils/packet_filter_validation.py`)
  - Validate parameter ranges for all filter types:
    - frequency_drop: -1 to 32767
    - packet_loss: 0 to 100%
    - delay: 0 to 32767ms (latency + jitter)
    - corrupt: 0 to 100%
  - **BPF syntax validation** using tshark (method from gns3_copilot)
  - Parameter count and type validation
  - User-friendly error messages with parameter details

### Integration
- **Integrate validation into Link.update_filters()** (`gns3server/controller/link.py`)
  - Validate parameters before applying filters
  - Raise ControllerError with clear error messages for invalid input
  - Prevent invalid parameters from reaching ubridge

### Testing
- **Add comprehensive test suite** (`tests/utils/test_packet_filter_validation.py`)
  - 15 test cases covering all validation scenarios
  - Tests for valid/invalid parameters, edge cases, and BPF syntax
  - All tests passing

## Benefits
- **Better UX**: Clear, actionable error messages instead of ubridge technical errors
- **Prevents crashes**: Validate parameters at API layer before reaching ubridge
- **Consistent validation**: Centralized validation logic for all filter types
- **BPF safety**: Syntax validation using tshark prevents invalid BPF expressions
2026-05-29 23:39:44 +08:00
Cristi
8ff1698bfb feat(compute): Added AsyncioSSHServer dedicated tests 2026-04-30 16:35:21 +03:00
Cristi
7f3468dcd3 Improved exception handling and telnet client disconnect 2026-03-24 15:23:00 +02:00
Cristi
83558d4d9f Enhancement: Re-write current Telnet server implementation using telnetlib3 library 2026-03-24 13:23:45 +02:00
grossmj
abaeab6242
Upgrade greenlet and sqlalchemy dependencies 2026-01-26 19:50:42 +08:00
grossmj
b84bedffec
Merge branch '2.2' into 3.0
# Conflicts:
#	tests/utils/test_images.py
2024-12-16 18:31:57 +07:00
grossmj
423d3fd82b
Fix tests 2024-12-16 18:30:30 +07:00
grossmj
b7d43b29cd
Fix tests after merging 2024-12-02 13:02:08 +10:00
grossmj
cbaa563996
Merge branch '2.2' into 3.0
# Conflicts:
#	CHANGELOG
#	gns3server/crash_report.py
#	gns3server/static/web-ui/index.html
#	gns3server/static/web-ui/main.9297104511b6616fc55c.js
#	gns3server/utils/images.py
#	gns3server/version.py
#	tests/api/routes/compute/test_dynamips_nodes.py
#	tests/handlers/api/compute/test_qemu.py
#	tests/utils/test_images.py
2024-12-02 12:16:34 +10:00
grossmj
3d58b437b4
Remove restrictions based on file extension when listing images and fix ELF header checks 2024-11-27 14:51:34 +10:00
grossmj
999f41b03e
Convert topologies < 3.0 to have valid node hostnames 2024-07-20 17:22:24 +02:00
grossmj
d3860ba84b
Merge branch '2.2' into 3.0
# Conflicts:
#	CHANGELOG
#	dev-requirements.txt
#	gns3server/compute/qemu/__init__.py
#	gns3server/compute/vmware/__init__.py
#	gns3server/controller/snapshot.py
#	gns3server/crash_report.py
#	gns3server/handlers/api/compute/atm_switch_handler.py
#	gns3server/run.py
#	gns3server/static/web-ui/26.77d4bfd104f37c42e028.js
#	gns3server/static/web-ui/index.html
#	gns3server/static/web-ui/runtime.415291667f70565cd8ef.js
#	gns3server/utils/__init__.py
#	gns3server/utils/images.py
#	gns3server/utils/interfaces.py
#	gns3server/version.py
#	gns3server/web/web_server.py
#	pytest.ini
#	requirements.txt
#	scripts/update-bundled-web-ui.sh
#	setup.py
#	tests/api/routes/compute/test_dynamips_nodes.py
#	tests/compute/builtin/nodes/test_cloud.py
#	tests/compute/docker/test_docker.py
#	tests/compute/docker/test_docker_vm.py
#	tests/compute/dynamips/test_dynamips_manager.py
#	tests/compute/dynamips/test_dynamips_router.py
#	tests/compute/iou/test_iou_vm.py
#	tests/compute/qemu/test_qcow2.py
#	tests/compute/qemu/test_qemu_manager.py
#	tests/compute/qemu/test_qemu_vm.py
#	tests/compute/test_base_node.py
#	tests/compute/test_manager.py
#	tests/compute/test_project.py
#	tests/compute/traceng/test_traceng_vm.py
#	tests/compute/virtualbox/test_virtualbox_manager.py
#	tests/compute/virtualbox/test_virtualbox_vm.py
#	tests/compute/vmware/test_vmware_manager.py
#	tests/compute/vmware/test_vmware_vm.py
#	tests/compute/vpcs/test_vpcs_vm.py
#	tests/conftest.py
#	tests/controller/gns3vm/test_remote_gns3_vm.py
#	tests/controller/gns3vm/test_virtualbox_gns3_vm.py
#	tests/controller/gns3vm/test_vmware_gns3_vm.py
#	tests/controller/test_export_project.py
#	tests/controller/test_gns3vm.py
#	tests/controller/test_import_project.py
#	tests/test_config.py
#	tests/utils/test_asyncio.py
#	tests/utils/test_images.py
#	tests/web/test_response.py
2024-05-16 17:53:39 +07:00
grossmj
46a9fdb61d
Remove event_loop 2024-05-09 17:53:02 +07:00
grossmj
33499be425
Fix warnings in tests 2024-05-09 17:11:12 +07:00
grossmj
081447ba2e
Fix tests. Ref #2376 2024-05-09 15:37:42 +07:00
grossmj
3106c8a6a2 Do not cache to md5sum file in some situations 2022-04-18 17:13:52 +07:00
grossmj
888c773dc0 Finish to clean up local setting usage. Ref #1460 2022-03-31 12:05:47 +08:00
grossmj
900d4f79ee "Local" command line parameter is only for stopping
a server that has been started by the desktop GUI
2022-03-30 18:38:34 +08:00
grossmj
74c675d5b0 Drop Windows support 2022-01-19 22:28:36 +10:30
grossmj
1b5a5de4bc Generate new config for each test. Fixes tests. 2021-04-12 19:37:59 +09:30
grossmj
30ebae207f Use Pydantic to validate the server config file. 2021-04-12 17:02:23 +09:30
grossmj
a92c47b310 Add HTTP client to reuse the aiohttp session where needed.
Remove unnecessary aiohttp exceptions.
2020-10-22 16:19:44 +10:30
grossmj
eb3cb8a41f Migration to FastAPI 2020-10-02 16:07:50 +09:30
grossmj
d3ea67da24 Refactor tests
* Use pytest-aiohttp
* Use the async def / await syntax.
* Fix tests to run with Python 3.8
2020-06-16 13:59:03 +09:30
ziajka
cbb6eccad8 Merge branch '2.2' of github.com:GNS3/gns3-server into 2.2 2019-03-21 10:39:55 +01:00
ziajka
9edbd27b4f Serve WebUI via get_resource for freezed app 2019-03-21 10:39:49 +01:00
grossmj
343f223a83 Fix tests after deactivating the embedded shell for Ethernet switch. Ref #1424 #1556 2019-03-20 17:04:02 +08:00
grossmj
17d070dca7 Early support for symbol themes. 2018-11-23 17:27:10 +07:00
grossmj
bc5eda8259 Restore previously removed test. 2018-11-20 14:36:18 +07:00
grossmj
c7b8c347d7 Remove problematic test when run on Travis. 2018-11-18 00:08:40 +07:00
grossmj
53f3821d41 Change test that randomly fails on Travis. 2018-11-17 23:23:28 +07:00
grossmj
ab8dc52ece Fix tests to work with new version of aiohttp (>= 3.0) 2018-10-17 17:32:10 +07:00
grossmj
76af98404a Drop Python 3.4 and switch to async / await syntax for asyncio. Fixes #1425 2018-10-15 17:05:49 +07:00
grossmj
33e8710495 Merge branch '2.1' into 2.2
# Conflicts:
#	gns3server/compute/docker/docker_vm.py
#	gns3server/controller/compute.py
#	gns3server/controller/gns3vm/__init__.py
#	gns3server/controller/link.py
#	gns3server/controller/project.py
#	gns3server/handlers/api/controller/project_handler.py
#	gns3server/handlers/api/controller/server_handler.py
#	gns3server/utils/asyncio/__init__.py
#	gns3server/utils/asyncio/telnet_server.py
#	gns3server/version.py
#	gns3server/web/web_server.py
#	tests/compute/qemu/test_qemu_vm.py
2018-08-29 15:57:54 +07:00
grossmj
902de3dd47 Refactor asyncio locking system for Python 3.7 support. Ref https://github.com/GNS3/gns3-gui/issues/2566 Ref https://github.com/GNS3/gns3-gui/issues/2568 2018-08-25 14:10:47 +07:00
grossmj
a3d1e865a8 Replace asyncio.async() by asyncio.ensure_future() in tests. Ref #2566. 2018-08-24 18:52:15 +07:00
ziajka
dd845eb096 Fix tests on Windows 2018-06-28 09:16:51 +02:00
ziajka
867e997b74 Support /static/ files serving, Ref: #1362 2018-06-22 15:29:47 +02:00
ziajka
dc377165f2 Cancellable md5sum calculation on thread, Ref. gui#2239 2018-01-29 10:18:13 +01:00
ziajka
d9a0ec9ff3 Replace asyncio.async with ensure_future because of deprecation, Fixes: #1269 2018-01-24 11:11:53 +01:00
Julien Duponchelle
5616ab0e9a
Fake console for simple Ethernet switch
Fix #454
2017-05-31 15:13:29 +02:00
Julien Duponchelle
c72ae1bfe7
Fix IOU test run on Windows 2017-04-18 16:21:45 +02:00
Julien Duponchelle
b4434b5134
Add tests for checking if path are correctly cleaned 2017-04-18 15:50:11 +02:00
Julien Duponchelle
51ef5d8c90
Fix a broken test on windows machines 2017-04-18 14:04:50 +02:00
Julien Duponchelle
961c209ab1
Fix an issue when getting size from some SVG file
Fix https://github.com/GNS3/gns3-gui/issues/1866
2017-02-20 17:25:26 +01:00
Julien Duponchelle
49315adf79
Do not recurse scan for images in standard image directory
Fix https://github.com/GNS3/gns3-gui/issues/1680
2016-11-28 19:49:50 +01:00