diff options
| author | Christian Breunig <christian@breunig.cc> | 2025-12-08 20:44:07 +0000 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2025-12-08 20:44:07 +0000 |
| commit | b4b3ca488213abfed2175d38fdd09628e8a33766 (patch) | |
| tree | 28103cb73df90f30cdc5bee4d3037db256d78747 | |
| parent | 5ae12dd4e2535fd4c8569a71309422d300625621 (diff) | |
| parent | 63bf6ef523b4eedc0bf88d2339e6bdf93c60569c (diff) | |
| download | vyos-1x-b4b3ca488213abfed2175d38fdd09628e8a33766.tar.gz vyos-1x-b4b3ca488213abfed2175d38fdd09628e8a33766.zip | |
Merge pull request #4891 from alexandr-san4ez/T7134-current
tech-support: T7134: add topology snapshot generation using `hwloc` package
| -rw-r--r-- | debian/control | 1 | ||||
| -rwxr-xr-x | src/op_mode/generate_tech-support_archive.py | 21 |
2 files changed, 22 insertions, 0 deletions
diff --git a/debian/control b/debian/control index 99a2b3e31..12b288931 100644 --- a/debian/control +++ b/debian/control @@ -109,6 +109,7 @@ Depends: file, iproute2 (>= 6.0.0), linux-cpupower, + hwloc, # ipaddrcheck is widely used in IP value validators ipaddrcheck, ethtool (>= 6.10), 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) |
