summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorOleksandr Kuchmystyi <o.kuchmystyi@vyos.io>2025-12-08 18:32:16 +0300
committerOleksandr Kuchmystyi <o.kuchmystyi@vyos.io>2025-12-08 18:32:16 +0300
commit63bf6ef523b4eedc0bf88d2339e6bdf93c60569c (patch)
tree28103cb73df90f30cdc5bee4d3037db256d78747 /src
parent5ae12dd4e2535fd4c8569a71309422d300625621 (diff)
downloadvyos-1x-63bf6ef523b4eedc0bf88d2339e6bdf93c60569c.tar.gz
vyos-1x-63bf6ef523b4eedc0bf88d2339e6bdf93c60569c.zip
tech-support: T7134: add topology snapshot generation using `hwloc` package
This enhances diagnostic capabilities by providing hardware topology visuals within support archives.
Diffstat (limited to 'src')
-rwxr-xr-xsrc/op_mode/generate_tech-support_archive.py21
1 files changed, 21 insertions, 0 deletions
diff --git a/src/op_mode/generate_tech-support_archive.py b/src/op_mode/generate_tech-support_archive.py
index 1d3f26d39..92442b78d 100755
--- a/src/op_mode/generate_tech-support_archive.py
+++ b/src/op_mode/generate_tech-support_archive.py
@@ -23,6 +23,7 @@ from shutil import rmtree
from socket import gethostname
from sys import exit
from tarfile import open as tar_open
+from vyos.utils.process import call
from vyos.utils.process import rc_cmd
from vyos.remote import upload
@@ -91,6 +92,22 @@ def __generate_main_archive_file(archive_file: str, tmp_dir_path: str) -> None:
with tar_open(name=archive_file, mode='x:gz') as tar_file:
tar_file.add(tmp_dir_path, arcname=os.path.basename(tmp_dir_path))
+def __generate_topology_snapshots(output_dir: Path) -> None:
+ """
+ Generates physical and logical topology PNG files using `lstopo`
+
+ :param output_dir: directory where topology PNGs will be stored
+ """
+
+ physical_topo = output_dir / 'topology.png'
+ logical_topo = output_dir / 'topology-logical.png'
+
+ # Capture physical topology
+ call(['lstopo', '--output-format', 'png', str(physical_topo)])
+
+ # Capture logical topology
+ call(['lstopo', '--logical', '--output-format', 'png', str(logical_topo)])
+
if __name__ == '__main__':
defualt_tmp_dir = '/tmp'
@@ -124,6 +141,10 @@ if __name__ == '__main__':
report_file: Path = Path(f'{tmp_dir_path}/show_tech-support_report.txt')
report_file.touch()
+
+ # Call the topology snapshot function here
+ __generate_topology_snapshots(tmp_dir)
+
try:
save_stdout(op('show tech-support report'), report_file)