6335 Commits

Author SHA1 Message Date
YueGuobin
aef337e86f feat(config): load secret files even without main config
When no configuration file is found or readable, the server now still loads secret files. This ensures that secret configurations (like API keys or passwords) are available even if the primary config file is missing, improving robustness and security in environments where secrets are stored separately.
2026-03-03 18:16:37 +08:00
YueGuobin
8e43ad4912 feat(db): replace PostgreSQL-specific JSONB with cross-database JSON type
- Change `JSONB` columns to generic `JSON` in LLMModelConfig model for database compatibility
- Update migration to use `sa.String(32)` for UUID and `sa.JSON()` for config fields
- Remove PostgreSQL dialect imports to support multiple database backends
- Keep existing constraints and indexes with PostgreSQL-specific annotations where needed
2026-03-03 18:03:16 +08:00
YueGuobin
3632641127 feat(db): update migration dependency to correct previous revision
The migration file `20260303_create_llm_model_configs_table.py` had an incorrect `down_revision` reference. Changed from `7ceeddd9c9a8` to `98083573d011` to properly link to the previous migration in the Alembic history. This ensures the migration chain is consistent and rollbacks work as expected.
2026-03-03 17:58:48 +08:00
YueGuobin
fc7275878e feat(db): replace deferred unique constraints with partial unique indexes for LLM model configs
Replace deferred UniqueConstraints with partial unique indexes for user and group default configurations in the LLM model configs table. This change improves performance and ensures at most one default config per user/group while maintaining data integrity. The migration script has been updated accordingly to create and drop the new indexes.
2026-03-03 17:57:32 +08:00
YueGuobin
d42fff49a5 feat(docs): enhance LLM model configs API documentation with schema updates
- Add `model_type` field to database schema with supported values (text, vision, stt, tts, multimodal, embedding, reranking, other)
- Add `name` field as table-level column for indexing and filtering
- Add reserved JSONB fields for future extensibility
- Update API request/response schemas to include `model_type` and `name` fields
- Add new `LLMModelConfigWithSource` schema for detailed configuration responses
- Update usage examples to reflect new required fields
- Improve database constraints and indexing documentation
2026-03-03 17:54:30 +08:00
YueGuobin
b968920a75 feat(docs): add optimistic locking documentation for LLM model configs API
Add comprehensive documentation for optimistic locking implementation in the LLM model configurations API. The update includes:

- Added "Optimistic Locking" feature to the overview section
- Added `version` field to the database schema table
- Updated `LLMModelConfigUpdate` schema to include `expected_version` parameter
- Updated `LLMModelConfigResponse` schema to include `version` field
- Added detailed examples for update operations with optimistic locking
- Included conflict handling workflow and client retry instructions

This documentation ensures users understand how to prevent concurrent modification conflicts when updating LLM model configurations.
2026-03-03 17:39:04 +08:00
YueGuobin
161b7feb01 feat(api): add optimistic locking to LLM model config updates
- Include `version` field in all LLM model config response schemas
- Add `expected_version` parameter to update endpoints for optimistic locking
- Handle concurrent modification errors with HTTP 409 Conflict status
- Update both user and group config endpoints consistently
2026-03-03 16:59:12 +08:00
YueGuobin
9315f06e1f feat(config): add encryption key loading for sensitive data
Add a new method `_load_encryption_key` to initialize encryption for sensitive data such as API keys. This method is called within `_load_secret_files` alongside JWT secret key loading, ensuring encryption is set up during server configuration. The change enhances security by enabling encryption for secrets stored in the server's secrets directory.
2026-03-03 16:46:23 +08:00
YueGuobin
8fad27d904 feat(db): improve database initialization and migration handling
- Add smarter database state detection during initialization to handle new databases, existing databases with new features, and old databases needing migration
- Make migration for llm_model_configs table idempotent to prevent conflicts when table already exists from code
- Add detailed logging for different database initialization scenarios
- Import sqlalchemy module for database inspection capabilities
2026-03-03 16:40:57 +08:00
YueGuobin
bbd34f1f67 feat(api): add LLM model configurations endpoint and schemas
- Introduce new API route `/access` for managing LLM model configurations
- Add LLMModelConfig model to database models
- Include comprehensive schemas for LLM model config CRUD operations
- Register new router with tags for LLM Model Configurations
2026-03-03 16:34:48 +08:00
Jeremy Grossmann
dce4a71004
Merge pull request #2619 from yueguobin/fix/docker-container-name-conflict
fix(docker): handle container name conflict automatically
2026-02-28 12:56:24 +08:00
grossmj
151feb369f
Development on 3.1.0.dev1 2026-02-28 11:35:46 +08:00
YueGuobin
ce90b2b92c fix(docker): handle container name conflict automatically
When a Docker container with the same name already exists (e.g., from a
   previous crashed GNS3 session), Docker returns a 409 Conflict error
   when trying to create a new container with that name. This causes the
   project open operation to fail.

   This fix adds automatic cleanup of stale containers when encountering
   a name conflict:
   - Added DockerHttp409Error exception class
   - Updated http_query to detect 409 status codes
   - Modified create() to remove conflicting containers and retry

   Fixes the issue where opening a project fails with:
   "Docker has returned an error: 409 Conflict. The container name
   '/GNS3.xxx' is already in use by container 'xxx'"
