mirror of
https://github.com/GNS3/gns3-server.git
synced 2026-10-05 18:21:05 +03:00
Merge pull request #2934 from markparonyan/ruff/pr01-imports
refactor: ruff fixes
This commit is contained in:
commit
084004586c
@ -34,8 +34,7 @@ AI_COPILOT_AVAILABLE = False
|
||||
|
||||
# Try to import AI Copilot components
|
||||
try:
|
||||
from .gns3_copilot.project_agent_manager import get_project_agent_manager
|
||||
from .gns3_copilot.project_agent_manager import ProjectAgentManager
|
||||
from .gns3_copilot.project_agent_manager import ProjectAgentManager, get_project_agent_manager
|
||||
|
||||
AI_COPILOT_AVAILABLE = True
|
||||
|
||||
|
||||
@ -46,8 +46,7 @@ import logging
|
||||
import os
|
||||
import warnings
|
||||
from pathlib import Path
|
||||
from typing import Any
|
||||
from typing import Callable
|
||||
from typing import Any, Callable
|
||||
|
||||
# Configure tiktoken cache directory (must be set before importing tiktoken)
|
||||
_cache_dir = Path(__file__).parent.parent / "cache" / "tiktoken"
|
||||
@ -55,9 +54,7 @@ _cache_dir.mkdir(parents=True, exist_ok=True)
|
||||
os.environ["TIKTOKEN_CACHE_DIR"] = str(_cache_dir)
|
||||
|
||||
import tiktoken
|
||||
from langchain_core.messages import BaseMessage
|
||||
from langchain_core.messages import SystemMessage
|
||||
from langchain_core.messages import trim_messages
|
||||
from langchain_core.messages import BaseMessage, SystemMessage, trim_messages
|
||||
|
||||
logger = logging.getLogger(__name__)
|
||||
|
||||
|
||||
@ -50,17 +50,12 @@ import json
|
||||
import logging
|
||||
import operator
|
||||
from datetime import datetime
|
||||
from typing import Annotated
|
||||
from typing import Literal
|
||||
from typing import Annotated, Literal
|
||||
|
||||
# Third-party imports
|
||||
from langchain.messages import AnyMessage
|
||||
from langchain.messages import SystemMessage
|
||||
from langchain.messages import ToolMessage
|
||||
from langchain.messages import AnyMessage, SystemMessage, ToolMessage
|
||||
from langchain_core.runnables import RunnableConfig
|
||||
from langgraph.graph import END
|
||||
from langgraph.graph import START
|
||||
from langgraph.graph import StateGraph
|
||||
from langgraph.graph import END, START, StateGraph
|
||||
from langgraph.managed.is_last_step import RemainingSteps
|
||||
from typing_extensions import TypedDict
|
||||
|
||||
@ -70,8 +65,6 @@ from gns3server.agent.gns3_copilot.agent.context_manager import (
|
||||
)
|
||||
from gns3server.agent.gns3_copilot.agent.model_factory import (
|
||||
create_base_model_with_tools,
|
||||
)
|
||||
from gns3server.agent.gns3_copilot.agent.model_factory import (
|
||||
create_title_model,
|
||||
)
|
||||
from gns3server.agent.gns3_copilot.gns3_client import GNS3TopologyTool
|
||||
@ -79,27 +72,23 @@ from gns3server.agent.gns3_copilot.gns3_client.context_helpers import (
|
||||
get_current_llm_config,
|
||||
)
|
||||
from gns3server.agent.gns3_copilot.prompts import load_system_prompt
|
||||
from gns3server.agent.gns3_copilot.skills import DeviceSkillsTool, InjectionSkillsTool, PacketAnalysisSkillsTool
|
||||
from gns3server.agent.gns3_copilot.skills.registry import get_prompt
|
||||
from gns3server.agent.gns3_copilot.tools_v2 import (
|
||||
ExecuteMultipleDeviceCommands,
|
||||
)
|
||||
from gns3server.agent.gns3_copilot.tools_v2 import (
|
||||
ExecuteMultipleDeviceConfigCommands,
|
||||
GNS3CreateNodeTool,
|
||||
GNS3LinkTool,
|
||||
GNS3PacketFilterTool,
|
||||
GNS3StartNodeTool,
|
||||
GNS3StopNodeTool,
|
||||
GNS3SuspendNodeTool,
|
||||
GNS3TemplateTool,
|
||||
GNS3UpdateNodeNameTool,
|
||||
GNS3WaitTool,
|
||||
PacketAnalysisTool,
|
||||
)
|
||||
from gns3server.agent.gns3_copilot.tools_v2 import GNS3CreateNodeTool
|
||||
from gns3server.agent.gns3_copilot.tools_v2 import GNS3LinkTool
|
||||
from gns3server.agent.gns3_copilot.tools_v2 import GNS3PacketFilterTool
|
||||
from gns3server.agent.gns3_copilot.tools_v2 import GNS3StartNodeTool
|
||||
from gns3server.agent.gns3_copilot.tools_v2 import GNS3StopNodeTool
|
||||
from gns3server.agent.gns3_copilot.tools_v2 import GNS3SuspendNodeTool
|
||||
from gns3server.agent.gns3_copilot.tools_v2 import GNS3TemplateTool
|
||||
from gns3server.agent.gns3_copilot.tools_v2 import GNS3UpdateNodeNameTool
|
||||
from gns3server.agent.gns3_copilot.tools_v2 import GNS3WaitTool
|
||||
from gns3server.agent.gns3_copilot.tools_v2.vpcs_tools_netmiko import VPCSCommands
|
||||
from gns3server.agent.gns3_copilot.tools_v2 import PacketAnalysisTool
|
||||
from gns3server.agent.gns3_copilot.skills import DeviceSkillsTool
|
||||
from gns3server.agent.gns3_copilot.skills import InjectionSkillsTool
|
||||
from gns3server.agent.gns3_copilot.skills import PacketAnalysisSkillsTool
|
||||
|
||||
# Set up logger for GNS3-Copilot
|
||||
logger = logging.getLogger(__name__)
|
||||
|
||||
@ -32,8 +32,7 @@ Configuration is passed directly from the database.
|
||||
"""
|
||||
|
||||
import logging
|
||||
from typing import Any
|
||||
from typing import Optional
|
||||
from typing import Any, Optional
|
||||
|
||||
from langchain.chat_models import init_chat_model
|
||||
|
||||
|
||||
@ -36,11 +36,7 @@ import json
|
||||
import logging
|
||||
import os
|
||||
from datetime import datetime
|
||||
from typing import Any
|
||||
from typing import AsyncGenerator
|
||||
from typing import Dict
|
||||
from typing import List
|
||||
from typing import Optional
|
||||
from typing import Any, AsyncGenerator, Dict, List, Optional
|
||||
from uuid import uuid4
|
||||
|
||||
import aiosqlite
|
||||
@ -53,8 +49,6 @@ from gns3server.agent.gns3_copilot.chat_sessions_repository import (
|
||||
)
|
||||
from gns3server.agent.gns3_copilot.gns3_client.context_helpers import (
|
||||
set_current_jwt_token,
|
||||
)
|
||||
from gns3server.agent.gns3_copilot.gns3_client.context_helpers import (
|
||||
set_current_llm_config,
|
||||
)
|
||||
from gns3server.agent.gns3_copilot.utils.error_handler import format_error_message
|
||||
|
||||
@ -33,10 +33,7 @@ checkpoint database.
|
||||
import json
|
||||
import logging
|
||||
from datetime import datetime
|
||||
from typing import Any
|
||||
from typing import Dict
|
||||
from typing import List
|
||||
from typing import Optional
|
||||
from typing import Any, Dict, List, Optional
|
||||
|
||||
import aiosqlite
|
||||
|
||||
|
||||
@ -47,14 +47,18 @@ The connector is adapted from the upstream gns3fy project
|
||||
|
||||
from .api_handlers import build_gns3_ctx
|
||||
from .connector import Gns3Connector
|
||||
from .connector_factory import get_gns3_connector
|
||||
from .connector_factory import get_gns3_connector_with_llm_config
|
||||
from .connector_factory import get_gns3_server_host
|
||||
from .connector_factory import get_llm_config
|
||||
from .context_helpers import get_current_jwt_token
|
||||
from .context_helpers import get_current_llm_config
|
||||
from .context_helpers import set_current_jwt_token
|
||||
from .context_helpers import set_current_llm_config
|
||||
from .connector_factory import (
|
||||
get_gns3_connector,
|
||||
get_gns3_connector_with_llm_config,
|
||||
get_gns3_server_host,
|
||||
get_llm_config,
|
||||
)
|
||||
from .context_helpers import (
|
||||
get_current_jwt_token,
|
||||
get_current_llm_config,
|
||||
set_current_jwt_token,
|
||||
set_current_llm_config,
|
||||
)
|
||||
from .gns3_project_info import GNS3ProjectInfoTool
|
||||
from .gns3_topology_reader import GNS3TopologyTool
|
||||
|
||||
|
||||
@ -47,16 +47,14 @@ Copilot-side callers build the context with :func:`build_gns3_ctx`, which
|
||||
pulls the request-scoped user JWT from the context variables.
|
||||
"""
|
||||
|
||||
from typing import Any
|
||||
from concurrent.futures import ThreadPoolExecutor
|
||||
|
||||
import hashlib
|
||||
import logging
|
||||
|
||||
from gns3server.services import access_ticket_service
|
||||
from gns3server.services.access_tickets import DEFAULT_TICKET_TTL
|
||||
from concurrent.futures import ThreadPoolExecutor
|
||||
from typing import Any
|
||||
|
||||
from gns3server.agent.gns3_copilot.gns3_client.connector import Gns3Connector
|
||||
from gns3server.services import access_ticket_service
|
||||
from gns3server.services.access_tickets import DEFAULT_TICKET_TTL
|
||||
|
||||
log = logging.getLogger(__name__)
|
||||
|
||||
|
||||
@ -49,14 +49,13 @@ import logging
|
||||
from typing import Optional
|
||||
from uuid import UUID
|
||||
|
||||
from gns3server.agent.gns3_copilot.gns3_client.context_helpers import (
|
||||
get_current_jwt_token,
|
||||
)
|
||||
|
||||
# Local imports
|
||||
from gns3server.agent.gns3_copilot.gns3_client.connector import (
|
||||
Gns3Connector,
|
||||
)
|
||||
from gns3server.agent.gns3_copilot.gns3_client.context_helpers import (
|
||||
get_current_jwt_token,
|
||||
)
|
||||
|
||||
logger = logging.getLogger(__name__)
|
||||
|
||||
|
||||
@ -33,8 +33,7 @@ database.
|
||||
|
||||
import asyncio
|
||||
import logging
|
||||
from typing import Dict
|
||||
from typing import Optional
|
||||
from typing import Dict, Optional
|
||||
|
||||
from gns3server.agent.gns3_copilot.agent_service import AgentService
|
||||
|
||||
|
||||
@ -36,23 +36,23 @@ Directory Structure:
|
||||
- loader.py # SkillsLoader - YAML/Markdown file loading
|
||||
"""
|
||||
|
||||
from .loader import SkillsLoader
|
||||
from .manager import SkillsManager
|
||||
from .registry import (
|
||||
SKILLS_REGISTRY,
|
||||
INJECTION_SKILLS_REGISTRY,
|
||||
get_skill,
|
||||
get_injection_skill,
|
||||
SKILLS_REGISTRY,
|
||||
DeviceSkillsTool,
|
||||
InjectionSkillsTool,
|
||||
PacketAnalysisSkillsTool,
|
||||
set_skills_manager,
|
||||
get_injection_skill,
|
||||
get_skill,
|
||||
get_skills_manager,
|
||||
reload_injection_skills,
|
||||
reload_forbidden_commands,
|
||||
reload_skills_repository,
|
||||
get_skills_repository_info,
|
||||
reload_forbidden_commands,
|
||||
reload_injection_skills,
|
||||
reload_skills_repository,
|
||||
set_skills_manager,
|
||||
)
|
||||
from .manager import SkillsManager
|
||||
from .loader import SkillsLoader
|
||||
|
||||
__all__ = [
|
||||
"INJECTION_SKILLS_REGISTRY",
|
||||
|
||||
@ -33,7 +33,7 @@ including Git operations and hot reload of skills.
|
||||
import logging
|
||||
import os
|
||||
from pathlib import Path
|
||||
from typing import Optional, Dict, Any
|
||||
from typing import Any, Dict, Optional
|
||||
|
||||
try:
|
||||
import git
|
||||
@ -43,6 +43,7 @@ except ImportError:
|
||||
GIT_AVAILABLE = False
|
||||
|
||||
from gns3server.config import Config
|
||||
|
||||
from .loader import SkillsLoader
|
||||
|
||||
logger = logging.getLogger(__name__)
|
||||
|
||||
@ -183,8 +183,8 @@ def reload_skills_repository() -> dict[str, Any]:
|
||||
protocols_ok = manager.reload_packet_analysis_protocols()
|
||||
|
||||
# Reload forbidden commands (local import to avoid circular dependency)
|
||||
from gns3server.agent.gns3_copilot.utils.command_filter import reload_forbidden_commands as _reload_fc
|
||||
from gns3server.agent.gns3_copilot.utils.command_filter import get_forbidden_commands
|
||||
from gns3server.agent.gns3_copilot.utils.command_filter import reload_forbidden_commands as _reload_fc
|
||||
|
||||
_reload_fc()
|
||||
forbidden_commands = get_forbidden_commands()
|
||||
@ -300,8 +300,8 @@ def reload_forbidden_commands() -> dict[str, Any]:
|
||||
}
|
||||
"""
|
||||
try:
|
||||
from gns3server.agent.gns3_copilot.utils.command_filter import reload_forbidden_commands as _reload
|
||||
from gns3server.agent.gns3_copilot.utils.command_filter import get_forbidden_commands
|
||||
from gns3server.agent.gns3_copilot.utils.command_filter import reload_forbidden_commands as _reload
|
||||
|
||||
_reload()
|
||||
commands = get_forbidden_commands()
|
||||
|
||||
@ -58,8 +58,7 @@ from .gns3_create_link import GNS3LinkTool
|
||||
from .gns3_create_node import GNS3CreateNodeTool
|
||||
from .gns3_get_node_temp import GNS3TemplateTool
|
||||
from .gns3_packet_filter import GNS3PacketFilterTool
|
||||
from .gns3_start_node import GNS3StartNodeQuickTool
|
||||
from .gns3_start_node import GNS3StartNodeTool
|
||||
from .gns3_start_node import GNS3StartNodeQuickTool, GNS3StartNodeTool
|
||||
from .gns3_stop_node import GNS3StopNodeTool
|
||||
from .gns3_suspend_node import GNS3SuspendNodeTool
|
||||
from .gns3_update_node_name import GNS3UpdateNodeNameTool
|
||||
|
||||
@ -43,21 +43,18 @@ from langchain_core.callbacks import CallbackManagerForToolRun
|
||||
from netmiko.exceptions import ReadTimeout
|
||||
from nornir import InitNornir
|
||||
from nornir.core import Nornir
|
||||
from nornir.core.task import AggregatedResult
|
||||
from nornir.core.task import Result
|
||||
from nornir.core.task import Task
|
||||
from nornir.core.task import AggregatedResult, Result, Task
|
||||
from nornir_netmiko.tasks import netmiko_send_config
|
||||
|
||||
from gns3server.agent.gns3_copilot.gns3_client import get_gns3_server_host
|
||||
from gns3server.agent.gns3_copilot.utils import get_device_ports_from_topology
|
||||
from gns3server.agent.gns3_copilot.utils.command_filter import (
|
||||
filter_forbidden_commands,
|
||||
)
|
||||
|
||||
# Import custom Netmiko device types for GNS3 emulation
|
||||
# This registers gns3_huawei_telnet_ce and other custom device types
|
||||
# NOTE: Must be imported BEFORE any Nornir operations to ensure device types are registered
|
||||
from gns3server.agent.gns3_copilot.utils import custom_netmiko
|
||||
from gns3server.agent.gns3_copilot.utils import custom_netmiko, get_device_ports_from_topology
|
||||
from gns3server.agent.gns3_copilot.utils.command_filter import (
|
||||
filter_forbidden_commands,
|
||||
)
|
||||
|
||||
# Explicitly register custom device types to ensure they are available
|
||||
# This is a safety measure in case the auto-registration on import doesn't work
|
||||
|
||||
@ -43,21 +43,18 @@ from langchain_core.callbacks import CallbackManagerForToolRun
|
||||
from netmiko.exceptions import ReadTimeout
|
||||
from nornir import InitNornir
|
||||
from nornir.core import Nornir
|
||||
from nornir.core.task import AggregatedResult
|
||||
from nornir.core.task import Result
|
||||
from nornir.core.task import Task
|
||||
from nornir.core.task import AggregatedResult, Result, Task
|
||||
from nornir_netmiko.tasks import netmiko_multiline
|
||||
|
||||
from gns3server.agent.gns3_copilot.gns3_client import get_gns3_server_host
|
||||
from gns3server.agent.gns3_copilot.utils import get_device_ports_from_topology
|
||||
from gns3server.agent.gns3_copilot.utils.command_filter import (
|
||||
filter_forbidden_commands,
|
||||
)
|
||||
|
||||
# Import custom Netmiko device types for GNS3 emulation
|
||||
# This registers gns3_huawei_telnet_ce and other custom device types
|
||||
# NOTE: Must be imported BEFORE any Nornir operations to ensure device types are registered
|
||||
from gns3server.agent.gns3_copilot.utils import custom_netmiko
|
||||
from gns3server.agent.gns3_copilot.utils import custom_netmiko, get_device_ports_from_topology
|
||||
from gns3server.agent.gns3_copilot.utils.command_filter import (
|
||||
filter_forbidden_commands,
|
||||
)
|
||||
|
||||
# Explicitly register custom device types to ensure they are available
|
||||
# This is a safety measure in case the auto-registration on import doesn't work
|
||||
|
||||
@ -43,18 +43,15 @@ from langchain_core.callbacks import CallbackManagerForToolRun
|
||||
from netmiko.exceptions import ReadTimeout
|
||||
from nornir import InitNornir
|
||||
from nornir.core import Nornir
|
||||
from nornir.core.task import AggregatedResult
|
||||
from nornir.core.task import Result
|
||||
from nornir.core.task import Task
|
||||
from nornir.core.task import AggregatedResult, Result, Task
|
||||
from nornir_netmiko.tasks import netmiko_multiline
|
||||
|
||||
from gns3server.agent.gns3_copilot.gns3_client import get_gns3_server_host
|
||||
from gns3server.agent.gns3_copilot.utils import get_device_ports_from_topology
|
||||
|
||||
# Import custom Netmiko device types for GNS3 emulation
|
||||
# This registers gns3_vpcs_telnet and other custom device types
|
||||
# NOTE: Must be imported BEFORE any Nornir operations to ensure device types are registered
|
||||
from gns3server.agent.gns3_copilot.utils import custom_netmiko
|
||||
from gns3server.agent.gns3_copilot.utils import custom_netmiko, get_device_ports_from_topology
|
||||
|
||||
# Explicitly register VPCS device type to ensure it is available
|
||||
try:
|
||||
|
||||
@ -39,9 +39,7 @@ Author: Yue Guobin (岳国宾)
|
||||
# Import main utility functions
|
||||
from .error_handler import format_error_message
|
||||
from .get_gns3_device_port import get_device_ports_from_topology
|
||||
from .parse_tool_content import format_tool_response
|
||||
from .parse_tool_content import normalize_tool_response
|
||||
from .parse_tool_content import parse_tool_content
|
||||
from .parse_tool_content import format_tool_response, normalize_tool_response, parse_tool_content
|
||||
|
||||
# Dynamic version management
|
||||
try:
|
||||
|
||||
@ -31,8 +31,8 @@ Features:
|
||||
|
||||
import os
|
||||
import sys
|
||||
from typing import Dict, List, Tuple
|
||||
from datetime import datetime
|
||||
from typing import Dict, List, Tuple
|
||||
|
||||
|
||||
def get_netmiko_version() -> str:
|
||||
|
||||
@ -18,10 +18,10 @@ This script tests:
|
||||
Run with: python test_huawei_ce.py
|
||||
"""
|
||||
|
||||
import os
|
||||
import sys
|
||||
import unittest
|
||||
from unittest.mock import Mock, patch
|
||||
import os
|
||||
|
||||
# Add project root to path using relative path
|
||||
test_dir = os.path.dirname(os.path.abspath(__file__))
|
||||
|
||||
@ -18,10 +18,10 @@ This script tests:
|
||||
Run with: python test_ruijie_telnet.py
|
||||
"""
|
||||
|
||||
import os
|
||||
import sys
|
||||
import unittest
|
||||
from unittest.mock import Mock, patch
|
||||
import os
|
||||
|
||||
# Add project root to path using relative path
|
||||
test_dir = os.path.dirname(os.path.abspath(__file__))
|
||||
|
||||
@ -20,10 +20,10 @@ This script tests:
|
||||
Run with: python test_vpcs_telnet.py
|
||||
"""
|
||||
|
||||
import os
|
||||
import sys
|
||||
import unittest
|
||||
from unittest.mock import Mock, patch, MagicMock
|
||||
import os
|
||||
from unittest.mock import MagicMock, Mock, patch
|
||||
|
||||
# Add project root to path using relative path
|
||||
test_dir = os.path.dirname(os.path.abspath(__file__))
|
||||
|
||||
@ -47,7 +47,6 @@ import time
|
||||
|
||||
from netmiko.base_connection import BaseConnection
|
||||
|
||||
|
||||
logger = logging.getLogger(__name__)
|
||||
|
||||
# ANSI escape code pattern for stripping terminal formatting codes
|
||||
|
||||
@ -31,8 +31,7 @@ Supports ellipse and rectangle shapes for two-node annotations.
|
||||
"""
|
||||
|
||||
import math
|
||||
from typing import Any
|
||||
from typing import Literal
|
||||
from typing import Any, Literal
|
||||
|
||||
# Default parameters
|
||||
DEFAULT_DEVICE_WIDTH = 50
|
||||
|
||||
@ -43,9 +43,7 @@ Usage:
|
||||
"""
|
||||
|
||||
import logging
|
||||
from typing import Any
|
||||
from typing import Dict
|
||||
from typing import Optional
|
||||
from typing import Any, Dict, Optional
|
||||
from uuid import UUID
|
||||
|
||||
from fastapi import FastAPI
|
||||
|
||||
@ -31,14 +31,9 @@ Converts between LangChain messages and OpenAI-compatible format.
|
||||
|
||||
import json
|
||||
import uuid
|
||||
from typing import Any
|
||||
from typing import Dict
|
||||
from typing import Any, Dict
|
||||
|
||||
from langchain_core.messages import AIMessage
|
||||
from langchain_core.messages import HumanMessage
|
||||
from langchain_core.messages import SystemMessage
|
||||
from langchain_core.messages import ToolCall
|
||||
from langchain_core.messages import ToolMessage
|
||||
from langchain_core.messages import AIMessage, HumanMessage, SystemMessage, ToolCall, ToolMessage
|
||||
|
||||
|
||||
def _ensure_string(content: Any) -> str:
|
||||
|
||||
@ -26,54 +26,65 @@ Implements the standard MCP protocol over SSE transport using FastMCP:
|
||||
Tools are registered via @mcp.tool() decorators.
|
||||
"""
|
||||
|
||||
import asyncio
|
||||
import contextvars
|
||||
import json
|
||||
import asyncio
|
||||
import logging
|
||||
import socket
|
||||
from uuid import UUID
|
||||
import bcrypt
|
||||
from typing import Any, Annotated
|
||||
from typing import Annotated, Any
|
||||
from urllib.parse import parse_qs
|
||||
from uuid import UUID
|
||||
|
||||
import bcrypt
|
||||
from fastapi import APIRouter
|
||||
from fastapi.responses import Response
|
||||
|
||||
from pydantic import Field
|
||||
|
||||
from mcp.server.fastmcp import FastMCP
|
||||
from mcp.server.transport_security import TransportSecuritySettings
|
||||
|
||||
from pydantic import Field
|
||||
from sqlalchemy import select
|
||||
from sqlalchemy.ext.asyncio import AsyncSession
|
||||
|
||||
from gns3server.config import Config
|
||||
from gns3server.services.authentication import AuthService
|
||||
import gns3server.db.models as models
|
||||
from gns3server.services import auth_service
|
||||
from gns3server.utils.request_utils import extract_client_info
|
||||
from gns3server.agent.gns3_copilot.gns3_client.api_handlers import (
|
||||
available_filters_handler,
|
||||
create_link_handler,
|
||||
create_node_handler,
|
||||
delete_link_handler,
|
||||
delete_node_file_handler,
|
||||
delete_node_handler,
|
||||
download_capture_file_handler,
|
||||
duplicate_node_handler,
|
||||
get_link_handler,
|
||||
get_links_handler,
|
||||
get_node_console_info_handler,
|
||||
get_node_file_handler,
|
||||
get_node_handler,
|
||||
get_node_links_handler,
|
||||
get_nodes_handler,
|
||||
isolate_node_handler,
|
||||
link_marker_handler,
|
||||
list_node_files_handler,
|
||||
marker_definition_handler,
|
||||
reset_link_handler,
|
||||
start_all_nodes_handler,
|
||||
start_capture_handler,
|
||||
start_node_handler,
|
||||
stop_all_nodes_handler,
|
||||
stop_capture_handler,
|
||||
stop_node_handler,
|
||||
suspend_all_nodes_handler,
|
||||
suspend_node_handler,
|
||||
unisolate_node_handler,
|
||||
update_link_handler,
|
||||
update_node_handler,
|
||||
write_node_file_handler,
|
||||
)
|
||||
from gns3server.config import Config
|
||||
from gns3server.db.repositories.api_keys import ApiKeysRepository
|
||||
from gns3server.db.repositories.users import UsersRepository
|
||||
from .projects import (
|
||||
list_projects_handler,
|
||||
get_project_handler,
|
||||
create_project_handler,
|
||||
delete_project_handler,
|
||||
open_project_handler,
|
||||
close_project_handler,
|
||||
get_project_stats_handler,
|
||||
update_project_handler,
|
||||
duplicate_project_handler,
|
||||
get_project_readme_handler,
|
||||
update_project_readme_handler,
|
||||
lock_project_handler,
|
||||
unlock_project_handler,
|
||||
get_locked_project_handler,
|
||||
)
|
||||
from .server import (
|
||||
get_version_handler,
|
||||
get_statistics_handler,
|
||||
)
|
||||
from gns3server.services import auth_service
|
||||
from gns3server.services.authentication import AuthService
|
||||
from gns3server.utils.request_utils import extract_client_info
|
||||
|
||||
# Symbol tools are disabled for now: they require a vision-capable model to
|
||||
# be genuinely useful (the tools shuttle SVG content, which a text-only LLM
|
||||
@ -84,80 +95,66 @@ from .server import (
|
||||
# upload_symbol_handler, delete_symbol_handler,
|
||||
# )
|
||||
from .appliances import (
|
||||
get_appliances_handler,
|
||||
get_appliance_handler,
|
||||
get_appliances_handler,
|
||||
install_appliance_handler,
|
||||
)
|
||||
from .images import (
|
||||
get_images_handler,
|
||||
get_image_handler,
|
||||
delete_image_handler,
|
||||
prune_images_handler,
|
||||
install_images_handler,
|
||||
from .computes import (
|
||||
get_compute_handler,
|
||||
get_compute_images_handler,
|
||||
list_computes_handler,
|
||||
)
|
||||
from .device_config import (
|
||||
device_config_send_handler,
|
||||
device_show_run_handler,
|
||||
vpcs_config_set_handler,
|
||||
)
|
||||
from gns3server.agent.gns3_copilot.gns3_client.api_handlers import (
|
||||
get_nodes_handler,
|
||||
get_node_handler,
|
||||
start_node_handler,
|
||||
stop_node_handler,
|
||||
suspend_node_handler,
|
||||
create_node_handler,
|
||||
delete_node_handler,
|
||||
update_node_handler,
|
||||
get_node_console_info_handler,
|
||||
list_node_files_handler,
|
||||
get_node_file_handler,
|
||||
write_node_file_handler,
|
||||
delete_node_file_handler,
|
||||
start_all_nodes_handler,
|
||||
stop_all_nodes_handler,
|
||||
suspend_all_nodes_handler,
|
||||
duplicate_node_handler,
|
||||
isolate_node_handler,
|
||||
unisolate_node_handler,
|
||||
get_node_links_handler,
|
||||
get_links_handler,
|
||||
get_link_handler,
|
||||
available_filters_handler,
|
||||
create_link_handler,
|
||||
delete_link_handler,
|
||||
update_link_handler,
|
||||
reset_link_handler,
|
||||
start_capture_handler,
|
||||
stop_capture_handler,
|
||||
download_capture_file_handler,
|
||||
link_marker_handler,
|
||||
marker_definition_handler,
|
||||
from .drawings import (
|
||||
create_drawing_handler,
|
||||
delete_drawing_handler,
|
||||
get_drawing_handler,
|
||||
get_drawings_handler,
|
||||
update_drawing_handler,
|
||||
)
|
||||
from .templates import (
|
||||
list_templates_handler,
|
||||
get_template_handler,
|
||||
create_template_handler,
|
||||
update_template_handler,
|
||||
delete_template_handler,
|
||||
from .images import (
|
||||
delete_image_handler,
|
||||
get_image_handler,
|
||||
get_images_handler,
|
||||
install_images_handler,
|
||||
prune_images_handler,
|
||||
)
|
||||
from .computes import (
|
||||
list_computes_handler,
|
||||
get_compute_handler,
|
||||
get_compute_images_handler,
|
||||
from .projects import (
|
||||
close_project_handler,
|
||||
create_project_handler,
|
||||
delete_project_handler,
|
||||
duplicate_project_handler,
|
||||
get_locked_project_handler,
|
||||
get_project_handler,
|
||||
get_project_readme_handler,
|
||||
get_project_stats_handler,
|
||||
list_projects_handler,
|
||||
lock_project_handler,
|
||||
open_project_handler,
|
||||
unlock_project_handler,
|
||||
update_project_handler,
|
||||
update_project_readme_handler,
|
||||
)
|
||||
from .server import (
|
||||
get_statistics_handler,
|
||||
get_version_handler,
|
||||
)
|
||||
from .snapshots import (
|
||||
get_snapshots_handler,
|
||||
create_snapshot_handler,
|
||||
delete_snapshot_handler,
|
||||
get_snapshots_handler,
|
||||
restore_snapshot_handler,
|
||||
)
|
||||
from .drawings import (
|
||||
get_drawings_handler,
|
||||
create_drawing_handler,
|
||||
get_drawing_handler,
|
||||
update_drawing_handler,
|
||||
delete_drawing_handler,
|
||||
from .templates import (
|
||||
create_template_handler,
|
||||
delete_template_handler,
|
||||
get_template_handler,
|
||||
list_templates_handler,
|
||||
update_template_handler,
|
||||
)
|
||||
|
||||
log = logging.getLogger(__name__)
|
||||
|
||||
@ -19,9 +19,8 @@
|
||||
MCP tool handlers for GNS3 appliance management.
|
||||
"""
|
||||
|
||||
from typing import Any
|
||||
|
||||
import logging
|
||||
from typing import Any
|
||||
|
||||
log = logging.getLogger(__name__)
|
||||
|
||||
|
||||
@ -19,8 +19,8 @@
|
||||
MCP tool handlers for GNS3 compute management.
|
||||
"""
|
||||
|
||||
from typing import Any
|
||||
import logging
|
||||
from typing import Any
|
||||
|
||||
log = logging.getLogger(__name__)
|
||||
|
||||
|
||||
@ -33,7 +33,8 @@ import json
|
||||
import logging
|
||||
from typing import Any
|
||||
|
||||
from jinja2 import Template as JinjaTemplate, TemplateError as JinjaError
|
||||
from jinja2 import Template as JinjaTemplate
|
||||
from jinja2 import TemplateError as JinjaError
|
||||
|
||||
log = logging.getLogger(__name__)
|
||||
|
||||
|
||||
@ -19,9 +19,8 @@
|
||||
MCP tool handlers for GNS3 drawing management.
|
||||
"""
|
||||
|
||||
from typing import Any
|
||||
|
||||
import logging
|
||||
from typing import Any
|
||||
|
||||
log = logging.getLogger(__name__)
|
||||
|
||||
|
||||
@ -19,9 +19,8 @@
|
||||
MCP tool handlers for GNS3 image management.
|
||||
"""
|
||||
|
||||
from typing import Any
|
||||
|
||||
import logging
|
||||
from typing import Any
|
||||
|
||||
log = logging.getLogger(__name__)
|
||||
|
||||
|
||||
@ -22,9 +22,8 @@ Tool handlers receive (params, gns3_ctx) and call GNS3's REST API
|
||||
via Gns3Connector (from gns3_copilot.gns3_client.connector).
|
||||
"""
|
||||
|
||||
from typing import Any
|
||||
|
||||
import logging
|
||||
from typing import Any
|
||||
|
||||
log = logging.getLogger(__name__)
|
||||
|
||||
|
||||
@ -19,9 +19,8 @@
|
||||
MCP tool handlers for GNS3 server information.
|
||||
"""
|
||||
|
||||
from typing import Any
|
||||
|
||||
import logging
|
||||
from typing import Any
|
||||
|
||||
log = logging.getLogger(__name__)
|
||||
|
||||
|
||||
@ -19,9 +19,8 @@
|
||||
MCP tool handlers for GNS3 snapshot management.
|
||||
"""
|
||||
|
||||
from typing import Any
|
||||
|
||||
import logging
|
||||
from typing import Any
|
||||
|
||||
log = logging.getLogger(__name__)
|
||||
|
||||
|
||||
@ -19,9 +19,8 @@
|
||||
MCP tool handlers for GNS3 symbol management.
|
||||
"""
|
||||
|
||||
from typing import Any
|
||||
|
||||
import logging
|
||||
from typing import Any
|
||||
|
||||
from gns3server.services import access_ticket_service
|
||||
|
||||
|
||||
@ -22,9 +22,8 @@ Handlers receive (params, gns3_ctx) and call GNS3's REST API
|
||||
via Gns3Connector (from gns3_copilot.gns3_client.connector).
|
||||
"""
|
||||
|
||||
from typing import Any
|
||||
|
||||
import logging
|
||||
from typing import Any
|
||||
|
||||
log = logging.getLogger(__name__)
|
||||
|
||||
|
||||
@ -67,12 +67,12 @@ For more information on each command, use:
|
||||
python manage_wireshark.py <command> --help
|
||||
"""
|
||||
|
||||
import sys
|
||||
import json
|
||||
import argparse
|
||||
import logging
|
||||
import asyncio
|
||||
import json
|
||||
import logging
|
||||
import os
|
||||
import sys
|
||||
from typing import Optional
|
||||
|
||||
from gns3server.utils.uuid_validator import validate_uuid
|
||||
|
||||
@ -30,6 +30,7 @@ from urllib.parse import urlparse
|
||||
|
||||
from gns3server.config import Config
|
||||
from gns3server.utils.port_allocator import link_id_to_display, link_id_to_port
|
||||
|
||||
from .docker_client import DockerHTTPClient
|
||||
|
||||
logger = logging.getLogger(__name__)
|
||||
|
||||
@ -23,12 +23,11 @@ This script pulls or builds the gns3/web-wireshark Docker image.
|
||||
Run with: pip install gns3server && gns3server-web-wireshark-setup
|
||||
"""
|
||||
|
||||
import argparse
|
||||
import os
|
||||
import sys
|
||||
import shutil
|
||||
import subprocess
|
||||
import argparse
|
||||
|
||||
import sys
|
||||
|
||||
DOCKER_IMAGE = "gns3/web-wireshark:latest"
|
||||
DOCKERFILE_NAME = "Dockerfile"
|
||||
|
||||
@ -15,43 +15,44 @@
|
||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
|
||||
from fastapi import FastAPI, Request, Depends
|
||||
import logging
|
||||
|
||||
from fastapi import Depends, FastAPI, Request
|
||||
from fastapi.responses import JSONResponse
|
||||
from starlette.exceptions import HTTPException as StarletteHTTPException
|
||||
from gns3server.controller.gns3vm.gns3_vm_error import GNS3VMError
|
||||
from gns3server.compute.error import ImageMissingError, NodeError
|
||||
from gns3server.compute.ubridge.ubridge_error import UbridgeError
|
||||
|
||||
from .dependencies.authentication import compute_authentication
|
||||
|
||||
from gns3server.compute.compute_error import (
|
||||
ComputeError,
|
||||
ComputeForbiddenError,
|
||||
ComputeNotFoundError,
|
||||
ComputeTimeoutError,
|
||||
ComputeForbiddenError,
|
||||
ComputeUnauthorizedError,
|
||||
)
|
||||
from gns3server.compute.error import ImageMissingError, NodeError
|
||||
from gns3server.compute.ubridge.ubridge_error import UbridgeError
|
||||
from gns3server.controller.gns3vm.gns3_vm_error import GNS3VMError
|
||||
|
||||
from . import capabilities
|
||||
from . import compute
|
||||
from . import projects
|
||||
from . import notifications
|
||||
from . import images
|
||||
from . import atm_switch_nodes
|
||||
from . import cloud_nodes
|
||||
from . import docker_nodes
|
||||
from . import dynamips_nodes
|
||||
from . import ethernet_hub_nodes
|
||||
from . import ethernet_switch_nodes
|
||||
from . import frame_relay_switch_nodes
|
||||
from . import iou_nodes
|
||||
from . import nat_nodes
|
||||
from . import qemu_nodes
|
||||
from . import virtualbox_nodes
|
||||
from . import vmware_nodes
|
||||
from . import vpcs_nodes
|
||||
|
||||
import logging
|
||||
from . import (
|
||||
atm_switch_nodes,
|
||||
capabilities,
|
||||
cloud_nodes,
|
||||
compute,
|
||||
docker_nodes,
|
||||
dynamips_nodes,
|
||||
ethernet_hub_nodes,
|
||||
ethernet_switch_nodes,
|
||||
frame_relay_switch_nodes,
|
||||
images,
|
||||
iou_nodes,
|
||||
nat_nodes,
|
||||
notifications,
|
||||
projects,
|
||||
qemu_nodes,
|
||||
virtualbox_nodes,
|
||||
vmware_nodes,
|
||||
vpcs_nodes,
|
||||
)
|
||||
from .dependencies.authentication import compute_authentication
|
||||
|
||||
log = logging.getLogger(__name__)
|
||||
|
||||
|
||||
@ -18,13 +18,13 @@
|
||||
API routes for ATM switch nodes.
|
||||
"""
|
||||
|
||||
from typing import Any
|
||||
import os
|
||||
from typing import Any
|
||||
from uuid import UUID
|
||||
|
||||
from fastapi import APIRouter, Depends, Body, Path, status, HTTPException
|
||||
from fastapi import APIRouter, Body, Depends, HTTPException, Path, status
|
||||
from fastapi.encoders import jsonable_encoder
|
||||
from fastapi.responses import StreamingResponse
|
||||
from uuid import UUID
|
||||
|
||||
from gns3server import schemas
|
||||
from gns3server.compute.dynamips import Dynamips
|
||||
|
||||
@ -19,14 +19,14 @@ API routes for capabilities
|
||||
"""
|
||||
|
||||
import sys
|
||||
import psutil
|
||||
|
||||
import psutil
|
||||
from fastapi import APIRouter, Request
|
||||
|
||||
from gns3server.version import __version__
|
||||
from gns3server import schemas
|
||||
from gns3server.compute import MODULES
|
||||
from gns3server.utils.path import get_default_project_directory
|
||||
from gns3server import schemas
|
||||
from gns3server.version import __version__
|
||||
|
||||
router = APIRouter()
|
||||
|
||||
|
||||
@ -19,13 +19,13 @@ API routes for cloud nodes.
|
||||
"""
|
||||
|
||||
import os
|
||||
|
||||
from fastapi import APIRouter, Depends, Path, status, HTTPException
|
||||
from fastapi.encoders import jsonable_encoder
|
||||
from fastapi.responses import StreamingResponse
|
||||
from typing import Any, Union
|
||||
from uuid import UUID
|
||||
|
||||
from fastapi import APIRouter, Depends, HTTPException, Path, status
|
||||
from fastapi.encoders import jsonable_encoder
|
||||
from fastapi.responses import StreamingResponse
|
||||
|
||||
from gns3server import schemas
|
||||
from gns3server.compute.builtin import Builtin
|
||||
from gns3server.compute.builtin.nodes.cloud import Cloud
|
||||
|
||||
@ -20,26 +20,26 @@ API routes for compute.
|
||||
"""
|
||||
|
||||
import os
|
||||
import psutil
|
||||
import cpuinfo
|
||||
|
||||
from functools import lru_cache
|
||||
from gns3server.config import Config
|
||||
from gns3server.utils.cpu_percent import CpuPercent
|
||||
from gns3server.version import __version__
|
||||
from gns3server.utils.path import get_default_project_directory, is_safe_path
|
||||
from typing import List, Optional
|
||||
from uuid import UUID
|
||||
|
||||
import cpuinfo
|
||||
import psutil
|
||||
from fastapi import APIRouter, Body, HTTPException, Response, status
|
||||
from fastapi.encoders import jsonable_encoder
|
||||
|
||||
from gns3server import schemas
|
||||
from gns3server.compute.port_manager import PortManager
|
||||
from gns3server.compute.project_manager import ProjectManager
|
||||
from gns3server.utils.interfaces import interfaces
|
||||
from gns3server.compute.qemu import Qemu
|
||||
from gns3server.compute.virtualbox import VirtualBox
|
||||
from gns3server.compute.vmware import VMware
|
||||
from gns3server import schemas
|
||||
|
||||
from fastapi import APIRouter, HTTPException, Body, Response, status
|
||||
from fastapi.encoders import jsonable_encoder
|
||||
from uuid import UUID
|
||||
from typing import Optional, List
|
||||
from gns3server.config import Config
|
||||
from gns3server.utils.cpu_percent import CpuPercent
|
||||
from gns3server.utils.interfaces import interfaces
|
||||
from gns3server.utils.path import get_default_project_directory, is_safe_path
|
||||
from gns3server.version import __version__
|
||||
|
||||
router = APIRouter()
|
||||
|
||||
|
||||
@ -14,16 +14,17 @@
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
import secrets
|
||||
import base64
|
||||
import binascii
|
||||
import logging
|
||||
import secrets
|
||||
from typing import Optional, Union
|
||||
|
||||
from fastapi import Depends, HTTPException, WebSocket, status
|
||||
from fastapi.security import HTTPBasic, HTTPBasicCredentials
|
||||
from fastapi.security.utils import get_authorization_scheme_param
|
||||
|
||||
from gns3server.config import Config
|
||||
from typing import Optional, Union
|
||||
|
||||
log = logging.getLogger(__name__)
|
||||
security = HTTPBasic(auto_error=False)
|
||||
|
||||
@ -19,16 +19,17 @@ API routes for Docker nodes.
|
||||
"""
|
||||
|
||||
import os
|
||||
from typing import Any, Union
|
||||
from uuid import UUID
|
||||
|
||||
from fastapi import APIRouter, WebSocket, Depends, Body, status, HTTPException
|
||||
from fastapi import APIRouter, Body, Depends, HTTPException, WebSocket, status
|
||||
from fastapi.encoders import jsonable_encoder
|
||||
from fastapi.responses import StreamingResponse
|
||||
from uuid import UUID
|
||||
from typing import Any, Union
|
||||
|
||||
from gns3server import schemas
|
||||
from gns3server.compute.docker import Docker
|
||||
from gns3server.compute.docker.docker_vm import DockerVM
|
||||
|
||||
from .dependencies.authentication import compute_authentication, ws_compute_authentication
|
||||
|
||||
responses: dict[int | str, dict[str, Any]] = {
|
||||
|
||||
@ -19,16 +19,16 @@ API routes for Dynamips nodes.
|
||||
"""
|
||||
|
||||
import os
|
||||
|
||||
from fastapi import APIRouter, WebSocket, Body, Depends, status, HTTPException
|
||||
from fastapi.encoders import jsonable_encoder
|
||||
from fastapi.responses import StreamingResponse
|
||||
from typing import Any, List, Optional, Union
|
||||
from uuid import UUID
|
||||
|
||||
from fastapi import APIRouter, Body, Depends, HTTPException, WebSocket, status
|
||||
from fastapi.encoders import jsonable_encoder
|
||||
from fastapi.responses import StreamingResponse
|
||||
|
||||
from gns3server import schemas
|
||||
from gns3server.compute.dynamips import Dynamips
|
||||
from gns3server.compute.dynamips.nodes.router import Router
|
||||
from gns3server import schemas
|
||||
|
||||
from .dependencies.authentication import compute_authentication, ws_compute_authentication
|
||||
|
||||
|
||||
@ -18,17 +18,17 @@
|
||||
API routes for Ethernet hub nodes.
|
||||
"""
|
||||
|
||||
from typing import Any
|
||||
import os
|
||||
|
||||
from fastapi import APIRouter, Depends, Body, Path, status, HTTPException
|
||||
from fastapi.encoders import jsonable_encoder
|
||||
from fastapi.responses import StreamingResponse
|
||||
from typing import Any
|
||||
from uuid import UUID
|
||||
|
||||
from fastapi import APIRouter, Body, Depends, HTTPException, Path, status
|
||||
from fastapi.encoders import jsonable_encoder
|
||||
from fastapi.responses import StreamingResponse
|
||||
|
||||
from gns3server import schemas
|
||||
from gns3server.compute.dynamips import Dynamips
|
||||
from gns3server.compute.dynamips.nodes.ethernet_hub import EthernetHub
|
||||
from gns3server import schemas
|
||||
|
||||
responses: dict[int | str, dict[str, Any]] = {
|
||||
404: {"model": schemas.ErrorMessage, "description": "Could not find project or Ethernet hub node"}
|
||||
|
||||
@ -22,17 +22,17 @@ through uBridge's ``brctl`` module (see
|
||||
``gns3server.compute.builtin.nodes.ethernet_switch``).
|
||||
"""
|
||||
|
||||
from typing import Any
|
||||
import os
|
||||
|
||||
from fastapi import APIRouter, Depends, Body, Path, status, HTTPException
|
||||
from fastapi.encoders import jsonable_encoder
|
||||
from fastapi.responses import StreamingResponse
|
||||
from typing import Any
|
||||
from uuid import UUID
|
||||
|
||||
from fastapi import APIRouter, Body, Depends, HTTPException, Path, status
|
||||
from fastapi.encoders import jsonable_encoder
|
||||
from fastapi.responses import StreamingResponse
|
||||
|
||||
from gns3server import schemas
|
||||
from gns3server.compute.builtin import Builtin
|
||||
from gns3server.compute.builtin.nodes.ethernet_switch import EthernetSwitch
|
||||
from gns3server import schemas
|
||||
|
||||
responses: dict[int | str, dict[str, Any]] = {
|
||||
404: {"model": schemas.ErrorMessage, "description": "Could not find project or Ethernet switch node"}
|
||||
|
||||
@ -18,13 +18,13 @@
|
||||
API routes for Frame Relay switch nodes.
|
||||
"""
|
||||
|
||||
from typing import Any
|
||||
import os
|
||||
from typing import Any
|
||||
from uuid import UUID
|
||||
|
||||
from fastapi import APIRouter, Depends, Body, Path, status, HTTPException
|
||||
from fastapi import APIRouter, Body, Depends, HTTPException, Path, status
|
||||
from fastapi.encoders import jsonable_encoder
|
||||
from fastapi.responses import StreamingResponse
|
||||
from uuid import UUID
|
||||
|
||||
from gns3server import schemas
|
||||
from gns3server.compute.dynamips import Dynamips
|
||||
|
||||
@ -20,11 +20,11 @@ API routes for images.
|
||||
|
||||
import os
|
||||
import urllib.parse
|
||||
|
||||
from fastapi import APIRouter, Body, Request, status, Response, HTTPException
|
||||
from fastapi.responses import FileResponse
|
||||
from typing import List
|
||||
|
||||
from fastapi import APIRouter, Body, HTTPException, Request, Response, status
|
||||
from fastapi.responses import FileResponse
|
||||
|
||||
from gns3server.compute.docker import Docker
|
||||
from gns3server.compute.dynamips import Dynamips
|
||||
from gns3server.compute.iou import IOU
|
||||
|
||||
@ -19,13 +19,13 @@ API routes for IOU nodes.
|
||||
"""
|
||||
|
||||
import os
|
||||
|
||||
from fastapi import APIRouter, WebSocket, Depends, Body, status, HTTPException
|
||||
from fastapi.encoders import jsonable_encoder
|
||||
from fastapi.responses import StreamingResponse
|
||||
from typing import Any, Union
|
||||
from uuid import UUID
|
||||
|
||||
from fastapi import APIRouter, Body, Depends, HTTPException, WebSocket, status
|
||||
from fastapi.encoders import jsonable_encoder
|
||||
from fastapi.responses import StreamingResponse
|
||||
|
||||
from gns3server import schemas
|
||||
from gns3server.compute.iou import IOU
|
||||
from gns3server.compute.iou.iou_vm import IOUVM
|
||||
|
||||
@ -19,13 +19,13 @@ API routes for NAT nodes.
|
||||
"""
|
||||
|
||||
import os
|
||||
|
||||
from fastapi import APIRouter, Depends, Path, status, HTTPException
|
||||
from fastapi.encoders import jsonable_encoder
|
||||
from fastapi.responses import StreamingResponse
|
||||
from typing import Any, Union
|
||||
from uuid import UUID
|
||||
|
||||
from fastapi import APIRouter, Depends, HTTPException, Path, status
|
||||
from fastapi.encoders import jsonable_encoder
|
||||
from fastapi.responses import StreamingResponse
|
||||
|
||||
from gns3server import schemas
|
||||
from gns3server.compute.builtin import Builtin
|
||||
from gns3server.compute.builtin.nodes.nat import Nat
|
||||
|
||||
@ -18,14 +18,15 @@
|
||||
API routes for compute notifications.
|
||||
"""
|
||||
|
||||
from fastapi import APIRouter, Depends, WebSocket, WebSocketDisconnect
|
||||
import logging
|
||||
from typing import Union
|
||||
|
||||
from fastapi import APIRouter, Depends, WebSocket, WebSocketDisconnect
|
||||
from websockets.exceptions import ConnectionClosed, WebSocketException
|
||||
|
||||
from gns3server.compute.notification_manager import NotificationManager
|
||||
from .dependencies.authentication import ws_compute_authentication
|
||||
|
||||
import logging
|
||||
from .dependencies.authentication import ws_compute_authentication
|
||||
|
||||
log = logging.getLogger(__name__)
|
||||
|
||||
|
||||
@ -18,28 +18,27 @@
|
||||
API routes for projects.
|
||||
"""
|
||||
|
||||
import asyncio
|
||||
import inspect
|
||||
import logging
|
||||
import os
|
||||
import shutil
|
||||
import urllib.parse
|
||||
import inspect
|
||||
import asyncio
|
||||
|
||||
import logging
|
||||
|
||||
log = logging.getLogger()
|
||||
|
||||
from fastapi import APIRouter, Depends, HTTPException, Request, Response, status, Query
|
||||
from fastapi.encoders import jsonable_encoder
|
||||
from fastapi.responses import FileResponse
|
||||
from typing import List
|
||||
from uuid import UUID
|
||||
|
||||
from gns3server.compute.project_manager import ProjectManager
|
||||
from gns3server.compute.project import Project
|
||||
from gns3server.compute.base_manager import BaseManager
|
||||
from gns3server.utils.path import is_safe_path
|
||||
from gns3server import schemas
|
||||
from fastapi import APIRouter, Depends, HTTPException, Query, Request, Response, status
|
||||
from fastapi.encoders import jsonable_encoder
|
||||
from fastapi.responses import FileResponse
|
||||
|
||||
from gns3server import schemas
|
||||
from gns3server.compute.base_manager import BaseManager
|
||||
from gns3server.compute.project import Project
|
||||
from gns3server.compute.project_manager import ProjectManager
|
||||
from gns3server.utils.path import is_safe_path
|
||||
|
||||
router = APIRouter()
|
||||
|
||||
|
||||
@ -18,21 +18,21 @@
|
||||
API routes for Qemu nodes.
|
||||
"""
|
||||
|
||||
import logging
|
||||
import os
|
||||
|
||||
from fastapi import APIRouter, WebSocket, Depends, Body, Path, status, HTTPException
|
||||
from fastapi.encoders import jsonable_encoder
|
||||
from fastapi.responses import StreamingResponse
|
||||
from typing import Any, Union
|
||||
from uuid import UUID
|
||||
|
||||
from fastapi import APIRouter, Body, Depends, HTTPException, Path, WebSocket, status
|
||||
from fastapi.encoders import jsonable_encoder
|
||||
from fastapi.responses import StreamingResponse
|
||||
|
||||
from gns3server import schemas
|
||||
from gns3server.compute import qemu
|
||||
from gns3server.compute.qemu import Qemu
|
||||
from gns3server.compute.qemu.qemu_vm import QemuVM
|
||||
from .dependencies.authentication import compute_authentication, ws_compute_authentication
|
||||
|
||||
import logging
|
||||
from .dependencies.authentication import compute_authentication, ws_compute_authentication
|
||||
|
||||
log = logging.getLogger(__name__)
|
||||
|
||||
|
||||
@ -19,12 +19,12 @@ API routes for VirtualBox nodes.
|
||||
"""
|
||||
|
||||
import os
|
||||
from typing import Any, Union
|
||||
from uuid import UUID
|
||||
|
||||
from fastapi import APIRouter, WebSocket, Depends, Path, status
|
||||
from fastapi import APIRouter, Depends, Path, WebSocket, status
|
||||
from fastapi.encoders import jsonable_encoder
|
||||
from fastapi.responses import StreamingResponse
|
||||
from uuid import UUID
|
||||
from typing import Any, Union
|
||||
|
||||
from gns3server import schemas
|
||||
from gns3server.compute.virtualbox import VirtualBox
|
||||
|
||||
@ -19,12 +19,12 @@ API routes for VMware nodes.
|
||||
"""
|
||||
|
||||
import os
|
||||
from typing import Any, Union
|
||||
from uuid import UUID
|
||||
|
||||
from fastapi import APIRouter, WebSocket, Depends, Path, status
|
||||
from fastapi import APIRouter, Depends, Path, WebSocket, status
|
||||
from fastapi.encoders import jsonable_encoder
|
||||
from fastapi.responses import StreamingResponse
|
||||
from uuid import UUID
|
||||
from typing import Any, Union
|
||||
|
||||
from gns3server import schemas
|
||||
from gns3server.compute.vmware import VMware
|
||||
|
||||
@ -19,16 +19,17 @@ API routes for VPCS nodes.
|
||||
"""
|
||||
|
||||
import os
|
||||
|
||||
from fastapi import APIRouter, WebSocket, Depends, Body, Path, status, HTTPException
|
||||
from fastapi.encoders import jsonable_encoder
|
||||
from fastapi.responses import StreamingResponse
|
||||
from typing import Any, Union
|
||||
from uuid import UUID
|
||||
|
||||
from fastapi import APIRouter, Body, Depends, HTTPException, Path, WebSocket, status
|
||||
from fastapi.encoders import jsonable_encoder
|
||||
from fastapi.responses import StreamingResponse
|
||||
|
||||
from gns3server import schemas
|
||||
from gns3server.compute.vpcs import VPCS
|
||||
from gns3server.compute.vpcs.vpcs_vm import VPCSVM
|
||||
|
||||
from .dependencies.authentication import compute_authentication, ws_compute_authentication
|
||||
|
||||
responses: dict[int | str, dict[str, Any]] = {
|
||||
|
||||
@ -21,9 +21,7 @@ from gns3server.agent import AI_COPILOT_AVAILABLE
|
||||
|
||||
# Conditionally import AI-dependent routes
|
||||
if AI_COPILOT_AVAILABLE:
|
||||
from . import chat
|
||||
from . import copilot
|
||||
from . import llm_model_configs
|
||||
from . import chat, copilot, llm_model_configs
|
||||
|
||||
_chat_router = chat.router
|
||||
_copilot_router = copilot.router
|
||||
@ -44,28 +42,29 @@ else:
|
||||
)
|
||||
|
||||
|
||||
from . import controller
|
||||
from . import appliances
|
||||
from . import computes
|
||||
from . import drawings
|
||||
from . import gns3vm
|
||||
from . import links
|
||||
from . import nodes
|
||||
from . import projects
|
||||
from . import snapshots
|
||||
from . import symbols
|
||||
from . import templates
|
||||
from . import images
|
||||
from . import users
|
||||
from . import groups
|
||||
from . import roles
|
||||
from . import acl
|
||||
from . import pools
|
||||
from . import privileges
|
||||
from . import api_keys
|
||||
from . import netmiko
|
||||
from . import settings
|
||||
|
||||
from . import (
|
||||
acl,
|
||||
api_keys,
|
||||
appliances,
|
||||
computes,
|
||||
controller,
|
||||
drawings,
|
||||
gns3vm,
|
||||
groups,
|
||||
images,
|
||||
links,
|
||||
netmiko,
|
||||
nodes,
|
||||
pools,
|
||||
privileges,
|
||||
projects,
|
||||
roles,
|
||||
settings,
|
||||
snapshots,
|
||||
symbols,
|
||||
templates,
|
||||
users,
|
||||
)
|
||||
from .dependencies.authentication import get_current_active_user
|
||||
|
||||
router = APIRouter()
|
||||
|
||||
@ -19,29 +19,27 @@
|
||||
API routes for ACL.
|
||||
"""
|
||||
|
||||
import logging
|
||||
import re
|
||||
from typing import Iterator, List, Optional, Sequence
|
||||
from uuid import UUID
|
||||
|
||||
from fastapi import APIRouter, Depends, Request, status
|
||||
from fastapi.routing import APIRoute, _IncludedRouter
|
||||
from starlette.routing import BaseRoute, Mount
|
||||
from uuid import UUID
|
||||
from typing import Iterator, List, Optional, Sequence
|
||||
|
||||
|
||||
from gns3server import schemas
|
||||
from gns3server.controller.controller_error import ControllerBadRequestError, ControllerNotFoundError
|
||||
|
||||
from gns3server.controller import Controller
|
||||
import gns3server.db.models as models
|
||||
from gns3server.db.repositories.users import UsersRepository
|
||||
from gns3server.db.repositories.rbac import RbacRepository
|
||||
from gns3server import schemas
|
||||
from gns3server.controller import Controller
|
||||
from gns3server.controller.controller_error import ControllerBadRequestError, ControllerNotFoundError
|
||||
from gns3server.db.repositories.images import ImagesRepository
|
||||
from gns3server.db.repositories.rbac import RbacRepository
|
||||
from gns3server.db.repositories.templates import TemplatesRepository
|
||||
from gns3server.db.repositories.users import UsersRepository
|
||||
|
||||
from .dependencies.database import get_repository
|
||||
from .dependencies.rbac import has_privilege
|
||||
|
||||
import logging
|
||||
|
||||
log = logging.getLogger(__name__)
|
||||
|
||||
router = APIRouter()
|
||||
|
||||
@ -18,18 +18,18 @@
|
||||
API routes for API key management.
|
||||
"""
|
||||
|
||||
import logging
|
||||
import secrets
|
||||
import bcrypt
|
||||
from uuid import uuid4, UUID
|
||||
from uuid import UUID, uuid4
|
||||
|
||||
from fastapi import APIRouter, Depends, status, HTTPException
|
||||
import bcrypt
|
||||
from fastapi import APIRouter, Depends, HTTPException, status
|
||||
|
||||
from gns3server import schemas
|
||||
from gns3server.db.repositories.api_keys import ApiKeysRepository
|
||||
from .dependencies.database import get_repository
|
||||
from .dependencies.authentication import get_current_active_user
|
||||
|
||||
import logging
|
||||
from .dependencies.authentication import get_current_active_user
|
||||
from .dependencies.database import get_repository
|
||||
|
||||
log = logging.getLogger(__name__)
|
||||
|
||||
|
||||
@ -19,24 +19,22 @@ API routes for appliances.
|
||||
"""
|
||||
|
||||
import logging
|
||||
from typing import List, Optional, Union
|
||||
from uuid import UUID
|
||||
|
||||
from fastapi import APIRouter, Depends, status
|
||||
from typing import Optional, List, Union
|
||||
from uuid import UUID
|
||||
|
||||
from gns3server import schemas
|
||||
from gns3server.controller import Controller
|
||||
from gns3server.controller.controller_error import ControllerError, ControllerBadRequestError, ControllerNotFoundError
|
||||
|
||||
from gns3server.controller.controller_error import ControllerBadRequestError, ControllerError, ControllerNotFoundError
|
||||
from gns3server.db.repositories.images import ImagesRepository
|
||||
from gns3server.db.repositories.templates import TemplatesRepository
|
||||
from gns3server.db.repositories.rbac import RbacRepository
|
||||
from gns3server.db.repositories.templates import TemplatesRepository
|
||||
|
||||
from .dependencies.authentication import get_current_active_user
|
||||
from .dependencies.database import get_repository
|
||||
from .dependencies.rbac import has_privilege
|
||||
|
||||
|
||||
log = logging.getLogger(__name__)
|
||||
|
||||
router = APIRouter()
|
||||
|
||||
@ -24,16 +24,16 @@ import json
|
||||
import logging
|
||||
import uuid
|
||||
from typing import Any, List, Optional
|
||||
from uuid import UUID
|
||||
|
||||
from fastapi import APIRouter, Depends, HTTPException, Request, status
|
||||
from fastapi.responses import StreamingResponse
|
||||
from uuid import UUID
|
||||
|
||||
from gns3server import schemas
|
||||
from gns3server.controller import Controller
|
||||
from gns3server.controller.project import Project
|
||||
from gns3server.controller.controller_error import ControllerNotFoundError
|
||||
from gns3server.agent.gns3_copilot.project_agent_manager import get_project_agent_manager
|
||||
from gns3server.controller import Controller
|
||||
from gns3server.controller.controller_error import ControllerNotFoundError
|
||||
from gns3server.controller.project import Project
|
||||
from gns3server.db.tasks import get_user_llm_config_full
|
||||
|
||||
from .dependencies.authentication import get_current_active_user
|
||||
|
||||
@ -18,16 +18,17 @@
|
||||
API routes for computes.
|
||||
"""
|
||||
|
||||
from fastapi import APIRouter, Body, Depends, status
|
||||
from typing import Any, List, Union, Optional
|
||||
from typing import Any, List, Optional, Union
|
||||
from uuid import UUID
|
||||
|
||||
from gns3server.controller import Controller
|
||||
from fastapi import APIRouter, Body, Depends, status
|
||||
|
||||
import gns3server.db.models as models
|
||||
from gns3server import schemas
|
||||
from gns3server.controller import Controller
|
||||
from gns3server.db.repositories.computes import ComputesRepository
|
||||
from gns3server.db.repositories.rbac import RbacRepository
|
||||
from gns3server.services.computes import ComputesService
|
||||
from gns3server import schemas
|
||||
|
||||
from .dependencies.database import get_repository
|
||||
from .dependencies.rbac import has_privilege
|
||||
|
||||
@ -15,30 +15,28 @@
|
||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
import asyncio
|
||||
import signal
|
||||
import logging
|
||||
import os
|
||||
import signal
|
||||
import time
|
||||
import psutil
|
||||
from typing import Dict, List
|
||||
|
||||
from fastapi import APIRouter, FastAPI, Request, Depends, WebSocket, WebSocketDisconnect, status
|
||||
from fastapi.responses import StreamingResponse
|
||||
import psutil
|
||||
from fastapi import APIRouter, Depends, FastAPI, Request, WebSocket, WebSocketDisconnect, status
|
||||
from fastapi.encoders import jsonable_encoder
|
||||
from fastapi.responses import StreamingResponse
|
||||
from fastapi.routing import Mount
|
||||
from websockets.exceptions import ConnectionClosed, WebSocketException
|
||||
|
||||
from typing import List, Dict
|
||||
|
||||
from gns3server import schemas
|
||||
from gns3server.agent.web_wireshark.stats import collect_webwireshark_stats
|
||||
from gns3server.config import Config
|
||||
from gns3server.controller import Controller
|
||||
from gns3server.agent.web_wireshark.stats import collect_webwireshark_stats
|
||||
from gns3server.version import __version__
|
||||
from gns3server.controller.controller_error import ControllerError, ControllerForbiddenError
|
||||
from gns3server import schemas
|
||||
from gns3server.version import __version__
|
||||
|
||||
from .dependencies.authentication import get_current_active_user, get_current_active_user_from_websocket
|
||||
|
||||
import logging
|
||||
|
||||
log = logging.getLogger(__name__)
|
||||
|
||||
router = APIRouter()
|
||||
|
||||
@ -21,7 +21,9 @@ API routes for GNS3 Copilot global operations (non-project).
|
||||
import logging
|
||||
|
||||
from fastapi import APIRouter, Depends, HTTPException, status
|
||||
|
||||
from gns3server import schemas
|
||||
|
||||
from .dependencies.authentication import get_current_active_user
|
||||
|
||||
log = logging.getLogger(__name__)
|
||||
|
||||
@ -17,21 +17,22 @@
|
||||
import asyncio
|
||||
import hashlib
|
||||
import logging
|
||||
import bcrypt
|
||||
|
||||
from fastapi import Request, Query, Depends, HTTPException, WebSocket, status
|
||||
from fastapi.security import OAuth2PasswordBearer
|
||||
from typing import Optional
|
||||
from uuid import UUID
|
||||
|
||||
from gns3server import schemas
|
||||
import bcrypt
|
||||
from fastapi import Depends, HTTPException, Query, Request, WebSocket, status
|
||||
from fastapi.security import OAuth2PasswordBearer
|
||||
|
||||
import gns3server.db.models as models
|
||||
from gns3server import schemas
|
||||
from gns3server.db.repositories.api_keys import ApiKeysRepository
|
||||
from gns3server.db.repositories.users import UsersRepository
|
||||
from gns3server.db.repositories.rbac import RbacRepository
|
||||
from gns3server.db.repositories.users import UsersRepository
|
||||
from gns3server.schemas.controller.tokens import TokenData
|
||||
from gns3server.services import auth_service, access_ticket_service
|
||||
from gns3server.services import access_ticket_service, auth_service
|
||||
from gns3server.services.access_tickets import TICKET_PREFIX
|
||||
|
||||
from .database import get_repository
|
||||
|
||||
log = logging.getLogger(__name__)
|
||||
|
||||
@ -15,9 +15,10 @@
|
||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
from typing import AsyncGenerator, Callable, Type
|
||||
|
||||
from fastapi import Depends
|
||||
from starlette.requests import HTTPConnection
|
||||
from sqlalchemy.ext.asyncio import AsyncSession
|
||||
from starlette.requests import HTTPConnection
|
||||
|
||||
from gns3server.db.repositories.base import BaseRepository
|
||||
|
||||
|
||||
@ -14,16 +14,17 @@
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
import logging
|
||||
import re
|
||||
|
||||
from fastapi import Request, WebSocket, Depends, HTTPException
|
||||
from fastapi import Depends, HTTPException, Request, WebSocket
|
||||
|
||||
from gns3server import schemas
|
||||
from gns3server.db.repositories.rbac import RbacRepository
|
||||
|
||||
from .authentication import get_current_active_user, get_current_active_user_from_websocket
|
||||
from .database import get_repository
|
||||
|
||||
import logging
|
||||
|
||||
log = logging.getLogger()
|
||||
|
||||
|
||||
|
||||
@ -18,14 +18,15 @@
|
||||
API routes for drawings.
|
||||
"""
|
||||
|
||||
from fastapi import APIRouter, Depends, status
|
||||
from fastapi.encoders import jsonable_encoder
|
||||
from typing import Any, List
|
||||
from uuid import UUID
|
||||
|
||||
from fastapi import APIRouter, Depends, status
|
||||
from fastapi.encoders import jsonable_encoder
|
||||
|
||||
from gns3server import schemas
|
||||
from gns3server.controller import Controller
|
||||
from gns3server.db.repositories.rbac import RbacRepository
|
||||
from gns3server import schemas
|
||||
|
||||
from .dependencies.database import get_repository
|
||||
from .dependencies.rbac import has_privilege
|
||||
|
||||
@ -19,12 +19,13 @@
|
||||
API routes for managing the GNS3 VM.
|
||||
"""
|
||||
|
||||
from fastapi import APIRouter
|
||||
from fastapi.encoders import jsonable_encoder
|
||||
from typing import List
|
||||
|
||||
from gns3server.controller import Controller
|
||||
from fastapi import APIRouter
|
||||
from fastapi.encoders import jsonable_encoder
|
||||
|
||||
from gns3server import schemas
|
||||
from gns3server.controller import Controller
|
||||
|
||||
router = APIRouter()
|
||||
|
||||
|
||||
@ -19,26 +19,25 @@
|
||||
API routes for user groups.
|
||||
"""
|
||||
|
||||
from fastapi import APIRouter, Depends, status
|
||||
from uuid import UUID
|
||||
import logging
|
||||
from typing import List, Optional
|
||||
from uuid import UUID
|
||||
|
||||
from gns3server import schemas
|
||||
from gns3server.controller.controller_error import (
|
||||
ControllerError,
|
||||
ControllerBadRequestError,
|
||||
ControllerNotFoundError,
|
||||
ControllerForbiddenError,
|
||||
)
|
||||
from fastapi import APIRouter, Depends, status
|
||||
|
||||
import gns3server.db.models as models
|
||||
from gns3server.db.repositories.users import UsersRepository
|
||||
from gns3server import schemas
|
||||
from gns3server.controller.controller_error import (
|
||||
ControllerBadRequestError,
|
||||
ControllerError,
|
||||
ControllerForbiddenError,
|
||||
ControllerNotFoundError,
|
||||
)
|
||||
from gns3server.db.repositories.rbac import RbacRepository
|
||||
from gns3server.db.repositories.users import UsersRepository
|
||||
|
||||
from .dependencies.rbac import has_privilege
|
||||
from .dependencies.database import get_repository
|
||||
|
||||
import logging
|
||||
from .dependencies.rbac import has_privilege
|
||||
|
||||
log = logging.getLogger(__name__)
|
||||
|
||||
|
||||
@ -18,40 +18,40 @@
|
||||
API routes for images.
|
||||
"""
|
||||
|
||||
import os
|
||||
import logging
|
||||
import urllib.parse
|
||||
import os
|
||||
import tempfile
|
||||
import urllib.parse
|
||||
from typing import List, Literal, Optional
|
||||
|
||||
from fastapi import APIRouter, Request, Response, Depends, Query, status
|
||||
from fastapi import APIRouter, Depends, Query, Request, Response, status
|
||||
from fastapi.encoders import jsonable_encoder
|
||||
from starlette.requests import ClientDisconnect
|
||||
from sqlalchemy.orm.exc import MultipleResultsFound
|
||||
from sqlalchemy.exc import SQLAlchemyError
|
||||
from typing import List, Optional, Literal
|
||||
from sqlalchemy.orm.exc import MultipleResultsFound
|
||||
from starlette.requests import ClientDisconnect
|
||||
|
||||
import gns3server.db.models as models
|
||||
from gns3server import schemas
|
||||
from gns3server.config import Config
|
||||
from gns3server.compute.qemu import Qemu
|
||||
from gns3server.config import Config
|
||||
from gns3server.controller import Controller
|
||||
from gns3server.controller.controller_error import (
|
||||
ControllerBadRequestError,
|
||||
ControllerError,
|
||||
ControllerForbiddenError,
|
||||
ControllerNotFoundError,
|
||||
)
|
||||
from gns3server.db.repositories.images import ImagesRepository
|
||||
from gns3server.db.repositories.rbac import RbacRepository
|
||||
from gns3server.db.repositories.templates import TemplatesRepository
|
||||
from gns3server.services.image_reconciliation import get_image_reconciliation_service
|
||||
from gns3server.utils.image_inventory import ImageLockBusy, contained_path, fingerprint, image_lock, publish_image
|
||||
from gns3server.utils.images import (
|
||||
InvalidImageError,
|
||||
write_image,
|
||||
read_image_info,
|
||||
default_images_directory,
|
||||
get_builtin_disks,
|
||||
)
|
||||
import gns3server.db.models as models
|
||||
from gns3server.db.repositories.images import ImagesRepository
|
||||
from gns3server.db.repositories.templates import TemplatesRepository
|
||||
from gns3server.db.repositories.rbac import RbacRepository
|
||||
from gns3server.controller import Controller
|
||||
from gns3server.services.image_reconciliation import get_image_reconciliation_service
|
||||
from gns3server.utils.image_inventory import contained_path, image_lock, publish_image, fingerprint, ImageLockBusy
|
||||
from gns3server.controller.controller_error import (
|
||||
ControllerError,
|
||||
ControllerNotFoundError,
|
||||
ControllerForbiddenError,
|
||||
ControllerBadRequestError,
|
||||
read_image_info,
|
||||
write_image,
|
||||
)
|
||||
|
||||
from .dependencies.authentication import get_current_active_user
|
||||
|
||||
@ -19,31 +19,30 @@ API routes for links.
|
||||
"""
|
||||
|
||||
import asyncio
|
||||
import logging
|
||||
import os
|
||||
import multidict
|
||||
import aiohttp
|
||||
|
||||
from fastapi import APIRouter, Depends, Request, status, WebSocket
|
||||
from fastapi.responses import FileResponse, StreamingResponse
|
||||
from fastapi.encoders import jsonable_encoder
|
||||
from typing import Any, List, Union
|
||||
from uuid import UUID, uuid4
|
||||
|
||||
import aiohttp
|
||||
import multidict
|
||||
from fastapi import APIRouter, Depends, Request, WebSocket, status
|
||||
from fastapi.encoders import jsonable_encoder
|
||||
from fastapi.responses import FileResponse, StreamingResponse
|
||||
|
||||
from gns3server import schemas
|
||||
from gns3server.agent.web_wireshark.manager import WebWiresharkManager
|
||||
from gns3server.controller import Controller
|
||||
from gns3server.controller.controller_error import ControllerError
|
||||
from gns3server.controller.link import _UNSET, Link
|
||||
from gns3server.db.repositories.rbac import RbacRepository
|
||||
from gns3server.controller.link import Link, _UNSET
|
||||
from gns3server.utils.http_client import HTTPClient
|
||||
from gns3server.utils.port_allocator import link_id_to_port
|
||||
from gns3server.utils.websocket_to_websocket import websocket_proxy
|
||||
from gns3server import schemas
|
||||
from gns3server.agent.web_wireshark.manager import WebWiresharkManager
|
||||
|
||||
from .dependencies.database import get_repository
|
||||
from .dependencies.rbac import has_privilege, has_privilege_on_websocket
|
||||
|
||||
import logging
|
||||
|
||||
log = logging.getLogger(__name__)
|
||||
|
||||
responses: dict[int | str, dict[str, Any]] = {
|
||||
|
||||
@ -19,24 +19,23 @@
|
||||
API routes for LLM model configurations.
|
||||
"""
|
||||
|
||||
from fastapi import APIRouter, Depends, HTTPException, status
|
||||
from uuid import UUID
|
||||
import logging
|
||||
from typing import List
|
||||
from uuid import UUID
|
||||
|
||||
from fastapi import APIRouter, Depends, HTTPException, status
|
||||
|
||||
from gns3server import schemas
|
||||
from gns3server.controller.controller_error import (
|
||||
ControllerBadRequestError,
|
||||
ControllerNotFoundError,
|
||||
)
|
||||
|
||||
from gns3server.db.repositories.llm_model_configs import LLMModelConfigsRepository
|
||||
from gns3server.db.repositories.users import UsersRepository
|
||||
|
||||
from .dependencies.database import get_repository
|
||||
from .dependencies.rbac import has_privilege
|
||||
|
||||
import logging
|
||||
|
||||
log = logging.getLogger(__name__)
|
||||
|
||||
router = APIRouter()
|
||||
|
||||
@ -19,6 +19,7 @@
|
||||
API routes for Netmiko metadata.
|
||||
"""
|
||||
|
||||
import logging
|
||||
from typing import Optional
|
||||
|
||||
from fastapi import APIRouter, Depends, HTTPException, status
|
||||
@ -27,8 +28,6 @@ from gns3server import schemas
|
||||
|
||||
from .dependencies.authentication import get_current_active_user
|
||||
|
||||
import logging
|
||||
|
||||
log = logging.getLogger(__name__)
|
||||
|
||||
|
||||
|
||||
@ -18,33 +18,32 @@
|
||||
API routes for nodes.
|
||||
"""
|
||||
|
||||
import aiohttp
|
||||
import asyncio
|
||||
import contextlib
|
||||
import ipaddress
|
||||
import logging
|
||||
from typing import Any, Callable, List, Optional
|
||||
from uuid import UUID
|
||||
|
||||
from fastapi import APIRouter, Depends, WebSocket, WebSocketDisconnect, Request, Response, status, Query, HTTPException
|
||||
import aiohttp
|
||||
from fastapi import APIRouter, Depends, HTTPException, Query, Request, Response, WebSocket, WebSocketDisconnect, status
|
||||
from fastapi.encoders import jsonable_encoder
|
||||
from fastapi.responses import StreamingResponse
|
||||
from fastapi.routing import APIRoute
|
||||
from typing import Any, List, Callable, Optional
|
||||
from uuid import UUID
|
||||
|
||||
from gns3server.controller import Controller
|
||||
from gns3server import schemas
|
||||
from gns3server.config import Config
|
||||
from gns3server.controller import Controller
|
||||
from gns3server.controller.controller_error import ControllerBadRequestError, ControllerForbiddenError
|
||||
from gns3server.controller.node import Node
|
||||
from gns3server.controller.project import Project
|
||||
from gns3server.db.repositories.rbac import RbacRepository
|
||||
from gns3server.utils import force_unix_path
|
||||
from gns3server.utils.http_client import HTTPClient
|
||||
from gns3server.controller.controller_error import ControllerForbiddenError, ControllerBadRequestError
|
||||
from gns3server.db.repositories.rbac import RbacRepository
|
||||
from gns3server import schemas
|
||||
|
||||
from .dependencies.database import get_repository
|
||||
from .dependencies.rbac import has_privilege, has_privilege_on_websocket
|
||||
|
||||
import logging
|
||||
|
||||
log = logging.getLogger(__name__)
|
||||
|
||||
node_locks: dict[str, dict[str, Any]] = {}
|
||||
|
||||
@ -19,22 +19,21 @@
|
||||
API routes for resource pools.
|
||||
"""
|
||||
|
||||
from fastapi import APIRouter, Depends, status
|
||||
from uuid import UUID
|
||||
from typing import List, Optional
|
||||
|
||||
from gns3server import schemas
|
||||
from gns3server.controller.controller_error import ControllerError, ControllerBadRequestError, ControllerNotFoundError
|
||||
|
||||
from gns3server.controller import Controller
|
||||
import gns3server.db.models as models
|
||||
from gns3server.db.repositories.rbac import RbacRepository
|
||||
from gns3server.db.repositories.pools import ResourcePoolsRepository
|
||||
|
||||
from .dependencies.rbac import has_privilege
|
||||
from .dependencies.database import get_repository
|
||||
|
||||
import logging
|
||||
from typing import List, Optional
|
||||
from uuid import UUID
|
||||
|
||||
from fastapi import APIRouter, Depends, status
|
||||
|
||||
import gns3server.db.models as models
|
||||
from gns3server import schemas
|
||||
from gns3server.controller import Controller
|
||||
from gns3server.controller.controller_error import ControllerBadRequestError, ControllerError, ControllerNotFoundError
|
||||
from gns3server.db.repositories.pools import ResourcePoolsRepository
|
||||
from gns3server.db.repositories.rbac import RbacRepository
|
||||
|
||||
from .dependencies.database import get_repository
|
||||
from .dependencies.rbac import has_privilege
|
||||
|
||||
log = logging.getLogger(__name__)
|
||||
|
||||
|
||||
@ -15,14 +15,16 @@
|
||||
API route for privileges
|
||||
"""
|
||||
|
||||
from typing import List
|
||||
import gns3server.db.models as models
|
||||
from gns3server.db.repositories.rbac import RbacRepository
|
||||
from .dependencies.database import get_repository
|
||||
from fastapi import APIRouter, Depends
|
||||
import logging
|
||||
from typing import List
|
||||
|
||||
from fastapi import APIRouter, Depends
|
||||
|
||||
import gns3server.db.models as models
|
||||
from gns3server import schemas
|
||||
from gns3server.db.repositories.rbac import RbacRepository
|
||||
|
||||
from .dependencies.database import get_repository
|
||||
|
||||
log = logging.getLogger(__name__)
|
||||
router = APIRouter()
|
||||
|
||||
@ -18,44 +18,45 @@
|
||||
API routes for projects.
|
||||
"""
|
||||
|
||||
import os
|
||||
import asyncio
|
||||
import logging
|
||||
import os
|
||||
import tempfile
|
||||
import aiofiles
|
||||
import time
|
||||
import urllib.parse
|
||||
import gns3server.utils.zipfile_zstd as zipfile
|
||||
|
||||
import logging
|
||||
import aiofiles
|
||||
|
||||
import gns3server.utils.zipfile_zstd as zipfile
|
||||
|
||||
log = logging.getLogger()
|
||||
|
||||
from fastapi import APIRouter, Depends, Request, Body, HTTPException, status, WebSocket, WebSocketDisconnect
|
||||
from fastapi.encoders import jsonable_encoder
|
||||
from fastapi.responses import StreamingResponse, FileResponse
|
||||
from websockets.exceptions import ConnectionClosed, WebSocketException
|
||||
from typing import Any, List, Optional
|
||||
from uuid import UUID
|
||||
|
||||
from fastapi import APIRouter, Body, Depends, HTTPException, Request, WebSocket, WebSocketDisconnect, status
|
||||
from fastapi.encoders import jsonable_encoder
|
||||
from fastapi.responses import FileResponse, StreamingResponse
|
||||
from websockets.exceptions import ConnectionClosed, WebSocketException
|
||||
|
||||
from gns3server import schemas
|
||||
from gns3server.controller import Controller
|
||||
from gns3server.controller.project import Project
|
||||
from gns3server.controller.link import _UNSET
|
||||
from gns3server.controller.controller_error import ControllerError, ControllerBadRequestError
|
||||
from gns3server.controller.import_project import import_project as import_controller_project
|
||||
from gns3server.controller import Controller, marker_replay
|
||||
from gns3server.controller.controller_error import ControllerBadRequestError, ControllerError
|
||||
from gns3server.controller.export_project import export_project as export_controller_project
|
||||
from gns3server.controller import marker_replay
|
||||
from gns3server.controller.import_project import import_project as import_controller_project
|
||||
from gns3server.controller.link import _UNSET
|
||||
from gns3server.controller.marker_replay import SharkdError, SharkdMissingError
|
||||
from gns3server.controller.project import Project
|
||||
from gns3server.db.repositories.pools import ResourcePoolsRepository
|
||||
from gns3server.db.repositories.rbac import RbacRepository
|
||||
from gns3server.db.repositories.templates import TemplatesRepository
|
||||
from gns3server.services.templates import TemplatesService
|
||||
from gns3server.utils.asyncio import aiozipstream
|
||||
from gns3server.utils.path import is_safe_path
|
||||
from gns3server.db.repositories.templates import TemplatesRepository
|
||||
from gns3server.db.repositories.rbac import RbacRepository
|
||||
from gns3server.db.repositories.pools import ResourcePoolsRepository
|
||||
from gns3server.services.templates import TemplatesService
|
||||
|
||||
from .dependencies.rbac import has_privilege, has_privilege_on_websocket
|
||||
from .dependencies.authentication import get_current_active_user
|
||||
from .dependencies.database import get_repository
|
||||
from .dependencies.rbac import has_privilege, has_privilege_on_websocket
|
||||
|
||||
responses: dict[int | str, dict[str, Any]] = {
|
||||
404: {"model": schemas.ErrorMessage, "description": "Could not find project"}
|
||||
|
||||
@ -19,25 +19,25 @@
|
||||
API routes for roles.
|
||||
"""
|
||||
|
||||
from fastapi import APIRouter, Depends, status
|
||||
from uuid import UUID
|
||||
import logging
|
||||
from typing import List, Optional
|
||||
from uuid import UUID
|
||||
|
||||
from gns3server import schemas
|
||||
from gns3server.controller.controller_error import (
|
||||
ControllerError,
|
||||
ControllerBadRequestError,
|
||||
ControllerNotFoundError,
|
||||
ControllerForbiddenError,
|
||||
)
|
||||
from fastapi import APIRouter, Depends, status
|
||||
|
||||
import gns3server.db.models as models
|
||||
from gns3server import schemas
|
||||
from gns3server.controller.controller_error import (
|
||||
ControllerBadRequestError,
|
||||
ControllerError,
|
||||
ControllerForbiddenError,
|
||||
ControllerNotFoundError,
|
||||
)
|
||||
from gns3server.db.repositories.rbac import RbacRepository
|
||||
|
||||
from .dependencies.database import get_repository
|
||||
from .dependencies.rbac import has_privilege
|
||||
|
||||
import logging
|
||||
|
||||
log = logging.getLogger(__name__)
|
||||
|
||||
router = APIRouter()
|
||||
|
||||
@ -19,8 +19,9 @@
|
||||
API routes for managing the server settings (gns3_server.conf).
|
||||
"""
|
||||
|
||||
from fastapi import APIRouter, Depends, HTTPException
|
||||
import logging
|
||||
|
||||
from fastapi import APIRouter, Depends, HTTPException
|
||||
from pydantic import ValidationError
|
||||
|
||||
from gns3server import schemas
|
||||
@ -31,8 +32,6 @@ from gns3server.schemas.controller.settings import SECRET_MASK
|
||||
|
||||
from .dependencies.rbac import has_privilege
|
||||
|
||||
import logging
|
||||
|
||||
log = logging.getLogger(__name__)
|
||||
|
||||
router = APIRouter()
|
||||
|
||||
@ -23,14 +23,15 @@ import logging
|
||||
|
||||
log = logging.getLogger()
|
||||
|
||||
from fastapi import APIRouter, Depends, status
|
||||
from typing import Any, List
|
||||
from uuid import UUID
|
||||
|
||||
from gns3server.controller.project import Project
|
||||
from gns3server.db.repositories.rbac import RbacRepository
|
||||
from fastapi import APIRouter, Depends, status
|
||||
|
||||
from gns3server import schemas
|
||||
from gns3server.controller import Controller
|
||||
from gns3server.controller.project import Project
|
||||
from gns3server.db.repositories.rbac import RbacRepository
|
||||
|
||||
from .dependencies.database import get_repository
|
||||
from .dependencies.rbac import has_privilege
|
||||
|
||||
@ -19,21 +19,20 @@
|
||||
API routes for symbols.
|
||||
"""
|
||||
|
||||
import logging
|
||||
import os
|
||||
|
||||
from fastapi import APIRouter, Request, Depends, Response, status
|
||||
from fastapi.responses import FileResponse
|
||||
from typing import List
|
||||
|
||||
from gns3server.controller import Controller
|
||||
from fastapi import APIRouter, Depends, Request, Response, status
|
||||
from fastapi.responses import FileResponse
|
||||
|
||||
from gns3server import schemas
|
||||
from gns3server.controller.controller_error import ControllerError, ControllerNotFoundError, ControllerForbiddenError
|
||||
from gns3server.controller import Controller
|
||||
from gns3server.controller.controller_error import ControllerError, ControllerForbiddenError, ControllerNotFoundError
|
||||
from gns3server.utils.get_resource import get_resource
|
||||
|
||||
from .dependencies.rbac import has_privilege
|
||||
|
||||
import logging
|
||||
|
||||
log = logging.getLogger(__name__)
|
||||
|
||||
|
||||
|
||||
@ -18,30 +18,30 @@
|
||||
API routes for templates.
|
||||
"""
|
||||
|
||||
import os
|
||||
import hashlib
|
||||
import json
|
||||
|
||||
import logging
|
||||
import os
|
||||
|
||||
log = logging.getLogger(__name__)
|
||||
|
||||
from fastapi import APIRouter, Request, HTTPException, Depends, Response, status, Query
|
||||
from typing import Any, List, Optional, Union
|
||||
from uuid import UUID
|
||||
|
||||
from fastapi import APIRouter, Depends, HTTPException, Query, Request, Response, status
|
||||
|
||||
from gns3server import schemas
|
||||
from gns3server.controller import Controller
|
||||
from gns3server.controller.controller_error import ControllerBadRequestError, ControllerError
|
||||
from gns3server.db.repositories.images import ImagesRepository
|
||||
from gns3server.db.repositories.rbac import RbacRepository
|
||||
from gns3server.db.repositories.templates import TemplatesRepository
|
||||
from gns3server.services.templates import TemplatesService
|
||||
from gns3server.db.repositories.rbac import RbacRepository
|
||||
from gns3server.db.repositories.images import ImagesRepository
|
||||
from gns3server.controller import Controller
|
||||
from gns3server.controller.controller_error import ControllerError, ControllerBadRequestError
|
||||
from gns3server.utils.images import get_builtin_disks
|
||||
|
||||
from .dependencies.authentication import get_current_active_user
|
||||
from .dependencies.rbac import has_privilege
|
||||
from .dependencies.database import get_repository
|
||||
from .dependencies.rbac import has_privilege
|
||||
|
||||
responses: dict[int | str, dict[str, Any]] = {
|
||||
404: {"model": schemas.ErrorMessage, "description": "Could not find template"}
|
||||
|
||||
@ -19,30 +19,29 @@
|
||||
API routes for users.
|
||||
"""
|
||||
|
||||
import logging
|
||||
from typing import List, Optional
|
||||
from uuid import UUID
|
||||
|
||||
from fastapi import APIRouter, Depends, HTTPException, Response, status
|
||||
from fastapi.security import OAuth2PasswordRequestForm
|
||||
from uuid import UUID
|
||||
from typing import List, Optional
|
||||
|
||||
from gns3server import schemas
|
||||
from gns3server.controller.controller_error import (
|
||||
ControllerError,
|
||||
ControllerBadRequestError,
|
||||
ControllerNotFoundError,
|
||||
ControllerForbiddenError,
|
||||
)
|
||||
|
||||
import gns3server.db.models as models
|
||||
from gns3server.db.repositories.users import UsersRepository
|
||||
from gns3server import schemas
|
||||
from gns3server.controller.controller_error import (
|
||||
ControllerBadRequestError,
|
||||
ControllerError,
|
||||
ControllerForbiddenError,
|
||||
ControllerNotFoundError,
|
||||
)
|
||||
from gns3server.db.repositories.rbac import RbacRepository
|
||||
from gns3server.db.repositories.users import UsersRepository
|
||||
from gns3server.services import auth_service
|
||||
|
||||
from .dependencies.authentication import get_current_active_user
|
||||
from .dependencies.database import get_repository
|
||||
from .dependencies.rbac import has_privilege
|
||||
|
||||
import logging
|
||||
|
||||
log = logging.getLogger(__name__)
|
||||
|
||||
router = APIRouter()
|
||||
|
||||
@ -16,12 +16,12 @@
|
||||
|
||||
import os
|
||||
|
||||
from fastapi import APIRouter, Request, HTTPException, status
|
||||
from fastapi.responses import RedirectResponse, HTMLResponse, FileResponse
|
||||
from fastapi import APIRouter, HTTPException, Request, status
|
||||
from fastapi.responses import FileResponse, HTMLResponse, RedirectResponse
|
||||
from fastapi.templating import Jinja2Templates
|
||||
|
||||
from gns3server.version import __version__
|
||||
from gns3server.utils.get_resource import get_resource
|
||||
from gns3server.version import __version__
|
||||
|
||||
router = APIRouter()
|
||||
templates = Jinja2Templates(directory=os.path.join("gns3server", "templates"))
|
||||
|
||||
@ -21,36 +21,33 @@ FastAPI app
|
||||
|
||||
from typing import cast
|
||||
|
||||
from fastapi import FastAPI, Request, HTTPException, status
|
||||
from fastapi.middleware.cors import CORSMiddleware
|
||||
from fastapi.responses import JSONResponse
|
||||
from fastapi import FastAPI, HTTPException, Request, status
|
||||
from fastapi.exceptions import RequestValidationError
|
||||
from fastapi.staticfiles import StaticFiles
|
||||
from sqlalchemy.exc import SQLAlchemyError
|
||||
from uvicorn.main import Server as UvicornServer
|
||||
|
||||
from fastapi.middleware.cors import CORSMiddleware
|
||||
from fastapi.openapi.docs import (
|
||||
get_redoc_html,
|
||||
get_swagger_ui_html,
|
||||
get_swagger_ui_oauth2_redirect_html,
|
||||
)
|
||||
|
||||
from gns3server.controller.controller_error import (
|
||||
ControllerError,
|
||||
ControllerNotFoundError,
|
||||
ControllerBadRequestError,
|
||||
ControllerTimeoutError,
|
||||
ControllerForbiddenError,
|
||||
ControllerUnauthorizedError,
|
||||
ComputeConflictError,
|
||||
)
|
||||
|
||||
from gns3server.api.routes import controller, index
|
||||
from gns3server.api.routes.compute import compute_api
|
||||
from gns3server.core import tasks
|
||||
from fastapi.responses import JSONResponse
|
||||
from fastapi.staticfiles import StaticFiles
|
||||
from sqlalchemy.exc import SQLAlchemyError
|
||||
from uvicorn.main import Server as UvicornServer
|
||||
|
||||
# MCP is an optional feature — import only if dependencies are installed
|
||||
from gns3server.agent import MCP_AVAILABLE
|
||||
from gns3server.api.routes import controller, index
|
||||
from gns3server.api.routes.compute import compute_api
|
||||
from gns3server.controller.controller_error import (
|
||||
ComputeConflictError,
|
||||
ControllerBadRequestError,
|
||||
ControllerError,
|
||||
ControllerForbiddenError,
|
||||
ControllerNotFoundError,
|
||||
ControllerTimeoutError,
|
||||
ControllerUnauthorizedError,
|
||||
)
|
||||
from gns3server.core import tasks
|
||||
|
||||
if MCP_AVAILABLE:
|
||||
from gns3server.agent import mcp
|
||||
|
||||
@ -14,15 +14,15 @@
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
import sys
|
||||
import os
|
||||
import sys
|
||||
|
||||
from .builtin import Builtin
|
||||
from .vpcs import VPCS
|
||||
from .virtualbox import VirtualBox
|
||||
from .dynamips import Dynamips
|
||||
from .qemu import Qemu
|
||||
from .virtualbox import VirtualBox
|
||||
from .vmware import VMware
|
||||
from .vpcs import VPCS
|
||||
|
||||
MODULES = [Builtin, VPCS, VirtualBox, Dynamips, Qemu, VMware]
|
||||
|
||||
|
||||
@ -14,37 +14,38 @@
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
import sys
|
||||
import os
|
||||
import struct
|
||||
import stat
|
||||
import asyncio
|
||||
import aiofiles
|
||||
import socket
|
||||
import shutil
|
||||
import re
|
||||
import logging
|
||||
import inspect
|
||||
import logging
|
||||
import os
|
||||
import re
|
||||
import shutil
|
||||
import socket
|
||||
import stat
|
||||
import struct
|
||||
import sys
|
||||
|
||||
import aiofiles
|
||||
|
||||
log = logging.getLogger(__name__)
|
||||
|
||||
from gns3server.utils.asyncio import cancellable_wait_run_in_executor
|
||||
from typing import Type
|
||||
from uuid import UUID, uuid4
|
||||
|
||||
from gns3server.compute.compute_error import ComputeError, ComputeForbiddenError, ComputeNotFoundError
|
||||
from gns3server.utils.asyncio import cancellable_wait_run_in_executor
|
||||
from gns3server.utils.interfaces import is_interface_up
|
||||
|
||||
from uuid import UUID, uuid4
|
||||
from typing import Type
|
||||
from ..config import Config
|
||||
from ..utils import force_unix_path
|
||||
from .project_manager import ProjectManager
|
||||
from .port_manager import PortManager
|
||||
from ..utils.images import default_images_directory, images_directories, list_images, md5sum, remove_checksum
|
||||
from .base_node import BaseNode
|
||||
|
||||
from .nios.nio_udp import NIOUDP
|
||||
from .nios.nio_tap import NIOTAP
|
||||
from .error import ImageMissingError, NodeError
|
||||
from .nios.nio_ethernet import NIOEthernet
|
||||
from ..utils.images import md5sum, remove_checksum, images_directories, default_images_directory, list_images
|
||||
from .error import NodeError, ImageMissingError
|
||||
from .nios.nio_tap import NIOTAP
|
||||
from .nios.nio_udp import NIOUDP
|
||||
from .port_manager import PortManager
|
||||
from .project_manager import ProjectManager
|
||||
|
||||
CHUNK_SIZE = 1024 * 8 # 8KB
|
||||
|
||||
|
||||
@ -14,33 +14,34 @@
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
import sys
|
||||
import os
|
||||
import stat
|
||||
import shutil
|
||||
import asyncio
|
||||
import contextlib
|
||||
import json
|
||||
import struct
|
||||
import tempfile
|
||||
import psutil
|
||||
import logging
|
||||
import os
|
||||
import platform
|
||||
import re
|
||||
import asyncssh
|
||||
import shutil
|
||||
import stat
|
||||
import struct
|
||||
import sys
|
||||
import tempfile
|
||||
|
||||
import asyncssh
|
||||
import psutil
|
||||
from fastapi import WebSocketDisconnect
|
||||
from gns3server.utils.interfaces import interfaces
|
||||
|
||||
from gns3server.compute.compute_error import ComputeError
|
||||
from ..compute.port_manager import PortManager
|
||||
from ..utils.asyncio import wait_run_in_executor, locking
|
||||
from ..utils.asyncio.ssh_server import AsyncioSSHServer
|
||||
from ..utils.asyncio.telnet_server import AsyncioTelnetServer
|
||||
from gns3server.compute.ubridge.hypervisor import Hypervisor
|
||||
from gns3server.compute.ubridge.ubridge_error import UbridgeError
|
||||
from .nios.nio_udp import NIOUDP
|
||||
from .error import NodeError
|
||||
from gns3server.utils.interfaces import interfaces
|
||||
|
||||
import logging
|
||||
from ..compute.port_manager import PortManager
|
||||
from ..utils.asyncio import locking, wait_run_in_executor
|
||||
from ..utils.asyncio.ssh_server import AsyncioSSHServer
|
||||
from ..utils.asyncio.telnet_server import AsyncioTelnetServer
|
||||
from .error import NodeError
|
||||
from .nios.nio_udp import NIOUDP
|
||||
|
||||
log = logging.getLogger(__name__)
|
||||
|
||||
|
||||
@ -18,11 +18,11 @@
|
||||
Builtin nodes server module.
|
||||
"""
|
||||
|
||||
from ..base_manager import BaseManager
|
||||
from .builtin_node_factory import BuiltinNodeFactory, BUILTIN_NODES
|
||||
|
||||
import logging
|
||||
|
||||
from ..base_manager import BaseManager
|
||||
from .builtin_node_factory import BUILTIN_NODES, BuiltinNodeFactory
|
||||
|
||||
log = logging.getLogger(__name__)
|
||||
|
||||
|
||||
|
||||
@ -15,13 +15,13 @@
|
||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
|
||||
import logging
|
||||
|
||||
from ..error import NodeError
|
||||
from .nodes.cloud import Cloud
|
||||
from .nodes.nat import Nat
|
||||
from .nodes.ethernet_hub import EthernetHub
|
||||
from .nodes.ethernet_switch import EthernetSwitch
|
||||
|
||||
import logging
|
||||
from .nodes.nat import Nat
|
||||
|
||||
log = logging.getLogger(__name__)
|
||||
|
||||
|
||||
@ -14,18 +14,17 @@
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
import sys
|
||||
import logging
|
||||
import subprocess
|
||||
import sys
|
||||
|
||||
from ...error import NodeError
|
||||
from ...base_node import BaseNode
|
||||
from ...nios.nio_udp import NIOUDP
|
||||
import gns3server.utils.asyncio
|
||||
import gns3server.utils.interfaces
|
||||
from gns3server.compute.ubridge.ubridge_error import UbridgeError
|
||||
|
||||
import gns3server.utils.interfaces
|
||||
import gns3server.utils.asyncio
|
||||
|
||||
import logging
|
||||
from ...base_node import BaseNode
|
||||
from ...error import NodeError
|
||||
from ...nios.nio_udp import NIOUDP
|
||||
|
||||
log = logging.getLogger(__name__)
|
||||
|
||||
|
||||
@ -15,11 +15,10 @@
|
||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
import asyncio
|
||||
import logging
|
||||
|
||||
from ...base_node import BaseNode
|
||||
|
||||
import logging
|
||||
|
||||
log = logging.getLogger(__name__)
|
||||
|
||||
|
||||
|
||||
@ -37,12 +37,13 @@ be the switch). ESW ``access``/``dot1q``/``qinq`` port modes are composed from
|
||||
the ``brctl`` VLAN primitives here -- see ``_apply_port_vlan``.
|
||||
"""
|
||||
|
||||
from ...base_node import BaseNode
|
||||
from ...nios.nio_udp import NIOUDP
|
||||
from ...error import NodeError
|
||||
import logging
|
||||
|
||||
from gns3server.compute.ubridge.ubridge_error import UbridgeError
|
||||
|
||||
import logging
|
||||
from ...base_node import BaseNode
|
||||
from ...error import NodeError
|
||||
from ...nios.nio_udp import NIOUDP
|
||||
|
||||
log = logging.getLogger(__name__)
|
||||
|
||||
|
||||
@ -15,15 +15,14 @@
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
import logging
|
||||
import sys
|
||||
|
||||
from .cloud import Cloud
|
||||
from ...error import NodeError
|
||||
|
||||
import gns3server.utils.interfaces
|
||||
from gns3server.config import Config
|
||||
|
||||
import logging
|
||||
from ...error import NodeError
|
||||
from .cloud import Cloud
|
||||
|
||||
log = logging.getLogger(__name__)
|
||||
|
||||
|
||||
@ -18,28 +18,29 @@
|
||||
Docker server module.
|
||||
"""
|
||||
|
||||
import os
|
||||
import sys
|
||||
import json
|
||||
import asyncio
|
||||
import json
|
||||
import logging
|
||||
import aiohttp
|
||||
import os
|
||||
import shutil
|
||||
import sys
|
||||
|
||||
import aiohttp
|
||||
import platformdirs
|
||||
|
||||
from gns3server.utils import parse_version
|
||||
from gns3server.config import Config
|
||||
from gns3server.utils.asyncio import locking
|
||||
from gns3server.compute.base_manager import BaseManager
|
||||
from gns3server.compute.docker.docker_vm import DockerVM
|
||||
from gns3server.compute.docker.vendor_docker_vm import VendorDockerVM
|
||||
from gns3server.compute.docker.iol_docker_vm import IOLDockerVM
|
||||
from gns3server.compute.docker.docker_error import (
|
||||
DockerError,
|
||||
DockerHttp304Error,
|
||||
DockerHttp404Error,
|
||||
DockerHttp409Error,
|
||||
)
|
||||
from gns3server.compute.docker.docker_vm import DockerVM
|
||||
from gns3server.compute.docker.iol_docker_vm import IOLDockerVM
|
||||
from gns3server.compute.docker.vendor_docker_vm import VendorDockerVM
|
||||
from gns3server.config import Config
|
||||
from gns3server.utils import parse_version
|
||||
from gns3server.utils.asyncio import locking
|
||||
|
||||
log = logging.getLogger(__name__)
|
||||
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Loading…
x
Reference in New Issue
Block a user