Post by wrightdw on Sept 14, 2021 21:38:59 GMT
I'm constructing an interop profile, and would like to ensure that if a Chassis resource has a ContainedBy property in the links, then Location.PartLocation.ServiceLabel is also populated. Is this achievable using the ConditionalRequirements CompareProperty behavior?
As an example, I'd like to apply a ServiceLabel requirement to a Chassis like this:
but would not like a ServiceLabel on a chassis like this:
A relevant part of the interop profile would look something like:
It would appear that the above does not work due way the CompareProperty behaves, namely "The property name will be evaluated at the current object level within the resource. If the property name is not found at the current level, upper levels will be searched until the root level is reached." In the above example this fails to find the ContainedBy property because it only exists as a sub-property of a property within the search path. So in this case it seems as though one can specify some Location property dependence on the Links property, but one cannot get these to depend on Links.ContainedBy except via an exact value comparison against the full contents of the Links property.
Does this sound right? Is there some existing way to specify a CompareProperty path that would allow Location.PartLocation.ServiceLabel ReadRequrement to be conditional on Links.ContainedBy being populated? If not, would it be possible to allow specification of sub-properties within the CompareProperty field in the above, such that substituting Links.ContainedBy or some other delimited path in the above example as the CompareProperty would achieve the desired goal?
As an example, I'd like to apply a ServiceLabel requirement to a Chassis like this:
{
"@odata.id": "/redfish/v1/Chassis/Child",
"@odata.type": "#Chassis.v1_14_0.Chassis",
"ChassisType": "Module",
"Links": {
"ContainedBy":
{
"@odata.id": "/redfish/v1/Chassis/Parent"
}
},
...
"Location": {
"PartLocation": {
"LocationType": "Slot",
"ServiceLabel": "ExampleServiceLabel"
}
}
}
but would not like a ServiceLabel on a chassis like this:
{
"@odata.id": "/redfish/v1/Chassis/Parent",
"@odata.type": "#Chassis.v1_14_0.Chassis",
"ChassisType": "RackMount",
"Links": {
"Contains": [
{
"@odata.id": "/redfish/v1/Chassis/Child"
}
]
},
...
}
A relevant part of the interop profile would look something like:
"Chassis": {
"MinVersion": "1.5.2",
"Purpose": "A chassis should contain location information where applicable.",
"PropertyRequirements": {
"Location": {
"ReadRequirement": "Conditional",
"ConditionalRequirements": [
{
"Purpose": "If Chassis has a non-empty Links.ContainedBy property, Location is required.",
"CompareProperty": "ContainedBy",
"CompareType": "Present",
"ReadRequirement": "Mandatory"
}
]
}
}
}
It would appear that the above does not work due way the CompareProperty behaves, namely "The property name will be evaluated at the current object level within the resource. If the property name is not found at the current level, upper levels will be searched until the root level is reached." In the above example this fails to find the ContainedBy property because it only exists as a sub-property of a property within the search path. So in this case it seems as though one can specify some Location property dependence on the Links property, but one cannot get these to depend on Links.ContainedBy except via an exact value comparison against the full contents of the Links property.
Does this sound right? Is there some existing way to specify a CompareProperty path that would allow Location.PartLocation.ServiceLabel ReadRequrement to be conditional on Links.ContainedBy being populated? If not, would it be possible to allow specification of sub-properties within the CompareProperty field in the above, such that substituting Links.ContainedBy or some other delimited path in the above example as the CompareProperty would achieve the desired goal?