amd-node-scraper 0.0.1__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- amd_node_scraper-0.0.1.dist-info/LICENSE +21 -0
- amd_node_scraper-0.0.1.dist-info/METADATA +424 -0
- amd_node_scraper-0.0.1.dist-info/RECORD +197 -0
- amd_node_scraper-0.0.1.dist-info/WHEEL +5 -0
- amd_node_scraper-0.0.1.dist-info/entry_points.txt +2 -0
- amd_node_scraper-0.0.1.dist-info/top_level.txt +1 -0
- nodescraper/__init__.py +32 -0
- nodescraper/base/__init__.py +34 -0
- nodescraper/base/inbandcollectortask.py +118 -0
- nodescraper/base/inbanddataplugin.py +39 -0
- nodescraper/base/regexanalyzer.py +120 -0
- nodescraper/cli/__init__.py +29 -0
- nodescraper/cli/cli.py +511 -0
- nodescraper/cli/constants.py +27 -0
- nodescraper/cli/dynamicparserbuilder.py +171 -0
- nodescraper/cli/helper.py +517 -0
- nodescraper/cli/inputargtypes.py +129 -0
- nodescraper/configbuilder.py +123 -0
- nodescraper/configregistry.py +66 -0
- nodescraper/configs/node_status.json +19 -0
- nodescraper/connection/__init__.py +25 -0
- nodescraper/connection/inband/__init__.py +46 -0
- nodescraper/connection/inband/inband.py +171 -0
- nodescraper/connection/inband/inbandlocal.py +93 -0
- nodescraper/connection/inband/inbandmanager.py +151 -0
- nodescraper/connection/inband/inbandremote.py +173 -0
- nodescraper/connection/inband/sshparams.py +43 -0
- nodescraper/constants.py +26 -0
- nodescraper/enums/__init__.py +40 -0
- nodescraper/enums/eventcategory.py +89 -0
- nodescraper/enums/eventpriority.py +42 -0
- nodescraper/enums/executionstatus.py +44 -0
- nodescraper/enums/osfamily.py +34 -0
- nodescraper/enums/systeminteraction.py +41 -0
- nodescraper/enums/systemlocation.py +33 -0
- nodescraper/generictypes.py +36 -0
- nodescraper/interfaces/__init__.py +44 -0
- nodescraper/interfaces/connectionmanager.py +143 -0
- nodescraper/interfaces/dataanalyzertask.py +138 -0
- nodescraper/interfaces/datacollectortask.py +185 -0
- nodescraper/interfaces/dataplugin.py +356 -0
- nodescraper/interfaces/plugin.py +127 -0
- nodescraper/interfaces/resultcollator.py +56 -0
- nodescraper/interfaces/task.py +164 -0
- nodescraper/interfaces/taskresulthook.py +39 -0
- nodescraper/models/__init__.py +48 -0
- nodescraper/models/analyzerargs.py +93 -0
- nodescraper/models/collectorargs.py +30 -0
- nodescraper/models/connectionconfig.py +34 -0
- nodescraper/models/datamodel.py +171 -0
- nodescraper/models/datapluginresult.py +39 -0
- nodescraper/models/event.py +158 -0
- nodescraper/models/pluginconfig.py +38 -0
- nodescraper/models/pluginresult.py +39 -0
- nodescraper/models/systeminfo.py +44 -0
- nodescraper/models/taskresult.py +185 -0
- nodescraper/models/timerangeargs.py +38 -0
- nodescraper/pluginexecutor.py +274 -0
- nodescraper/pluginregistry.py +152 -0
- nodescraper/plugins/__init__.py +25 -0
- nodescraper/plugins/inband/__init__.py +25 -0
- nodescraper/plugins/inband/amdsmi/__init__.py +28 -0
- nodescraper/plugins/inband/amdsmi/amdsmi_analyzer.py +821 -0
- nodescraper/plugins/inband/amdsmi/amdsmi_collector.py +1313 -0
- nodescraper/plugins/inband/amdsmi/amdsmi_plugin.py +43 -0
- nodescraper/plugins/inband/amdsmi/amdsmidata.py +1002 -0
- nodescraper/plugins/inband/amdsmi/analyzer_args.py +50 -0
- nodescraper/plugins/inband/amdsmi/cper.py +65 -0
- nodescraper/plugins/inband/bios/__init__.py +29 -0
- nodescraper/plugins/inband/bios/analyzer_args.py +64 -0
- nodescraper/plugins/inband/bios/bios_analyzer.py +93 -0
- nodescraper/plugins/inband/bios/bios_collector.py +93 -0
- nodescraper/plugins/inband/bios/bios_plugin.py +43 -0
- nodescraper/plugins/inband/bios/biosdata.py +30 -0
- nodescraper/plugins/inband/cmdline/__init__.py +25 -0
- nodescraper/plugins/inband/cmdline/analyzer_args.py +80 -0
- nodescraper/plugins/inband/cmdline/cmdline_analyzer.py +113 -0
- nodescraper/plugins/inband/cmdline/cmdline_collector.py +77 -0
- nodescraper/plugins/inband/cmdline/cmdline_plugin.py +43 -0
- nodescraper/plugins/inband/cmdline/cmdlinedata.py +30 -0
- nodescraper/plugins/inband/device_enumeration/__init__.py +29 -0
- nodescraper/plugins/inband/device_enumeration/analyzer_args.py +73 -0
- nodescraper/plugins/inband/device_enumeration/device_enumeration_analyzer.py +81 -0
- nodescraper/plugins/inband/device_enumeration/device_enumeration_collector.py +176 -0
- nodescraper/plugins/inband/device_enumeration/device_enumeration_plugin.py +45 -0
- nodescraper/plugins/inband/device_enumeration/deviceenumdata.py +36 -0
- nodescraper/plugins/inband/dimm/__init__.py +25 -0
- nodescraper/plugins/inband/dimm/collector_args.py +31 -0
- nodescraper/plugins/inband/dimm/dimm_collector.py +151 -0
- nodescraper/plugins/inband/dimm/dimm_plugin.py +40 -0
- nodescraper/plugins/inband/dimm/dimmdata.py +30 -0
- nodescraper/plugins/inband/dkms/__init__.py +25 -0
- nodescraper/plugins/inband/dkms/analyzer_args.py +85 -0
- nodescraper/plugins/inband/dkms/dkms_analyzer.py +106 -0
- nodescraper/plugins/inband/dkms/dkms_collector.py +76 -0
- nodescraper/plugins/inband/dkms/dkms_plugin.py +43 -0
- nodescraper/plugins/inband/dkms/dkmsdata.py +33 -0
- nodescraper/plugins/inband/dmesg/__init__.py +28 -0
- nodescraper/plugins/inband/dmesg/analyzer_args.py +33 -0
- nodescraper/plugins/inband/dmesg/collector_args.py +39 -0
- nodescraper/plugins/inband/dmesg/dmesg_analyzer.py +503 -0
- nodescraper/plugins/inband/dmesg/dmesg_collector.py +164 -0
- nodescraper/plugins/inband/dmesg/dmesg_plugin.py +44 -0
- nodescraper/plugins/inband/dmesg/dmesgdata.py +116 -0
- nodescraper/plugins/inband/fabrics/__init__.py +28 -0
- nodescraper/plugins/inband/fabrics/fabrics_collector.py +726 -0
- nodescraper/plugins/inband/fabrics/fabrics_plugin.py +37 -0
- nodescraper/plugins/inband/fabrics/fabricsdata.py +140 -0
- nodescraper/plugins/inband/journal/__init__.py +28 -0
- nodescraper/plugins/inband/journal/collector_args.py +33 -0
- nodescraper/plugins/inband/journal/journal_collector.py +107 -0
- nodescraper/plugins/inband/journal/journal_plugin.py +40 -0
- nodescraper/plugins/inband/journal/journaldata.py +44 -0
- nodescraper/plugins/inband/kernel/__init__.py +25 -0
- nodescraper/plugins/inband/kernel/analyzer_args.py +64 -0
- nodescraper/plugins/inband/kernel/kernel_analyzer.py +91 -0
- nodescraper/plugins/inband/kernel/kernel_collector.py +129 -0
- nodescraper/plugins/inband/kernel/kernel_plugin.py +43 -0
- nodescraper/plugins/inband/kernel/kerneldata.py +32 -0
- nodescraper/plugins/inband/kernel_module/__init__.py +25 -0
- nodescraper/plugins/inband/kernel_module/analyzer_args.py +59 -0
- nodescraper/plugins/inband/kernel_module/kernel_module_analyzer.py +211 -0
- nodescraper/plugins/inband/kernel_module/kernel_module_collector.py +264 -0
- nodescraper/plugins/inband/kernel_module/kernel_module_data.py +60 -0
- nodescraper/plugins/inband/kernel_module/kernel_module_plugin.py +43 -0
- nodescraper/plugins/inband/memory/__init__.py +25 -0
- nodescraper/plugins/inband/memory/analyzer_args.py +45 -0
- nodescraper/plugins/inband/memory/memory_analyzer.py +98 -0
- nodescraper/plugins/inband/memory/memory_collector.py +330 -0
- nodescraper/plugins/inband/memory/memory_plugin.py +43 -0
- nodescraper/plugins/inband/memory/memorydata.py +90 -0
- nodescraper/plugins/inband/network/__init__.py +28 -0
- nodescraper/plugins/inband/network/network_collector.py +1828 -0
- nodescraper/plugins/inband/network/network_plugin.py +37 -0
- nodescraper/plugins/inband/network/networkdata.py +319 -0
- nodescraper/plugins/inband/nvme/__init__.py +28 -0
- nodescraper/plugins/inband/nvme/nvme_collector.py +167 -0
- nodescraper/plugins/inband/nvme/nvme_plugin.py +37 -0
- nodescraper/plugins/inband/nvme/nvmedata.py +45 -0
- nodescraper/plugins/inband/os/__init__.py +25 -0
- nodescraper/plugins/inband/os/analyzer_args.py +64 -0
- nodescraper/plugins/inband/os/os_analyzer.py +73 -0
- nodescraper/plugins/inband/os/os_collector.py +131 -0
- nodescraper/plugins/inband/os/os_plugin.py +43 -0
- nodescraper/plugins/inband/os/osdata.py +31 -0
- nodescraper/plugins/inband/package/__init__.py +25 -0
- nodescraper/plugins/inband/package/analyzer_args.py +48 -0
- nodescraper/plugins/inband/package/package_analyzer.py +253 -0
- nodescraper/plugins/inband/package/package_collector.py +273 -0
- nodescraper/plugins/inband/package/package_plugin.py +43 -0
- nodescraper/plugins/inband/package/packagedata.py +41 -0
- nodescraper/plugins/inband/pcie/__init__.py +29 -0
- nodescraper/plugins/inband/pcie/analyzer_args.py +63 -0
- nodescraper/plugins/inband/pcie/pcie_analyzer.py +1081 -0
- nodescraper/plugins/inband/pcie/pcie_collector.py +690 -0
- nodescraper/plugins/inband/pcie/pcie_data.py +2017 -0
- nodescraper/plugins/inband/pcie/pcie_plugin.py +43 -0
- nodescraper/plugins/inband/process/__init__.py +25 -0
- nodescraper/plugins/inband/process/analyzer_args.py +45 -0
- nodescraper/plugins/inband/process/collector_args.py +31 -0
- nodescraper/plugins/inband/process/process_analyzer.py +91 -0
- nodescraper/plugins/inband/process/process_collector.py +115 -0
- nodescraper/plugins/inband/process/process_plugin.py +46 -0
- nodescraper/plugins/inband/process/processdata.py +34 -0
- nodescraper/plugins/inband/rocm/__init__.py +25 -0
- nodescraper/plugins/inband/rocm/analyzer_args.py +66 -0
- nodescraper/plugins/inband/rocm/rocm_analyzer.py +100 -0
- nodescraper/plugins/inband/rocm/rocm_collector.py +205 -0
- nodescraper/plugins/inband/rocm/rocm_plugin.py +43 -0
- nodescraper/plugins/inband/rocm/rocmdata.py +62 -0
- nodescraper/plugins/inband/storage/__init__.py +25 -0
- nodescraper/plugins/inband/storage/analyzer_args.py +38 -0
- nodescraper/plugins/inband/storage/collector_args.py +31 -0
- nodescraper/plugins/inband/storage/storage_analyzer.py +152 -0
- nodescraper/plugins/inband/storage/storage_collector.py +110 -0
- nodescraper/plugins/inband/storage/storage_plugin.py +44 -0
- nodescraper/plugins/inband/storage/storagedata.py +70 -0
- nodescraper/plugins/inband/sysctl/__init__.py +29 -0
- nodescraper/plugins/inband/sysctl/analyzer_args.py +67 -0
- nodescraper/plugins/inband/sysctl/sysctl_analyzer.py +81 -0
- nodescraper/plugins/inband/sysctl/sysctl_collector.py +101 -0
- nodescraper/plugins/inband/sysctl/sysctl_plugin.py +43 -0
- nodescraper/plugins/inband/sysctl/sysctldata.py +42 -0
- nodescraper/plugins/inband/syslog/__init__.py +28 -0
- nodescraper/plugins/inband/syslog/syslog_collector.py +121 -0
- nodescraper/plugins/inband/syslog/syslog_plugin.py +37 -0
- nodescraper/plugins/inband/syslog/syslogdata.py +46 -0
- nodescraper/plugins/inband/uptime/__init__.py +25 -0
- nodescraper/plugins/inband/uptime/uptime_collector.py +88 -0
- nodescraper/plugins/inband/uptime/uptime_plugin.py +37 -0
- nodescraper/plugins/inband/uptime/uptimedata.py +31 -0
- nodescraper/resultcollators/__init__.py +25 -0
- nodescraper/resultcollators/tablesummary.py +159 -0
- nodescraper/taskresulthooks/__init__.py +28 -0
- nodescraper/taskresulthooks/filesystemloghook.py +88 -0
- nodescraper/typeutils.py +171 -0
- nodescraper/utils.py +412 -0
|
@@ -0,0 +1,151 @@
|
|
|
1
|
+
###############################################################################
|
|
2
|
+
#
|
|
3
|
+
# MIT License
|
|
4
|
+
#
|
|
5
|
+
# Copyright (c) 2025 Advanced Micro Devices, Inc.
|
|
6
|
+
#
|
|
7
|
+
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
8
|
+
# of this software and associated documentation files (the "Software"), to deal
|
|
9
|
+
# in the Software without restriction, including without limitation the rights
|
|
10
|
+
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
11
|
+
# copies of the Software, and to permit persons to whom the Software is
|
|
12
|
+
# furnished to do so, subject to the following conditions:
|
|
13
|
+
#
|
|
14
|
+
# The above copyright notice and this permission notice shall be included in all
|
|
15
|
+
# copies or substantial portions of the Software.
|
|
16
|
+
#
|
|
17
|
+
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
18
|
+
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
19
|
+
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
20
|
+
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
21
|
+
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
22
|
+
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
23
|
+
# SOFTWARE.
|
|
24
|
+
#
|
|
25
|
+
###############################################################################
|
|
26
|
+
from __future__ import annotations
|
|
27
|
+
|
|
28
|
+
from logging import Logger
|
|
29
|
+
from typing import Optional, Union
|
|
30
|
+
|
|
31
|
+
from nodescraper.enums import (
|
|
32
|
+
EventCategory,
|
|
33
|
+
EventPriority,
|
|
34
|
+
ExecutionStatus,
|
|
35
|
+
OSFamily,
|
|
36
|
+
SystemLocation,
|
|
37
|
+
)
|
|
38
|
+
from nodescraper.interfaces.connectionmanager import ConnectionManager
|
|
39
|
+
from nodescraper.interfaces.taskresulthook import TaskResultHook
|
|
40
|
+
from nodescraper.models import SystemInfo, TaskResult
|
|
41
|
+
from nodescraper.utils import get_exception_traceback
|
|
42
|
+
|
|
43
|
+
from .inband import InBandConnection
|
|
44
|
+
from .inbandlocal import LocalShell
|
|
45
|
+
from .inbandremote import RemoteShell, SSHConnectionError
|
|
46
|
+
from .sshparams import SSHConnectionParams
|
|
47
|
+
|
|
48
|
+
|
|
49
|
+
class InBandConnectionManager(ConnectionManager[InBandConnection, SSHConnectionParams]):
|
|
50
|
+
|
|
51
|
+
def __init__(
|
|
52
|
+
self,
|
|
53
|
+
system_info: SystemInfo,
|
|
54
|
+
logger: Optional[Logger] = None,
|
|
55
|
+
max_event_priority_level: Union[EventPriority, str] = EventPriority.CRITICAL,
|
|
56
|
+
parent: Optional[str] = None,
|
|
57
|
+
task_result_hooks: Optional[list[TaskResultHook]] = None,
|
|
58
|
+
connection_args: Optional[SSHConnectionParams] = None,
|
|
59
|
+
**kwargs,
|
|
60
|
+
):
|
|
61
|
+
super().__init__(
|
|
62
|
+
system_info,
|
|
63
|
+
logger,
|
|
64
|
+
max_event_priority_level,
|
|
65
|
+
parent,
|
|
66
|
+
task_result_hooks,
|
|
67
|
+
connection_args,
|
|
68
|
+
**kwargs,
|
|
69
|
+
)
|
|
70
|
+
|
|
71
|
+
def _check_os_family(self):
|
|
72
|
+
"""Check the OS family of the system under test (SUT)
|
|
73
|
+
|
|
74
|
+
Raises:
|
|
75
|
+
RuntimeError: If the connection is not initialized
|
|
76
|
+
"""
|
|
77
|
+
if not self.connection:
|
|
78
|
+
raise RuntimeError("Connection not initialized")
|
|
79
|
+
|
|
80
|
+
self.logger.info("Checking OS family")
|
|
81
|
+
res = self.connection.run_command("uname -s")
|
|
82
|
+
if "not recognized as an internal or external command" in res.stdout + res.stderr:
|
|
83
|
+
self.system_info.os_family = OSFamily.WINDOWS
|
|
84
|
+
elif res.exit_code == 0:
|
|
85
|
+
self.system_info.os_family = OSFamily.LINUX
|
|
86
|
+
else:
|
|
87
|
+
self._log_event(
|
|
88
|
+
category=EventCategory.UNKNOWN,
|
|
89
|
+
description="Unable to determine SUT OS",
|
|
90
|
+
priority=EventPriority.WARNING,
|
|
91
|
+
)
|
|
92
|
+
self.logger.info("OS Family: %s", self.system_info.os_family.name)
|
|
93
|
+
|
|
94
|
+
def connect(
|
|
95
|
+
self,
|
|
96
|
+
) -> TaskResult:
|
|
97
|
+
"""Connect to the system under test (SUT) using in-band connection
|
|
98
|
+
|
|
99
|
+
Returns:
|
|
100
|
+
TaskResult: The result of the connection attempt
|
|
101
|
+
"""
|
|
102
|
+
if self.system_info.location == SystemLocation.LOCAL:
|
|
103
|
+
self.logger.info("Using local shell")
|
|
104
|
+
self.connection = LocalShell()
|
|
105
|
+
self._check_os_family()
|
|
106
|
+
return self.result
|
|
107
|
+
|
|
108
|
+
if not self.connection_args or not isinstance(self.connection_args, SSHConnectionParams):
|
|
109
|
+
if not self.connection_args:
|
|
110
|
+
message = "No SSH credentials provided"
|
|
111
|
+
else:
|
|
112
|
+
message = "Invalide SSH creddentials provided"
|
|
113
|
+
|
|
114
|
+
self._log_event(
|
|
115
|
+
category=EventCategory.RUNTIME,
|
|
116
|
+
description=message,
|
|
117
|
+
priority=EventPriority.CRITICAL,
|
|
118
|
+
console_log=True,
|
|
119
|
+
)
|
|
120
|
+
self.result.status = ExecutionStatus.EXECUTION_FAILURE
|
|
121
|
+
return self.result
|
|
122
|
+
|
|
123
|
+
try:
|
|
124
|
+
self.logger.info(
|
|
125
|
+
"Initializing SSH connection to system '%s'", self.connection_args.hostname
|
|
126
|
+
)
|
|
127
|
+
self.connection = RemoteShell(self.connection_args)
|
|
128
|
+
self.connection.connect_ssh()
|
|
129
|
+
self._check_os_family()
|
|
130
|
+
except SSHConnectionError as exception:
|
|
131
|
+
self._log_event(
|
|
132
|
+
category=EventCategory.SSH,
|
|
133
|
+
description=f"{str(exception)}",
|
|
134
|
+
priority=EventPriority.CRITICAL,
|
|
135
|
+
console_log=True,
|
|
136
|
+
)
|
|
137
|
+
except Exception as exception:
|
|
138
|
+
self._log_event(
|
|
139
|
+
category=EventCategory.SSH,
|
|
140
|
+
description=f"Exception during SSH: {str(exception)}",
|
|
141
|
+
data=get_exception_traceback(exception),
|
|
142
|
+
priority=EventPriority.CRITICAL,
|
|
143
|
+
console_log=True,
|
|
144
|
+
)
|
|
145
|
+
return self.result
|
|
146
|
+
|
|
147
|
+
def disconnect(self):
|
|
148
|
+
"""Disconnect in-band connection"""
|
|
149
|
+
super().disconnect()
|
|
150
|
+
if isinstance(self.connection, RemoteShell):
|
|
151
|
+
self.connection.client.close()
|
|
@@ -0,0 +1,173 @@
|
|
|
1
|
+
###############################################################################
|
|
2
|
+
#
|
|
3
|
+
# MIT License
|
|
4
|
+
#
|
|
5
|
+
# Copyright (c) 2025 Advanced Micro Devices, Inc.
|
|
6
|
+
#
|
|
7
|
+
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
8
|
+
# of this software and associated documentation files (the "Software"), to deal
|
|
9
|
+
# in the Software without restriction, including without limitation the rights
|
|
10
|
+
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
11
|
+
# copies of the Software, and to permit persons to whom the Software is
|
|
12
|
+
# furnished to do so, subject to the following conditions:
|
|
13
|
+
#
|
|
14
|
+
# The above copyright notice and this permission notice shall be included in all
|
|
15
|
+
# copies or substantial portions of the Software.
|
|
16
|
+
#
|
|
17
|
+
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
18
|
+
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
19
|
+
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
20
|
+
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
21
|
+
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
22
|
+
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
23
|
+
# SOFTWARE.
|
|
24
|
+
#
|
|
25
|
+
###############################################################################
|
|
26
|
+
import os
|
|
27
|
+
import socket
|
|
28
|
+
from typing import Type, Union
|
|
29
|
+
|
|
30
|
+
import paramiko
|
|
31
|
+
from paramiko.ssh_exception import (
|
|
32
|
+
AuthenticationException,
|
|
33
|
+
BadHostKeyException,
|
|
34
|
+
SSHException,
|
|
35
|
+
)
|
|
36
|
+
|
|
37
|
+
from .inband import (
|
|
38
|
+
BaseFileArtifact,
|
|
39
|
+
CommandArtifact,
|
|
40
|
+
InBandConnection,
|
|
41
|
+
)
|
|
42
|
+
from .sshparams import SSHConnectionParams
|
|
43
|
+
|
|
44
|
+
|
|
45
|
+
class SSHConnectionError(Exception):
|
|
46
|
+
"""A general exception for ssh connection failures"""
|
|
47
|
+
|
|
48
|
+
|
|
49
|
+
class RemoteShell(InBandConnection):
|
|
50
|
+
"""Utility class for running shell commands"""
|
|
51
|
+
|
|
52
|
+
host_key_policy: Type[paramiko.MissingHostKeyPolicy] = paramiko.RejectPolicy
|
|
53
|
+
|
|
54
|
+
def __init__(
|
|
55
|
+
self,
|
|
56
|
+
ssh_params: SSHConnectionParams,
|
|
57
|
+
) -> None:
|
|
58
|
+
self.ssh_params = ssh_params
|
|
59
|
+
self.client = paramiko.SSHClient()
|
|
60
|
+
self.client.load_system_host_keys()
|
|
61
|
+
self.client.set_missing_host_key_policy(self.host_key_policy())
|
|
62
|
+
|
|
63
|
+
def connect_ssh(self):
|
|
64
|
+
"""Connect to the remote host via SSH"""
|
|
65
|
+
try:
|
|
66
|
+
self.client.connect(
|
|
67
|
+
hostname=str(self.ssh_params.hostname),
|
|
68
|
+
port=self.ssh_params.port,
|
|
69
|
+
username=self.ssh_params.username,
|
|
70
|
+
password=(
|
|
71
|
+
self.ssh_params.password.get_secret_value()
|
|
72
|
+
if self.ssh_params.password
|
|
73
|
+
else None
|
|
74
|
+
),
|
|
75
|
+
key_filename=self.ssh_params.key_filename,
|
|
76
|
+
pkey=self.ssh_params.pkey,
|
|
77
|
+
timeout=10,
|
|
78
|
+
look_for_keys=True,
|
|
79
|
+
auth_timeout=60,
|
|
80
|
+
banner_timeout=200,
|
|
81
|
+
)
|
|
82
|
+
except socket.timeout:
|
|
83
|
+
raise SSHConnectionError("SSH Request timeout") from socket.timeout
|
|
84
|
+
except socket.gaierror as e:
|
|
85
|
+
raise SSHConnectionError("Hostname could not be resolved") from e
|
|
86
|
+
except AuthenticationException as e:
|
|
87
|
+
raise SSHConnectionError("SSH Authentication failed") from e
|
|
88
|
+
except BadHostKeyException as e:
|
|
89
|
+
raise SSHConnectionError("Unable to verify server's host key") from e
|
|
90
|
+
except ConnectionResetError as e:
|
|
91
|
+
raise SSHConnectionError("Connection reset by peer") from e
|
|
92
|
+
except SSHException as e:
|
|
93
|
+
raise SSHConnectionError(f"Unable to establish SSH connection: {str(e)}") from e
|
|
94
|
+
except EOFError as e:
|
|
95
|
+
raise SSHConnectionError("EOFError during SSH connection") from e
|
|
96
|
+
except Exception as e:
|
|
97
|
+
raise e
|
|
98
|
+
|
|
99
|
+
def read_file(
|
|
100
|
+
self,
|
|
101
|
+
filename: str,
|
|
102
|
+
encoding: Union[str, None] = "utf-8",
|
|
103
|
+
strip: bool = True,
|
|
104
|
+
) -> BaseFileArtifact:
|
|
105
|
+
"""Read a remote file into a BaseFileArtifact.
|
|
106
|
+
|
|
107
|
+
Args:
|
|
108
|
+
filename (str): Path to file on remote host
|
|
109
|
+
encoding Optional[Union[str, None]]: If None, file is read as binary. If str, decode using that encoding. Defaults to "utf-8".
|
|
110
|
+
strip (bool): Strip whitespace for text files. Ignored for binary.
|
|
111
|
+
|
|
112
|
+
Returns:
|
|
113
|
+
BaseFileArtifact: Object representing file contents
|
|
114
|
+
"""
|
|
115
|
+
with self.client.open_sftp().open(filename, "rb") as remote_file:
|
|
116
|
+
raw_contents = remote_file.read()
|
|
117
|
+
return BaseFileArtifact.from_bytes(
|
|
118
|
+
filename=os.path.basename(filename),
|
|
119
|
+
raw_contents=raw_contents,
|
|
120
|
+
encoding=encoding,
|
|
121
|
+
strip=strip,
|
|
122
|
+
)
|
|
123
|
+
|
|
124
|
+
def run_command(
|
|
125
|
+
self,
|
|
126
|
+
command: str,
|
|
127
|
+
sudo=False,
|
|
128
|
+
timeout: int = 30,
|
|
129
|
+
strip: bool = True,
|
|
130
|
+
) -> CommandArtifact:
|
|
131
|
+
"""Run a shell command over ssh
|
|
132
|
+
|
|
133
|
+
Args:
|
|
134
|
+
command (str): command to run
|
|
135
|
+
sudo (bool, optional): run command with sudo (Linux only). Defaults to False.
|
|
136
|
+
timeout (int, optional): timeout for command in seconds. Defaults to 300.
|
|
137
|
+
strip (bool, optional): strip output of command. Defaults to True.
|
|
138
|
+
|
|
139
|
+
Returns:
|
|
140
|
+
CommandArtifact: Command artifact with stdout, stderr, which have been decoded and stripped as well as exit code
|
|
141
|
+
"""
|
|
142
|
+
write_password = sudo and self.ssh_params.username != "root" and self.ssh_params.password
|
|
143
|
+
if write_password:
|
|
144
|
+
command = f"sudo -S -p '' {command}"
|
|
145
|
+
elif sudo:
|
|
146
|
+
command = f"sudo {command}"
|
|
147
|
+
|
|
148
|
+
try:
|
|
149
|
+
stdin, stdout, stderr = self.client.exec_command(command, timeout=timeout)
|
|
150
|
+
|
|
151
|
+
if write_password:
|
|
152
|
+
stdin.write(
|
|
153
|
+
self.ssh_params.password.get_secret_value()
|
|
154
|
+
if self.ssh_params.password
|
|
155
|
+
else "" + "\n"
|
|
156
|
+
)
|
|
157
|
+
stdin.flush()
|
|
158
|
+
stdin.channel.shutdown_write()
|
|
159
|
+
|
|
160
|
+
stdout_str = stdout.read().decode("utf-8")
|
|
161
|
+
stderr_str = stderr.read().decode("utf-8")
|
|
162
|
+
exit_code = stdout.channel.recv_exit_status()
|
|
163
|
+
except TimeoutError:
|
|
164
|
+
stderr_str = "Command timed out"
|
|
165
|
+
stdout_str = ""
|
|
166
|
+
exit_code = 124
|
|
167
|
+
|
|
168
|
+
return CommandArtifact(
|
|
169
|
+
command=command,
|
|
170
|
+
stdout=stdout_str.strip() if strip else stdout_str,
|
|
171
|
+
stderr=stderr_str.strip() if strip else stderr_str,
|
|
172
|
+
exit_code=exit_code,
|
|
173
|
+
)
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
###############################################################################
|
|
2
|
+
#
|
|
3
|
+
# MIT License
|
|
4
|
+
#
|
|
5
|
+
# Copyright (c) 2025 Advanced Micro Devices, Inc.
|
|
6
|
+
#
|
|
7
|
+
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
8
|
+
# of this software and associated documentation files (the "Software"), to deal
|
|
9
|
+
# in the Software without restriction, including without limitation the rights
|
|
10
|
+
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
11
|
+
# copies of the Software, and to permit persons to whom the Software is
|
|
12
|
+
# furnished to do so, subject to the following conditions:
|
|
13
|
+
#
|
|
14
|
+
# The above copyright notice and this permission notice shall be included in all
|
|
15
|
+
# copies or substantial portions of the Software.
|
|
16
|
+
#
|
|
17
|
+
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
18
|
+
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
19
|
+
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
20
|
+
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
21
|
+
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
22
|
+
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
23
|
+
# SOFTWARE.
|
|
24
|
+
#
|
|
25
|
+
###############################################################################
|
|
26
|
+
from typing import Annotated, Optional, Union
|
|
27
|
+
|
|
28
|
+
from paramiko import PKey
|
|
29
|
+
from pydantic import BaseModel, ConfigDict, Field, SecretStr
|
|
30
|
+
from pydantic.networks import IPvAnyAddress
|
|
31
|
+
|
|
32
|
+
|
|
33
|
+
class SSHConnectionParams(BaseModel):
|
|
34
|
+
"""Class which holds info for an SSH connection"""
|
|
35
|
+
|
|
36
|
+
model_config = ConfigDict(arbitrary_types_allowed=True)
|
|
37
|
+
|
|
38
|
+
hostname: Union[IPvAnyAddress, str]
|
|
39
|
+
username: str
|
|
40
|
+
password: Optional[SecretStr] = None
|
|
41
|
+
pkey: Optional[PKey] = None
|
|
42
|
+
key_filename: Optional[str] = None
|
|
43
|
+
port: Annotated[int, Field(strict=True, gt=0, le=65535)] = 22
|
nodescraper/constants.py
ADDED
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
###############################################################################
|
|
2
|
+
#
|
|
3
|
+
# MIT License
|
|
4
|
+
#
|
|
5
|
+
# Copyright (c) 2025 Advanced Micro Devices, Inc.
|
|
6
|
+
#
|
|
7
|
+
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
8
|
+
# of this software and associated documentation files (the "Software"), to deal
|
|
9
|
+
# in the Software without restriction, including without limitation the rights
|
|
10
|
+
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
11
|
+
# copies of the Software, and to permit persons to whom the Software is
|
|
12
|
+
# furnished to do so, subject to the following conditions:
|
|
13
|
+
#
|
|
14
|
+
# The above copyright notice and this permission notice shall be included in all
|
|
15
|
+
# copies or substantial portions of the Software.
|
|
16
|
+
#
|
|
17
|
+
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
18
|
+
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
19
|
+
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
20
|
+
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
21
|
+
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
22
|
+
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
23
|
+
# SOFTWARE.
|
|
24
|
+
#
|
|
25
|
+
###############################################################################
|
|
26
|
+
DEFAULT_LOGGER = "nodescraper"
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
###############################################################################
|
|
2
|
+
#
|
|
3
|
+
# MIT License
|
|
4
|
+
#
|
|
5
|
+
# Copyright (c) 2025 Advanced Micro Devices, Inc.
|
|
6
|
+
#
|
|
7
|
+
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
8
|
+
# of this software and associated documentation files (the "Software"), to deal
|
|
9
|
+
# in the Software without restriction, including without limitation the rights
|
|
10
|
+
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
11
|
+
# copies of the Software, and to permit persons to whom the Software is
|
|
12
|
+
# furnished to do so, subject to the following conditions:
|
|
13
|
+
#
|
|
14
|
+
# The above copyright notice and this permission notice shall be included in all
|
|
15
|
+
# copies or substantial portions of the Software.
|
|
16
|
+
#
|
|
17
|
+
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
18
|
+
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
19
|
+
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
20
|
+
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
21
|
+
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
22
|
+
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
23
|
+
# SOFTWARE.
|
|
24
|
+
#
|
|
25
|
+
###############################################################################
|
|
26
|
+
from .eventcategory import EventCategory
|
|
27
|
+
from .eventpriority import EventPriority
|
|
28
|
+
from .executionstatus import ExecutionStatus
|
|
29
|
+
from .osfamily import OSFamily
|
|
30
|
+
from .systeminteraction import SystemInteractionLevel
|
|
31
|
+
from .systemlocation import SystemLocation
|
|
32
|
+
|
|
33
|
+
__all__ = [
|
|
34
|
+
"ExecutionStatus",
|
|
35
|
+
"OSFamily",
|
|
36
|
+
"SystemInteractionLevel",
|
|
37
|
+
"SystemLocation",
|
|
38
|
+
"EventCategory",
|
|
39
|
+
"EventPriority",
|
|
40
|
+
]
|
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
###############################################################################
|
|
2
|
+
#
|
|
3
|
+
# MIT License
|
|
4
|
+
#
|
|
5
|
+
# Copyright (c) 2025 Advanced Micro Devices, Inc.
|
|
6
|
+
#
|
|
7
|
+
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
8
|
+
# of this software and associated documentation files (the "Software"), to deal
|
|
9
|
+
# in the Software without restriction, including without limitation the rights
|
|
10
|
+
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
11
|
+
# copies of the Software, and to permit persons to whom the Software is
|
|
12
|
+
# furnished to do so, subject to the following conditions:
|
|
13
|
+
#
|
|
14
|
+
# The above copyright notice and this permission notice shall be included in all
|
|
15
|
+
# copies or substantial portions of the Software.
|
|
16
|
+
#
|
|
17
|
+
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
18
|
+
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
19
|
+
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
20
|
+
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
21
|
+
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
22
|
+
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
23
|
+
# SOFTWARE.
|
|
24
|
+
#
|
|
25
|
+
###############################################################################
|
|
26
|
+
from enum import auto, unique
|
|
27
|
+
|
|
28
|
+
from nodescraper.utils import AutoNameStrEnum
|
|
29
|
+
|
|
30
|
+
|
|
31
|
+
@unique
|
|
32
|
+
class EventCategory(AutoNameStrEnum):
|
|
33
|
+
"""Class defining shared event categories
|
|
34
|
+
- SSH
|
|
35
|
+
SSH-related errors, e.g. connection refused, timeout, etc.
|
|
36
|
+
- RAS
|
|
37
|
+
Any RAS events including from memory, IO, compute, platform, etc.
|
|
38
|
+
- IO
|
|
39
|
+
IO-related SoC or platform IO component, e.g. PCIe, XGMI, HUBs, DF, CXL, USB, USR, NICs
|
|
40
|
+
Does not include IO errors which are customer-visible via RAS
|
|
41
|
+
- OS
|
|
42
|
+
Generic Operating System events.
|
|
43
|
+
Does not include specific events from OS which point to another category
|
|
44
|
+
- PLATFORM
|
|
45
|
+
Generic Platform Errors e.g. topo enumeration
|
|
46
|
+
Platform-specific errors which do not fall under other categories (e.g. BMC, SMC, UBB)
|
|
47
|
+
Does not include specific platform events which point to another category
|
|
48
|
+
- APPLICATION
|
|
49
|
+
End user application errors/failures/outputs
|
|
50
|
+
- MEMORY
|
|
51
|
+
Memory-related SoC or platform component, e.g. HBM, UMC, DRAM, SRAM, DDR, etc.
|
|
52
|
+
Does not include anything customer-visible via RAS
|
|
53
|
+
- STORAGE
|
|
54
|
+
SSD/HDD/storage media hardware events, filesystem events
|
|
55
|
+
- COMPUTE
|
|
56
|
+
Events from any of the following AMD IP: GFX, CPU, SDMA, VCN
|
|
57
|
+
- FW
|
|
58
|
+
FW Timeouts, internal FW problems, FW version mismatches
|
|
59
|
+
- SW_DRIVER
|
|
60
|
+
Generic SW errors/failures with amdgpu (e.g. dmesg error on driver load)
|
|
61
|
+
Does not include specific events from driver which point to another category
|
|
62
|
+
- BIOS
|
|
63
|
+
SBIOS/VBIOS/IFWI Errors
|
|
64
|
+
- INFRASTRUCTURE
|
|
65
|
+
Network, IT issues, Downtime
|
|
66
|
+
- NETWORK
|
|
67
|
+
Network configuration, interfaces, routing, neighbors, ethtool data
|
|
68
|
+
- RUNTIME
|
|
69
|
+
Framework issues, does not include content failures
|
|
70
|
+
- UNKNOWN
|
|
71
|
+
This is not a catch-all. It is intended for errors which inherently cannot be categorized due to limitations on how they are collected/analyzed.
|
|
72
|
+
"""
|
|
73
|
+
|
|
74
|
+
SSH = auto()
|
|
75
|
+
RAS = auto()
|
|
76
|
+
IO = auto()
|
|
77
|
+
OS = auto()
|
|
78
|
+
PLATFORM = auto()
|
|
79
|
+
APPLICATION = auto()
|
|
80
|
+
MEMORY = auto()
|
|
81
|
+
STORAGE = auto()
|
|
82
|
+
COMPUTE = auto()
|
|
83
|
+
FW = auto()
|
|
84
|
+
SW_DRIVER = auto()
|
|
85
|
+
BIOS = auto()
|
|
86
|
+
INFRASTRUCTURE = auto()
|
|
87
|
+
NETWORK = auto()
|
|
88
|
+
RUNTIME = auto()
|
|
89
|
+
UNKNOWN = auto()
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
###############################################################################
|
|
2
|
+
#
|
|
3
|
+
# MIT License
|
|
4
|
+
#
|
|
5
|
+
# Copyright (c) 2025 Advanced Micro Devices, Inc.
|
|
6
|
+
#
|
|
7
|
+
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
8
|
+
# of this software and associated documentation files (the "Software"), to deal
|
|
9
|
+
# in the Software without restriction, including without limitation the rights
|
|
10
|
+
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
11
|
+
# copies of the Software, and to permit persons to whom the Software is
|
|
12
|
+
# furnished to do so, subject to the following conditions:
|
|
13
|
+
#
|
|
14
|
+
# The above copyright notice and this permission notice shall be included in all
|
|
15
|
+
# copies or substantial portions of the Software.
|
|
16
|
+
#
|
|
17
|
+
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
18
|
+
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
19
|
+
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
20
|
+
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
21
|
+
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
22
|
+
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
23
|
+
# SOFTWARE.
|
|
24
|
+
#
|
|
25
|
+
###############################################################################
|
|
26
|
+
from enum import IntEnum
|
|
27
|
+
from functools import total_ordering
|
|
28
|
+
|
|
29
|
+
|
|
30
|
+
@total_ordering
|
|
31
|
+
class EventPriority(IntEnum):
|
|
32
|
+
"""Enum defining event priority levels"""
|
|
33
|
+
|
|
34
|
+
INFO = 1
|
|
35
|
+
WARNING = 2
|
|
36
|
+
ERROR = 3
|
|
37
|
+
CRITICAL = 4
|
|
38
|
+
|
|
39
|
+
def __lt__(self, other: "EventPriority") -> bool:
|
|
40
|
+
if self.__class__ is other.__class__:
|
|
41
|
+
return self.value < other.value
|
|
42
|
+
return NotImplemented
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
###############################################################################
|
|
2
|
+
#
|
|
3
|
+
# MIT License
|
|
4
|
+
#
|
|
5
|
+
# Copyright (c) 2025 Advanced Micro Devices, Inc.
|
|
6
|
+
#
|
|
7
|
+
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
8
|
+
# of this software and associated documentation files (the "Software"), to deal
|
|
9
|
+
# in the Software without restriction, including without limitation the rights
|
|
10
|
+
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
11
|
+
# copies of the Software, and to permit persons to whom the Software is
|
|
12
|
+
# furnished to do so, subject to the following conditions:
|
|
13
|
+
#
|
|
14
|
+
# The above copyright notice and this permission notice shall be included in all
|
|
15
|
+
# copies or substantial portions of the Software.
|
|
16
|
+
#
|
|
17
|
+
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
18
|
+
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
19
|
+
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
20
|
+
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
21
|
+
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
22
|
+
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
23
|
+
# SOFTWARE.
|
|
24
|
+
#
|
|
25
|
+
###############################################################################
|
|
26
|
+
import enum
|
|
27
|
+
from functools import total_ordering
|
|
28
|
+
|
|
29
|
+
|
|
30
|
+
@total_ordering
|
|
31
|
+
class ExecutionStatus(enum.Enum):
|
|
32
|
+
"""Status of module execution"""
|
|
33
|
+
|
|
34
|
+
UNSET = 0
|
|
35
|
+
NOT_RAN = 10
|
|
36
|
+
OK = 20
|
|
37
|
+
WARNING = 30
|
|
38
|
+
ERROR = 40
|
|
39
|
+
EXECUTION_FAILURE = 50
|
|
40
|
+
|
|
41
|
+
def __lt__(self, other: "ExecutionStatus") -> bool:
|
|
42
|
+
if self.__class__ is other.__class__:
|
|
43
|
+
return self.value < other.value
|
|
44
|
+
return NotImplemented
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
###############################################################################
|
|
2
|
+
#
|
|
3
|
+
# MIT License
|
|
4
|
+
#
|
|
5
|
+
# Copyright (c) 2025 Advanced Micro Devices, Inc.
|
|
6
|
+
#
|
|
7
|
+
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
8
|
+
# of this software and associated documentation files (the "Software"), to deal
|
|
9
|
+
# in the Software without restriction, including without limitation the rights
|
|
10
|
+
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
11
|
+
# copies of the Software, and to permit persons to whom the Software is
|
|
12
|
+
# furnished to do so, subject to the following conditions:
|
|
13
|
+
#
|
|
14
|
+
# The above copyright notice and this permission notice shall be included in all
|
|
15
|
+
# copies or substantial portions of the Software.
|
|
16
|
+
#
|
|
17
|
+
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
18
|
+
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
19
|
+
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
20
|
+
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
21
|
+
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
22
|
+
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
23
|
+
# SOFTWARE.
|
|
24
|
+
#
|
|
25
|
+
###############################################################################
|
|
26
|
+
import enum
|
|
27
|
+
|
|
28
|
+
|
|
29
|
+
class OSFamily(enum.Enum):
|
|
30
|
+
"""Enum describing operating system of the SUT"""
|
|
31
|
+
|
|
32
|
+
WINDOWS = enum.auto()
|
|
33
|
+
UNKNOWN = enum.auto()
|
|
34
|
+
LINUX = enum.auto()
|