feat(api): MCP, OpenAPI & Dynamic Introspection

New Features:
- API endpoints now support comprehensive input validation with detailed error responses via Pydantic models.
- OpenAPI specification endpoint (/openapi.json) and interactive Swagger UI documentation (/docs) now available for API discovery.
- Enhanced MCP session lifecycle management with create, retrieve, and delete operations.
- Network diagnostic tools: traceroute, nslookup, NMAP scanning, and network topology viewing exposed via API.
- Device search, filtering by status (including 'offline'), and bulk operations (copy, delete, update).
- Wake-on-LAN functionality for remote device management.
- Added dynamic tool disablement and status reporting.

Bug Fixes:
- Fixed get_tools_status in registry to correctly return boolean values instead of None for enabled tools.
- Improved error handling for invalid API inputs with standardized validation responses.
- Fixed OPTIONS request handling for cross-origin requests.

Refactoring:
- Significant refactoring of api_server_start.py to use decorator-based validation (@validate_request).
This commit is contained in:
Adam Outler
2026-01-18 18:16:18 +00:00
parent cea3369b5e
commit ecea1d1fbd
46 changed files with 5195 additions and 1053 deletions

View File

@@ -4,34 +4,30 @@ Dashboard Page UI Tests
Tests main dashboard metrics, charts, and device table
"""
import time
from selenium.webdriver.common.by import By
from selenium.webdriver.support.ui import WebDriverWait
from selenium.webdriver.support import expected_conditions as EC
import sys
import os
from selenium.webdriver.common.by import By
# Add test directory to path
sys.path.insert(0, os.path.dirname(__file__))
from test_helpers import BASE_URL # noqa: E402 [flake8 lint suppression]
from .test_helpers import BASE_URL, wait_for_page_load, wait_for_element_by_css # noqa: E402
def test_dashboard_loads(driver):
"""Test: Dashboard/index page loads successfully"""
driver.get(f"{BASE_URL}/index.php")
WebDriverWait(driver, 10).until(
EC.presence_of_element_located((By.TAG_NAME, "body"))
)
time.sleep(2)
wait_for_page_load(driver, timeout=10)
assert driver.title, "Page should have a title"
def test_metric_tiles_present(driver):
"""Test: Dashboard metric tiles are rendered"""
driver.get(f"{BASE_URL}/index.php")
time.sleep(2)
wait_for_page_load(driver, timeout=10)
# Wait for at least one metric/tile/info-box to be present
wait_for_element_by_css(driver, ".metric, .tile, .info-box, .small-box", timeout=10)
tiles = driver.find_elements(By.CSS_SELECTOR, ".metric, .tile, .info-box, .small-box")
assert len(tiles) > 0, "Dashboard should have metric tiles"
@@ -39,7 +35,8 @@ def test_metric_tiles_present(driver):
def test_device_table_present(driver):
"""Test: Dashboard device table is rendered"""
driver.get(f"{BASE_URL}/index.php")
time.sleep(2)
wait_for_page_load(driver, timeout=10)
wait_for_element_by_css(driver, "table", timeout=10)
table = driver.find_elements(By.CSS_SELECTOR, "table")
assert len(table) > 0, "Dashboard should have a device table"
@@ -47,6 +44,7 @@ def test_device_table_present(driver):
def test_charts_present(driver):
"""Test: Dashboard charts are rendered"""
driver.get(f"{BASE_URL}/index.php")
time.sleep(3) # Charts may take longer to load
wait_for_page_load(driver, timeout=15) # Charts may take longer to load
wait_for_element_by_css(driver, "canvas, .chart, svg", timeout=15)
charts = driver.find_elements(By.CSS_SELECTOR, "canvas, .chart, svg")
assert len(charts) > 0, "Dashboard should have charts"