stmcginnis / gofish

Gofish is a Golang client library for DMTF Redfish and SNIA Swordfish interaction.
BSD 3-Clause "New" or "Revised" License
211 stars 112 forks source link

Reboot example does not work #260

Closed lzap closed 1 year ago

lzap commented 1 year ago

Hey,

trying out the reboot example but it does not work, it panics with panic: unable to execute request, no target provided. I am using the official emulator, but it looks like the client cannot even connect for some reason. Function CreateSession passes serviceroot.sessions string which is empty and tat causes the Post to panic.

What am I missing?

lzap commented 1 year ago

Hmmm it looks like the Redfish API does implement some session handling and the emulator apparently does not return this.

$ curl http://localhost:5000/redfish/v1/
{
    "@odata.context": "/redfish/v1/$metadata#ServiceRoot",
    "@odata.type": "#ServiceRoot.1.0.0.ServiceRoot",
    "@odata.id": "/redfish/v1/",
    "Id": "RootService",
    "Name": "Root Service",
    "RedfishVersion": "1.0.0",
    "UUID": "e280c305-0620-4499-b003-63850f6515f1",
    "Chassis": {
        "@odata.id": "/redfish/v1/Chassis"
    },
    "Managers": {
        "@odata.id": "/redfish/v1/Managers"
    },
    "TaskService": {
        "@odata.id": "/redfish/v1/TaskService"
    },
    "SessionService": {
        "@odata.id": "/redfish/v1/SessionService"
    },
    "AccountService": {
        "@odata.id": "/redfish/v1/AccountService"
    },
    "EventService": {
        "@odata.id": "/redfish/v1/EventService"
    },
    "Registries": {
        "@odata.id": "/redfish/v1/Registries"
    },
    "Systems": {
        "@odata.id": "/redfish/v1/Systems"
    },
    "CompositionService": {
        "@odata.id": "/redfish/v1/CompositionService"
    }
}
lzap commented 1 year ago

Interesting, when I try https://github.com/DMTF/Redfish-Mockup-Server it freezes.

lzap commented 1 year ago

Okay now I understand, when username/password is provided, a session needs to be estabilished. After I removed it, it works with emulators. Sorry for the noise.