2026-02-27 23:35:11 +08:00
Jeremy Grossmann
a0116902a6
Merge pull request #2618 from yueguobin/fix-port-nonename-error
feat(virtualbox): add fallback for VBoxManage executable detection
2026-02-27 00:39:31 +08:00
YueGuobin
a343ace637 Revert: restore original port name handling logic 2026-02-27 00:12:30 +08:00
YueGuobin
fe73d0e935 Merge branch 'fix-vboxmanage-case-sensitivity' into fix-port-nonename-error 2026-02-26 10:02:43 +08:00
YueGuobin
c55fd9e066 feat(virtualbox): add fallback for VBoxManage executable detection
Add an additional fallback check for the VBoxManage executable using the capitalized "VBoxManage" command name. This improves compatibility on systems where the executable may be case-sensitive or installed with a different naming convention, ensuring the VirtualBox manager can locate the necessary binary when the lowercase "vboxmanage" is not found.
2026-02-26 09:57:51 +08:00
YueGuobin
cde4bdc114 feat: simplify port name assignment logic
Refactor port name assignment to use `or` operator for fallback values, improving code readability and consistency. Changes applied in `node.py` and `port_factory.py` to handle custom adapter settings more cleanly.
2026-02-25 22:41:22 +08:00
YueGuobin
f6777064db feat(ports): add null checks for port name in short name generation
Add conditional checks to ensure `self._name` is not None before performing string operations in the `short_name` property. This prevents potential AttributeError exceptions when port name is undefined, improving robustness and compatibility with edge cases in port configuration.
2026-02-25 22:21:05 +08:00
grossmj
4c6d40fd4b
Upgrade httpx_ws 2026-02-25 19:20:18 +08:00
grossmj
4a2c1b7b23
Fix installing pytest-asyncio with Python 3.9 2026-02-25 19:06:56 +08:00
grossmj
47a7324eb5
Fix tests 2026-02-25 19:00:57 +08:00
Jeremy Grossmann
4519130a8c
Merge pull request #2614 from yueguobin/3.0
Implement tags for nodes and templates
2026-02-25 00:33:15 +08:00
grossmj
ef7c271a9a
Development on 3.0.7.dev1 2026-02-24 21:32:36 +08:00
grossmj
ddacd956b2
Merge remote-tracking branch 'yueguobin/3.0' into fork/yueguobin/3.0 2026-02-23 23:32:15 +08:00
grossmj
547e68fd2b
Remove unneeded rbac_repo in get_templates 2026-02-23 23:31:35 +08:00
Jeremy Grossmann
11e36cb32c
Merge branch '3.0' into 3.0 2026-02-23 23:28:47 +08:00
grossmj
4d35477e46
Add/fix tests 2026-02-23 23:27:36 +08:00
grossmj
a9525503c6
Set up database schema migration 2026-02-23 23:27:10 +08:00
grossmj
bdcb6445c7
Use lists for tags instead of dicts 2026-02-23 23:26:42 +08:00
Jeremy Grossmann
c49aa761ab
Merge pull request #2617 from GNS3/bugfix/2560
Fix for resizing Qemu VMs disks
2026-02-23 17:18:57 +08:00
Jeremy Grossmann
c88ac0c595
Merge branch '3.0' into bugfix/2560 2026-02-23 17:14:38 +08:00
grossmj
8f470fbe55
Update FastAPI dependency to support Python 3.9 2026-02-23 17:14:16 +08:00
grossmj
c66e851498
Fix for resizing Qemu VM disks 2026-02-23 17:10:15 +08:00
grossmj
a6043f0fc6
Upgrade dependencies 2026-02-23 16:48:26 +08:00
Guobin Yue
66f32cecf2
Merge branch 'GNS3:3.0' into 3.0 2026-02-23 01:37:05 +08:00
YueGuobin
c05f667f3d feat(templates): safely access settings dict keys
Use dict.get() method to safely access 'image' and 'path' keys in settings dictionary to avoid KeyError exceptions when these keys are missing. This improves error handling and prevents server crashes when creating templates with incomplete settings.
2026-02-23 01:02:32 +08:00
YueGuobin
e27ddf2cdf feat(api): fix ETag handling and JSON serialization in template endpoint
- Use `default=str` in `json.dumps` to handle non-serializable objects
- Return proper HTTP 304 response with ETag header instead of raising exception
- Ensure consistent ETag generation for template caching
2026-02-22 23:43:47 +08:00
YueGuobin
a3616e6d33 feat(api): add tag filtering to nodes and templates endpoints
- Add optional `tags` query parameter to `/nodes` and `/templates` endpoints
- Support filtering by tags in format "key:value" with multiple tags ANDed together
- Example: `?tags=vendor:cisco&tags=model:7200` filters nodes/templates with both tags
- Maintain backward compatibility for existing API usage without tags parameter
2026-02-22 22:52:28 +08:00
Jeremy Grossmann
22c6b4b961
Merge pull request #2616 from StupidTreee/feature/project-created-by
Add 'created_by' field to track project creator
2026-02-22 18:33:54 +08:00
grossmj
be4b87e8cd
Update project schema and fix tests 2026-02-22 18:13:08 +08:00
Felix Schulz
8ab34924b5 Add 'created_by' field to track project creator 2026-02-21 22:15:21 +01:00
Jeremy Grossmann
1958deff09
Merge pull request #2615 from GNS3/bugfix/2532
Fix updating packet filters
2026-02-21 21:45:12 +08:00
grossmj
5e3ca29c58
Fix updating packet filters 2026-02-21 21:42:22 +08:00
grossmj
60abbade27
Revert merged changes from 2.2 introduced by PR #2607 2026-02-21 21:35:12 +08:00
YueGuobin
56ece7ce88 Add vendor, model and netmiko_device_type fields to templates
Add three new optional fields to the template schema:
- vendor: Device vendor (e.g., Cisco, Juniper, Huawei)
- model: Device model (e.g., ISR4451-X, MX204, NE40E)
- netmiko_device_type: Netmiko device type for automation (e.g., cisco_ios, juniper_junos, huawei)

These fields enable AI/LLM integration to determine the appropriate
Netmiko device type when automating network device configuration.

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
2026-02-20 23:38:00 +08:00
grossmj
c5b9f379fe
Merge remote-tracking branch 'origin/2.2' into 3.0
# Conflicts:
#	Dockerfile
#	dev-requirements.txt
#	gns3server/compute/qemu/qemu_vm.py
#	gns3server/version.py
#	requirements.txt
2026-02-20 16:28:53 +08:00
Jeremy Grossmann
3b95859b79
Merge pull request #2612 from dalearbo/fix/busybox-musl-ldd-check
fix: busybox static link detection on Alpine/musl
2026-02-20 16:01:01 +08:00
Jeremy Grossmann
126a4099e6
Merge pull request #2613 from dalearbo/fix/emit-threadpool-runtime-error
fix: handle RuntimeError in notification_manager emit()
2026-02-20 15:59:01 +08:00
grossmj
47cc827c1f
Remove some files not related to PR 2026-02-20 15:56:08 +08:00