DMTF/Redfish-Mockup-Creator

redfishMockupCreate.py fails on logout

dan-m-joh opened this issue · 12 comments

Hello,

I have installed Redfish-Mockup-Creator und it runs OK until it is finished (I think).
Then it fails with tho following:

Getting /redfish/v1/JSONSchemas...
Traceback (most recent call last):
  File "redfishMockupCreate.py", line 280, in <module>
    sys.exit( main() )
  File "redfishMockupCreate.py", line 106, in main
    redfish_obj.logout()
  File "/usr/local/lib/python3.6/site-packages/redfish/rest/v1.py", line 990, in logout
    "return code: %d" % (session_loc, resp.status))
redfish.rest.v1.BadRequestError: Invalid session resource: /redfish/v1/SessionService/Sessions/83452fcb497cc913, return code: 400

Is the output complete even after this error?

Regards,
Dan

Are you by any chance using a Cisco system? There is a known issue in the Redfish Python library tracked here: DMTF/python-redfish-library#111

The mockup creator uses that library, so ultimately it relies on the library to perform the logout.

No, this is a Huawei XH620 V3 Blade.

By any chance did the tool capture the SessionCollection found at "/redfish/v1/SessionService/Sessions"? I'd like to compare the contents of that with the session URI the library was attempting to use to log out.

Sadly, No.
In that directory is only one file index.json and it contains the following:

{
    "error": {
        "code": "Base.1.0.GeneralError",
        "Message": "A general error has occurred. See ExtendedInfo for more information.",
        "@Message.ExtendedInfo": [
            {
                "@odata.type": "#MessageRegistry.1.0.0.MessageRegistry",
                "MessageId": "iBMC.0.1.0.InputError",
                "RelatedProperties": [],
                "Message": "Request failed.",
                "MessageArgs": [],
                "Severity": "Warning",
                "Resolution": "Incorrect URI or method."
            }
        ]
    }
}

How about the index.json file for the service root (/redfish/v1)?

I'm starting to wonder if there are conformance issues with this service. If you're willing, I'd like you to collect some debug information for me. I can prepare some scripts for you to run. Unfortunately I don't have access to this type of system to try it myself.

Here is the index.json from "the root" (UUID and HostName redacted):

{
    "@odata.context": "/redfish/v1/$metadata#ServiceRoot",
    "@odata.id": "/redfish/v1/",
    "@odata.type": "#ServiceRoot.v1_0_2.ServiceRoot",
    "Id": "RootService",
    "Name": "Root Service",
    "RedfishVersion": "1.0.2",
    "UUID": "XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXXX",
    "Systems": {
        "@odata.id": "/redfish/v1/Systems"
    },
    "Chassis": {
        "@odata.id": "/redfish/v1/Chassis"
    },
    "Managers": {
        "@odata.id": "/redfish/v1/Managers"
    },
    "Tasks": {
        "@odata.id": "/redfish/v1/TaskService"
    },
    "SessionService": {
        "@odata.id": "/redfish/v1/SessionService"
    },
    "AccountService": {
        "@odata.id": "/redfish/v1/AccountService"
    },
    "EventService": {
        "@odata.id": "/redfish/v1/EventService"
    },
    "UpdateService": {
        "@odata.id": "/redfish/v1/UpdateService"
    },
    "Registries": {
        "@odata.id": "/redfish/v1/Registries"
    },
    "JsonSchemas": {
        "@odata.id": "/redfish/v1/JSONSchemas"
    },
    "Oem": {
        "Huawei": {
            "SmsUpdateService": null,
            "SecurityBanner": "WARNING! This system is PRIVATE and PROPRIETARY and may only be accessed by authorized users. Unauthorized use of the system is prohibited. The owner, or its agents, may monitor any activity or communication on the system. The owner, or its agents, may retrieve any information stored within the system. By accessing and using the system, you are consenting to such monitoring and information retrieval for law enforcement and other purposes.",
            "ProductName": "XH620 V3",
            "HostName": "xxxxxxxxx",
            "LanguageSet": "en,zh,ja,fr",
            "Copyright": "Huawei Technologies Co., Ltd. 2004-2018. All rights reserved.",
            "DomainName": null,
            "AccountLockoutDuration": 300
        }
    }
}

OK, just send me the scripts so I can review them before running them.

Here's the script I have to collect some info. You will need to replace BMC_IP, USERNAME, and PASSWORD with your system's information. It will output to a file to "trace.log"; there will be at least one place where it shows the username and password when establishing the session, so you will want to redact that when sending me the file (and possible portions of the response body like you did above).

import sys
import redfish
import logging
from redfish import redfish_logger

login_host = "https://BMC_IP"
login_account = "USERNAME"
login_password = "PASSWORD"
LOGGERFILE = "trace.log"
LOGGERFORMAT = "%(asctime)s - %(name)s - %(levelname)s - %(message)s"
LOGGER = redfish_logger(LOGGERFILE, LOGGERFORMAT, logging.DEBUG)

## Create a REDFISH object
REDFISH_OBJ = redfish.redfish_client(base_url=login_host, username=login_account,
                          password=login_password, default_prefix='/redfish/v1')

# Login
REDFISH_OBJ.login(auth="session")

# Get and print service root and the session service
response = REDFISH_OBJ.get("/redfish/v1/")
print(response)
response = REDFISH_OBJ.get("/redfish/v1/SessionService")
print(response)

# Logout
REDFISH_OBJ.logout()

Here comes the (redacted) trace.log

trace.log.gz

Hello Mike,

Before you invest to much time in this!
I have just found out that we probable have an issue with this blade (looking at iBMC some fields (that should be filled) are empty, like Memory and some CPU info).
We will try to get an timeslot to reseat this blade sometime next week.

Sorry for the trouble!

Dan

Thanks! Unfortunately with the debug log, the logout was successful; the DELETE operation on the session resource returned a 200.

@dan-m-joh by the time you get a chance to use the system again, this tool should have a new option merged into the main build that enables the type of trace logging I had you do in the above script. Hopefully you can reproduce the issue with the new option enabled so we can capture what's going on.

Closing; no updates to further debug this. If new details are available and there is still an issue, please reopen and use the debug option to provide further details.