forked from Mcrich23/Container-Compose
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathverify_vsock_config.py
More file actions
157 lines (127 loc) Β· 5.06 KB
/
verify_vsock_config.py
File metadata and controls
157 lines (127 loc) Β· 5.06 KB
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
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
#!/usr/bin/env python3
"""Verify vsock relay configuration details"""
import sys
from pathlib import Path
from ruamel.yaml import YAML
def verify_vsock_relays(file_path: Path) -> dict:
"""Verify vsock relay configuration in detail.
Returns:
Dictionary with verification results
"""
yaml = YAML()
yaml.preserve_quotes = True
content = file_path.read_text()
data = yaml.load(content)
results = {
'file': file_path.name,
'services': {},
'vsock_relays': [],
'vsock_urls': []
}
services = data.get('services', {})
for service_name, service_config in services.items():
# Check for x-apple-relays
if 'x-apple-relays' in service_config:
relays = service_config['x-apple-relays']
for relay in relays:
relay_info = {
'service': service_name,
'type': relay.get('type'),
'port': relay.get('port'),
'local_address': relay.get('local_address'),
'local_port': relay.get('local_port'),
'target': relay.get('target'),
'valid': True
}
# Validate relay structure
if relay_info['type'] and not relay_info['type'].startswith('vsock'):
relay_info['valid'] = False
results['vsock_relays'].append(relay_info)
# Check for vsock URLs in environment
if 'env' in service_config:
env = service_config['env']
for key, value in env.items():
if isinstance(value, str) and 'vsock://' in value:
results['vsock_urls'].append({
'service': service_name,
'variable': key,
'url': value
})
return results
def print_verification_report(results_list):
"""Print detailed verification report."""
print("\n" + "=" * 70)
print("VSOCK RELAY CONFIGURATION VERIFICATION")
print("=" * 70)
total_relays = 0
total_urls = 0
all_valid = True
for results in results_list:
print(f"\nπ {results['file']}")
print("-" * 70)
# VSOCK Relays
if results['vsock_relays']:
print("\nVSOCK Relays:")
for relay in results['vsock_relays']:
status = "β
" if relay['valid'] else "β"
print(f" {status} {relay['service']}: {relay['type']}")
if relay.get('port'):
print(f" port: {relay['port']}")
if relay.get('local_address'):
print(f" local_address: {relay['local_address']}")
if relay.get('local_port'):
print(f" local_port: {relay['local_port']}")
if relay.get('target'):
print(f" target: {relay['target']}")
if not relay['valid']:
all_valid = False
total_relays += 1
# VSOCK URLs
if results['vsock_urls']:
print("\nVSOCK URLs in Environment:")
for url_info in results['vsock_urls']:
print(f" β
{url_info['service']}: {url_info['variable']} = {url_info['url']}")
total_urls += 1
# Summary
print("\n" + "=" * 70)
print("SUMMARY")
print("=" * 70)
print(f"Total VSOCK Relays: {total_relays}")
print(f"Total VSOCK URLs: {total_urls}")
print(f"All Valid: {'β
YES' if all_valid else 'β NO'}")
print("\nVSOCK Relay Types:")
relay_types = {}
for results in results_list:
for relay in results['vsock_relays']:
rtype = relay.get('type', 'unknown')
relay_types[rtype] = relay_types.get(rtype, 0) + 1
for rtype, count in sorted(relay_types.items()):
print(f" β’ {rtype}: {count}")
print("\nReady for:")
print(" β MCP server connections (vsock-mcp-bridge)")
print(" β Log stream ingestion (vsock-log-stream)")
print(" β Database relay (vsock-db)")
print(" β Embedding acceleration (vsock-ane-embedding)")
print(" β Generic vsock connections (vsock-generic)")
if all_valid:
print("\nβ
ALL VSOCK CONFIGURATIONS VALID")
return 0
else:
print("\nβ SOME VSOCK CONFIGURATIONS INVALID")
return 1
def main():
appcontainer_dir = Path.home() / "workspace" / "isaac_ros_custom" / ".appcontainer"
compose_files = [
'honcho-stack.yml',
'honcho-stack-with-derivers.yml',
'honcho-derivers.yml'
]
results_list = []
for filename in compose_files:
file_path = appcontainer_dir / filename
if file_path.exists():
results = verify_vsock_relays(file_path)
results_list.append(results)
return print_verification_report(results_list)
if __name__ == "__main__":
sys.exit(main())