Add parsers for the Redfish resources in redfish-map.md
Pure functions for ServiceRoot, ComputerSystem (facts, power state, reset action and ActionInfo), Processors, Memory, Storage/Drives/SimpleStorage, Chassis Thermal and Power as well as ThermalSubsystem/PowerSubsystem/Sensors (with environment_sources to pick whichever exists), Manager, EthernetInterfaces, ManagerNetworkProtocol, accounts, firmware inventory and log services/entries.
This commit is contained in:
18 files changed
+1926
No files matched your search
@@ -0,0 +1,46 @@
|
||||
from napalm_redfish.parsers import parse_service_root
|
||||
|
||||
|
||||
def test_service_root(rackmount):
|
||||
root = parse_service_root(rackmount("/redfish/v1/"))
|
||||
assert root["redfish_version"] == "1.15.0"
|
||||
assert root["uuid"] == "92384634-2938-2342-8820-489239905423"
|
||||
assert root["name"] == "Root Service"
|
||||
# Vendor and Product only exist from ServiceRoot 1.5 on, and this mockup has neither.
|
||||
assert root["vendor"] is None
|
||||
assert root["product"] is None
|
||||
assert root["oem_vendors"] == []
|
||||
|
||||
|
||||
def test_service_root_links(rackmount):
|
||||
links = parse_service_root(rackmount("/redfish/v1/"))["links"]
|
||||
assert links["Systems"] == "/redfish/v1/Systems"
|
||||
assert links["Chassis"] == "/redfish/v1/Chassis"
|
||||
assert links["Managers"] == "/redfish/v1/Managers"
|
||||
assert links["AccountService"] == "/redfish/v1/AccountService"
|
||||
assert links["UpdateService"] == "/redfish/v1/UpdateService"
|
||||
assert links["SessionService"] == "/redfish/v1/SessionService"
|
||||
# Links.Sessions is where the session login goes.
|
||||
assert links["Sessions"] == "/redfish/v1/SessionService/Sessions"
|
||||
assert "@odata.id" not in links
|
||||
|
||||
|
||||
def test_service_root_vendor_and_oem():
|
||||
root = parse_service_root({
|
||||
"RedfishVersion": "1.0.1",
|
||||
"Vendor": "Supermicro",
|
||||
"Product": "X10DRL-i",
|
||||
"Oem": {"Supermicro": {"@odata.type": "#SmcServiceRoot"}},
|
||||
"Systems": {"@odata.id": "/redfish/v1/Systems"},
|
||||
})
|
||||
assert root["vendor"] == "Supermicro"
|
||||
assert root["product"] == "X10DRL-i"
|
||||
assert root["oem_vendors"] == ["Supermicro"]
|
||||
assert root["uuid"] is None
|
||||
assert root["links"] == {"Systems": "/redfish/v1/Systems"}
|
||||
|
||||
|
||||
def test_service_root_empty():
|
||||
root = parse_service_root({})
|
||||
assert root["redfish_version"] is None
|
||||
assert root["links"] == {}
|
||||
Reference in new issue
Block a user