OpenManage-Enterprise
OpenManage-Enterprise copied to clipboard
NetworkAddress device filter not working
See page 197 of the API doc. It says NetworkAddress
should be a valid field, but when you try try to hit it with something like:
$DeviceId = Get-Data "https://$($OmeIpAddress)/api/DeviceService/Devices" "NetworkAddress eq
'$($IdracIp)'"
it will fail. This works as expected:
"https://$($OmeIpAddress)/api/DeviceService/Devices" "DeviceServiceTag eq
'$($ServiceTag)'"
I suspect this is because NetworkAddress
is actually a nested value in the return structure which as far as I know odata does not support filtering.
Things like ChassisServiceTag, ServiceTag, ID, etc are not nested and those all work fine.
Nested properties can also be queried - for the specific issue here, this is how you resolve the query - this is not an issue
https://
More details - http://docs.oasis-open.org/odata/odata/v4.0/errata03/os/complete/part2-url-conventions/odata-v4.0-errata03-os-part2-url-conventions-complete.html
Nested properties can also be queried - for the specific issue here, this is how you resolve the query - this is not an issue
https:///api/DeviceService/Devices?$filter=DeviceManagement/any(d:contains(d/NetworkAddress,''))
More details - http://docs.oasis-open.org/odata/odata/v4.0/errata03/os/complete/part2-url-conventions/odata-v4.0-errata03-os-part2-url-conventions-complete.html
😂 wamp wamp. Man, I spent a while reading about that and couldn't figure out the syntax and saw some people posting saying that it wouldn't work. I'll refactor some code and include that. Thanks!
@RaajeevKalyan I'm still wrapping my head around it. For example "DeviceManagement/any(d:d/NetworkAddress eq '%s')" % device_idrac_ip
where device_idrac_ip is 192.168.1.4 matches entries with idrac IP 192.168.1.45. Do you happen to know if I'm doing something silly?
I'm not good enough at odata to know if that's a bug or I'm messing up the syntax, but with eq
it seems like that shouldn't happen.