"""ServiceRoot: ``GET /redfish/v1/`` (readable without credentials).""" from __future__ import annotations from collections.abc import Mapping from typing import Any from .common import link, links, text def parse_service_root(root: Mapping[str, Any]) -> dict[str, Any]: """Version, identity and top-level links of a Redfish service. ``vendor`` and ``product`` exist from ServiceRoot 1.5 on; ``oem_vendors`` (the keys under ``Oem``) is what older services offer for picking a quirk module. """ found = links(root) sessions = link(root, "Links", "Sessions") if sessions is not None: found["Sessions"] = sessions oem = root.get("Oem") return { "name": text(root.get("Name")), "redfish_version": text(root.get("RedfishVersion")), "uuid": text(root.get("UUID")), "vendor": text(root.get("Vendor")), "product": text(root.get("Product")), "oem_vendors": sorted(oem) if isinstance(oem, Mapping) else [], "links": found, }