Spaces:
Running
Running
File size: 2,891 Bytes
765065a c7576e1 765065a c7576e1 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 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 |
#!/usr/bin/env python3
"""Quick topology verification for Overgrowth CCNA lab"""
import requests
import json
import os
GNS3_SERVER = os.getenv("GNS3_SERVER", "http://localhost:3080")
GNS3_API = f"{GNS3_SERVER}/v2"
PROJECT_ID = "1f712057-b33d-433f-90bb-2b9b3804a95e"
def verify_topology():
# Get nodes
resp = requests.get(f"{GNS3_API}/projects/{PROJECT_ID}/nodes")
nodes = resp.json()
# Get links
resp = requests.get(f"{GNS3_API}/projects/{PROJECT_ID}/links")
links = resp.json()
print("="*70)
print("CCNA LAB TOPOLOGY VERIFICATION")
print("="*70)
print()
# Count by type
switches = [n for n in nodes if 'SW' in n['name']]
pcs = [n for n in nodes if 'PC' in n['name']]
clouds = [n for n in nodes if n['node_type'] == 'cloud']
print(f"β Total Devices: {len(nodes)}")
print(f" - Switches: {len(switches)}")
for sw in switches:
print(f" β’ {sw['name']:20} [{sw['status']}]")
print(f" - PCs (VPCS): {len(pcs)}")
for pc in pcs:
print(f" β’ {pc['name']:20} [{pc['status']}]")
print(f" - Cloud: {len(clouds)}")
for cloud in clouds:
print(f" β’ {cloud['name']:20} [{cloud['status']}]")
print(f"\nβ Total Links: {len(links)}")
print()
# Verify expected connections
expected = {
'PC1-Sales': 'SW1-Access',
'PC2-Sales': 'SW1-Access',
'SW1-Access': 'SW2-Core',
'PC3-Engineering': 'SW2-Core',
'PC4-Engineering': 'SW2-Core',
'SW2-Core': 'SW3-Access',
'PC5-Guest': 'SW3-Access',
'PC6-Guest': 'SW3-Access',
'Internet': 'SW2-Core'
}
print("Connection Verification:")
node_dict = {n['name']: n for n in nodes}
for link in links:
if len(link['nodes']) >= 2:
node1_name = next((name for name, n in node_dict.items()
if n['node_id'] == link['nodes'][0]['node_id']), 'Unknown')
node2_name = next((name for name, n in node_dict.items()
if n['node_id'] == link['nodes'][1]['node_id']), 'Unknown')
port1 = link['nodes'][0].get('port_number', 0)
port2 = link['nodes'][1].get('port_number', 0)
print(f" β {node1_name:20} (port {port1}) β {node2_name:20} (port {port2})")
print()
print("="*70)
print("Topology Status: READY β
")
print("="*70)
print()
print("Next Steps:")
print("1. Open GNS3 GUI and load 'overgrowth' project")
print("2. Start all VPCS nodes (PC1-PC6)")
print("3. Configure IP addresses (see CCNA_LAB_GUIDE.md)")
print("4. Test connectivity with ping commands")
print()
print("Lab Guide: /home/gpaasch/overgrowth-mcp-server/CCNA_LAB_GUIDE.md")
print()
if __name__ == "__main__":
verify_topology()
|