Skip to content

Commit 1bdd628

Browse files
author
Alex J Lennon
committed
Add container visualization to network map and improve layout
- Add show_containers parameter to create_network_map tool - Fetch and display Docker containers running on devices as child nodes - Separate gateway devices into their own Network Infrastructure subgraph - Fix embedded device styling (use embedded_controllers CSS class instead of online) - Improve device type detection for embedded devices (Sentai boards, iMX boards) - Increase subgraph title font size from 20px to 32px for better readability - Add container nodes with status indicators and image names - Update MCP help documentation with network visualization features - Add browser rendering best practices to LEARNINGS.md Containers are displayed as child nodes connected to their parent devices with 'Runs' edges, showing container name, status (Running/Stopped), and image name. Gateway devices are now separated from regular devices for cleaner visualization.
1 parent 013628b commit 1bdd628

5 files changed

Lines changed: 286 additions & 14 deletions

File tree

docs/LEARNINGS.md

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -164,3 +164,32 @@ Foundries devices discovered via FoundriesFactory API using `fioctl devices list
164164
- Tools provide actionable troubleshooting steps
165165
- Link to relevant documentation and workflows
166166
- Suggest alternative approaches when primary method fails
167+
168+
## Network Mapping Best Practices
169+
170+
### Browser Rendering for Mermaid Diagrams
171+
**When debugging or verifying network map visualizations, always use browser rendering instead of static PNG exports.**
172+
173+
**Why:**
174+
- Browser renderers (using Mermaid.js) provide more accurate rendering of complex diagrams
175+
- Power connection lines and relationships render correctly in browsers
176+
- Static PNG exports may miss connections or have rendering issues
177+
- Better for verifying that power switch relationships are correctly wired
178+
179+
**How to do it:**
180+
1. Generate the network map with `create_network_map()` (export_format="mermaid" or "html")
181+
2. Create an HTML file that includes the Mermaid diagram
182+
3. Start a local web server: `python3 -m http.server 8000` (in directory with HTML file)
183+
4. Navigate browser to `http://localhost:8000/network_map.html`
184+
5. Use browser snapshot/screenshot tools to capture the rendered diagram
185+
186+
**Example workflow:**
187+
```python
188+
# Generate HTML with embedded Mermaid
189+
result = create_network_map(export_format="html", export_path="network_map.html")
190+
191+
# Serve locally and view in browser
192+
# Browser rendering shows power connections and relationships accurately
193+
```
194+
195+
**Note:** This is especially important when troubleshooting power switch relationships or verifying that device connections are correctly represented in the diagram.

lab_testing/resources/help.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -209,6 +209,7 @@ def get_help_content() -> Dict[str, Any]:
209209
"get_foundries_registration_status": "Check Foundries.io registration, connection, update status (device_id)",
210210
"get_secure_boot_status": "Get detailed secure boot status: U-Boot, kernel, EFI, HAB/CAAM (device_id)",
211211
"get_device_identity": "Get device identity: hostname, SOC unique ID, Foundries registration name (device_id)",
212+
"create_network_map": "Create a visual map of running systems on the target network showing what's up and what isn't. Supports multiple layouts, export formats, device grouping, historical tracking, performance metrics visualization, and container visualization. Use show_containers=true to display Docker containers running on devices. Export formats: mermaid (default), png, svg, pdf, html, json, csv. Use quick_mode=true for faster generation (<5s) by skipping network scanning. Layouts: lr (left-right, default), tb (top-bottom), radial, hierarchical, grid. Group by: type, status, location, power_circuit, none. Example: create_network_map(show_containers=true, quick_mode=true, export_format='html')",
212213
},
213214
"batch_operations": {
214215
"batch_operation": "Execute operation on multiple devices in parallel (device_ids[], operation, max_concurrent=5, ...)",

lab_testing/server/tool_definitions.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -663,6 +663,11 @@ def get_all_tools() -> List[Tool]:
663663
"description": "If true, show historical status changes and uptime indicators",
664664
"default": False,
665665
},
666+
"show_containers": {
667+
"type": "boolean",
668+
"description": "If true, fetch and display Docker containers running on devices",
669+
"default": False,
670+
},
666671
"export_format": {
667672
"type": "string",
668673
"enum": ["mermaid", "png", "svg", "pdf", "html", "json", "csv"],

lab_testing/server/tool_handlers.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1001,6 +1001,7 @@ def handle_tool(
10011001
show_metrics = arguments.get("show_metrics", True)
10021002
show_alerts = arguments.get("show_alerts", True)
10031003
show_history = arguments.get("show_history", False)
1004+
show_containers = arguments.get("show_containers", False)
10041005
export_format = arguments.get("export_format", "mermaid")
10051006
export_path = arguments.get("export_path")
10061007

@@ -1036,6 +1037,7 @@ def handle_tool(
10361037
show_metrics=show_metrics,
10371038
show_alerts=show_alerts,
10381039
show_history=show_history,
1040+
show_containers=show_containers,
10391041
export_format=export_format,
10401042
export_path=export_path,
10411043
)

0 commit comments

Comments
 (0)