SNIA/Swordfish-API-Emulator

Incorrect @odata.type value for GET of newly created volume instance

Closed this issue · 1 comments

No, that isn't correct. It should be schema.version.schema.

Richelle

Richelle Ahlvers. richelle.ahlvers@intel.com

Sent from my phone. Pardon typos.


From: Jerry Duggan <jerry.duggan@savinnovations.com>
Sent: Sunday, March 5, 2023 11:08:06 AM
To: Ahlvers, Richelle <richelle.ahlvers@intel.com>
Cc: Mancuso, Tom <tom.mancuso@snia.org>
Subject: Wonky @odata.type return from get of created volume instance?

Richelle:

I am working on the swordfish create tests, where I validate the returned instance. Take a look at this, in particular the @odata.type field:
{
"@odata.id": "/redfish/v1/Storage/IPAttachedDrive1/Volumes/5DXKZ",
"@odata.type": "#Volume.v5DXKZ_8_IPAttachedDrive1.Volume",
"Id": "5DXKZ",
"Name": "Volume"
}

It looks like the type field ("#Volume.v5DXKZ_8_IPAttachedDrive1.Volume) has the instance identifier (5DXKZ) embedded in it. This doesn’t seem correct to me, as I would very much like to use the type field as a key into the metadata to find what I need for validation.

Is the returned odata.type field correct? I am using the emulator.

jpd

I figured out the cause of this. In the api_emulator/redfish/templates/Volume8.py file, there is a lot of replacement of strings to variables. Two of these are replacements of '0' for {StorageID}, and '1' for {VolumeID}. This causes problems with version strings, which have 0's and 1's in them.

The solution is to do the replacement cycle using something other than '0' and '1'. The attached example shows how to do this with '-0-' and '-1-'.
Volume8.py.txt