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.
64 lines
2.0 KiB
Python
64 lines
2.0 KiB
Python
"""AMT's own network ports (AMT_EthernetPortSettings), from the recorded NUC9."""
|
|
|
|
from napalm_amt.parsers import parse_ethernet_ports
|
|
|
|
from ..conftest import instances
|
|
|
|
|
|
def test_the_wired_port_is_kept_and_the_unused_wireless_one_dropped():
|
|
# The NUC9 lists a wireless port without a MAC address: there is no WLAN card.
|
|
ports = parse_ethernet_ports(instances("AMT_EthernetPortSettings.pull.xml"))
|
|
assert ports == [
|
|
{
|
|
"name": "wired",
|
|
"mac_address": "00:be:43:d8:22:a4",
|
|
"link_up": True,
|
|
"dhcp": True,
|
|
"shared_ip": True,
|
|
"ip": "",
|
|
"prefix_length": None,
|
|
}
|
|
]
|
|
|
|
|
|
def test_a_static_address_with_its_mask():
|
|
(port,) = parse_ethernet_ports(
|
|
[
|
|
{
|
|
"InstanceID": "Intel(r) AMT Ethernet Port Settings 0",
|
|
"MACAddress": "6C-4B-90-12-34-56",
|
|
"LinkIsUp": "true",
|
|
"DHCPEnabled": "false",
|
|
"SharedStaticIp": "false",
|
|
"IPAddress": "172.22.8.61",
|
|
"SubnetMask": "255.255.255.0",
|
|
"PhysicalConnectionType": "0",
|
|
}
|
|
]
|
|
)
|
|
assert port["mac_address"] == "6c:4b:90:12:34:56"
|
|
assert (port["ip"], port["prefix_length"]) == ("172.22.8.61", 24)
|
|
assert port["dhcp"] is False
|
|
assert port["shared_ip"] is False
|
|
|
|
|
|
def test_a_wireless_port_with_a_card_is_named_wireless():
|
|
ports = parse_ethernet_ports(
|
|
[
|
|
{
|
|
"InstanceID": "Intel(r) AMT Ethernet Port Settings 1",
|
|
"MACAddress": "a0-88-69-01-02-03",
|
|
"PhysicalConnectionType": "3",
|
|
"LinkIsUp": "false",
|
|
},
|
|
]
|
|
)
|
|
assert [(p["name"], p["link_up"]) for p in ports] == [("wireless", False)]
|
|
|
|
|
|
def test_an_invalid_mask_gives_no_prefix():
|
|
(port,) = parse_ethernet_ports(
|
|
[{"MACAddress": "00-be-43-d8-22-a4", "IPAddress": "10.0.0.5", "SubnetMask": "255.0.255.0"}]
|
|
)
|
|
assert port["prefix_length"] is None
|