File size: 1,658 Bytes
765065a
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
#!/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())