Spaces:
Running
Running
| #!/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() | |