You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I would expect the API to return the same result as the web UI for that route.
Possible Solution
The problem seems to be that the query expects the device ID to be provided as the "query_location" instead of the device name:
@validator("query_location")
def validate_query_location(cls, value):
"""Ensure query_location is defined."""
if value not in devices._ids:
raise InputInvalid(
params.messages.invalid_field,
level="warning",
input=value,
field=params.web.text.query_location,
)
return value
When changing the "query_location" from the device name to the device ID (in this case stripping the "."), the query works as expected:
This is rather unintuitive however because /api/devices only returns the device names.
Looking at the UI which also uses the device names, you would expect the API to work the same way. I couldn't find any mention that the device ID had to be used in the API query.
In any case, it would be helpful if the device ID was exposed by /api/devices as well as the name so as to not having to do the translation on user side.
Alternatively the location validator could validate against the device name but that might be undesired.
Bug Description
The following device is configured in hyperglass and returned by the API:
Attempting to query the device about a BGP route via the API results in an "invalid location" error:
Expected behavior
I would expect the API to return the same result as the web UI for that route.
Possible Solution
The problem seems to be that the query expects the device ID to be provided as the "query_location" instead of the device name:
When changing the "query_location" from the device name to the device ID (in this case stripping the "."), the query works as expected:
This is rather unintuitive however because
/api/devices
only returns the device names.Looking at the UI which also uses the device names, you would expect the API to work the same way. I couldn't find any mention that the device ID had to be used in the API query.
In any case, it would be helpful if the device ID was exposed by
/api/devices
as well as the name so as to not having to do the translation on user side.Alternatively the location validator could validate against the device name but that might be undesired.
Environment
Server
None
3.6.8
Linux-3.10.0-1160.25.1.el7.x86_64-x86_64-with-centos-7.9.2009-Core
4
4
The text was updated successfully, but these errors were encountered: