Files
christianmanivong 0052ba7884 feat: Intel AMT driver over WS-Management (0.1.0)
An `amt` driver (napalm_amt.AmtDriver), a ManagementControllerDriver for the
management controller of Intel vPro machines, with its own lean WS-Management
client (requests + ElementTree, HTTP Digest, ports 16992/16993).

It reads the machine's identity, hardware with the SMBIOS system UUID, firmware
(AMT with build, BIOS), power state and the hardware event log, reports what AMT
listens on (plain HTTP or TLS, KVM incl. port 5900, IDE-R), and switches the
machine's power. AMT cannot be reset over WS-Management, so there is no
reboot_host. Discovery recognises AMT by its ports and its Server header.

Tested against Intel's published AMT 12 recordings (go-wsman-messages,
Apache-2.0, see NOTICE). `python -m napalm_amt.record` records a real AMT
read-only; the first test devices are two Lenovo ThinkCentre M910x.
2026-10-18 14:55:32 +02:00

36 lines
1.5 KiB
Markdown

# Testing
## Without hardware
`tests/conftest.py` serves recorded WS-Management answers over mocked HTTP
(`responses`): `Get` → `<Class>.get.xml`, `Pull` → `<Class>.pull.xml`, a method →
`<Class>.<Method>.xml`. A class without a file answers with the fault for an unknown
resource URI, as AMT does. A test changes one answer with `AmtServer.override` and a
recorded file with `patched(name, old, new)`, which fails when `old` is not in it.
| Fixtures | Source |
|---|---|
| `tests/fixtures/dmt-wsman-messages/` | Intel's go-wsman-messages (Apache-2.0), `pkg/wsman/wsmantesting/responses` at commit 00402b9: AMT 12.0.67 on an Intel NUC9, a few values replaced by placeholders. `fault_destination_unreachable.xml` is written by hand after DSP0226 |
There is no AMT simulator worth the name. Intel's Device Management Toolkit talks to
real AMT or to its own recordings, the ones used here.
## Recording a real AMT
`python -m napalm_amt.record HOST --password-file FILE --out DIR` makes every read the
driver makes and writes each raw answer under the name the mock serves it by, plus
`COMMANDS.txt` and `landing_page.txt` (the unauthenticated page with its headers, which
is what discovery sees). It never switches power and never writes to AMT. Pages after the
first become `<Class>.pull.2.xml`. A class AMT does not know is kept as
`<Class>.enumerate.xml` with its fault.
Name the directory `<vendor>-<model>-<amt version>`, for example
`lenovo-m910x-11.8.50.3399`.
## Running
```bash
.venv/bin/python -m pytest
.venv/bin/ruff check . && .venv/bin/mypy napalm_amt
```