-
Notifications
You must be signed in to change notification settings - Fork 23
Description
Hi, I’ve noticed some issues with how anyof and allof compareTypes are evaluated in conditional requirements.
The current implementation evaluates these conditions for each resource instance (separately) using checkComparison and not at service level (collectively after making a pass on all resources).
The approach used in checkComparison leads to false negatives, because:
- Instances which do not contribute in making the anyof/allof pass are excluded.
- In my understanding, the anyof/allof condition should be evaluated across all instances collectively (i.e., at the service level).
Consider the following profile:
"Resources": {
"Sensor": {
"PropertyRequirements": {
"ReadingUnits": {
"ConditionalRequirements": [
{
"CompareProperty": "PhysicalContext",
"CompareType": "AnyOf",
"CompareValues": [
"CPU",
"GPU"
],
"ReadRequirement": "Mandatory",
"Comparison": "Equal",
"Values": [
"Cel",
"Percent"
]
}
]
}
}
}
}
Expected behavior:
- AnyOf should be evaluated collectively across all instances, and the condition is met if there is at least one instance that has its property PhysicalContext equal to CPU or GPU.
Current behavior:
-
Only sensor instances which contribute to make pass the AnyOf test return True from checkComparison, meanwhile all other instances (which do not contribute to make the anyof test pass) return False.
-
Hence globally not all instances will pass the AnyOf test in the case where the test is expected to pass at service level.
The Output Log below shows that the CPU1Temp sensor has passed the condition stated in the conditional requirement above, as the underlying property requirements are evaluated againts it. for DIMM1Temp there is no evaluation against the property requirements (as its PhysicalContext is equal to Memory and this does not appear in the CompareValues array), this shows that AnyOf is not evalauted across all instances.
- As a result of this, we see the same output in the InteropHTML page for AnyOf as when compareType is set to Equal (see the Log below for CompareType set to Equal).
In the case of AllOf compareType:
- Some instances are likely to pass the checkComparison test if there is a single value in the CompareValues array of the profile, as this is very similar to "AnyOf" or "Equal".
- Meanwhile, if there is more than one value in the CompareValues array, all sensor instances may fail the test in checkComparison, as no instance will individually contribute to make pass the AllOf test.
I have started implementing some changes to fix this issue. I can make a pull request if necessary.

