35 lines
981 B
Python
35 lines
981 B
Python
|
|
#!/usr/bin/env python3
|
||
|
|
"""
|
||
|
|
Direct test of the discovery service
|
||
|
|
"""
|
||
|
|
import asyncio
|
||
|
|
import sys
|
||
|
|
import os
|
||
|
|
|
||
|
|
# Add src to path
|
||
|
|
sys.path.insert(0, os.path.join(os.path.dirname(__file__), 'src'))
|
||
|
|
|
||
|
|
from discovery.protocol_discovery_modified import discovery_service
|
||
|
|
|
||
|
|
async def test_discovery():
|
||
|
|
"""Test discovery service directly"""
|
||
|
|
print("Starting discovery test...")
|
||
|
|
|
||
|
|
try:
|
||
|
|
# Start discovery
|
||
|
|
result = await discovery_service.discover_all_protocols("test_scan")
|
||
|
|
|
||
|
|
print(f"Discovery completed!")
|
||
|
|
print(f"Discovered endpoints: {len(result.discovered_endpoints)}")
|
||
|
|
print(f"Errors: {result.errors}")
|
||
|
|
|
||
|
|
for endpoint in result.discovered_endpoints:
|
||
|
|
print(f" - {endpoint.protocol_type}: {endpoint.address}")
|
||
|
|
|
||
|
|
except Exception as e:
|
||
|
|
print(f"Discovery failed: {e}")
|
||
|
|
import traceback
|
||
|
|
traceback.print_exc()
|
||
|
|
|
||
|
|
if __name__ == "__main__":
|
||
|
|
asyncio.run(test_discovery())
|