Spaces:
Running
Running
| #!/usr/bin/env python3 | |
| """ | |
| Test the Overgrowth MCP Server tools | |
| """ | |
| import asyncio | |
| import sys | |
| sys.path.insert(0, '/home/gpaasch/overgrowth-mcp-server') | |
| from server import gns3, GNS3Client | |
| import json | |
| async def test_gns3_connection(): | |
| """Test GNS3 API connection and tools""" | |
| print("Testing GNS3 connection...\n") | |
| # Test 1: Get projects | |
| print("1. Fetching GNS3 projects...") | |
| projects = gns3.get_projects() | |
| print(f" Found {len(projects)} projects") | |
| # Find overgrowth project | |
| overgrowth = next((p for p in projects if p['name'] == 'overgrowth'), None) | |
| if overgrowth: | |
| print(f" β Overgrowth project found: {overgrowth['project_id']}") | |
| print(f" Status: {overgrowth.get('status', 'unknown')}\n") | |
| # Test 2: Get topology | |
| print("2. Fetching topology...") | |
| project_id = overgrowth['project_id'] | |
| nodes = gns3.get_nodes(project_id) | |
| links = gns3.get_links(project_id) | |
| print(f" Nodes: {len(nodes)}") | |
| for node in nodes: | |
| print(f" - {node['name']} ({node['node_type']}) - {node['status']}") | |
| print(f" Links: {len(links)}\n") | |
| else: | |
| print(" β Overgrowth project not found\n") | |
| # Test 3: List other interesting projects | |
| print("3. Other GNS3 projects:") | |
| for proj in projects[:10]: # Show first 10 | |
| print(f" - {proj['name']} ({proj.get('status', 'unknown')})") | |
| print(f"\n (showing 10 of {len(projects)} total projects)") | |
| print("\nβ GNS3 connection test complete!") | |
| if __name__ == "__main__": | |
| asyncio.run(test_gns3_connection()) | |