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
Hi, I filed this as #1680 previously. Problem appears to be related to the RESTAPI, not to pynetbox.
Seems that I can't re-open the previous ticket.
I'm bumping this again, I do not believe that the problem is related to pynetbox but with the Netbox RESTAPI. Upon upgrade 2.2.4 => 2.2.6, my manual backport of #1620 was overwritten.
This looks fine with nbshell
# python3 manage.py nbshell ### NetBox interactive shell (netbox) ### Python 3.4.5 | Django 1.11.8 | NetBox 2.2.6 ### lsmodels() will show available models. Use help(<model>) for more info. >>>IPAddress.objects.filter(address="2a12:2b48:0:1001::1/127")
<QuerySet [<IPAddress: 2a12:2b48:0:1001::1/127>]>
The text was updated successfully, but these errors were encountered:
jeremystretch
changed the title
RESTAPI does not work with IPAM.IPv6Address on Netbox > 2.2.3
Filtering breaks for IPv6 addresses with alphabetic characters
Dec 5, 2017
Well, this is an interesting one. It seems that istartswith is ironically causing issues with capitalization. This is because values are filtered in SQL not with ILIKE value but rather LIKE UPPER(value). Here's an example.
First, create an IPv6 address with a letter in it:
This because istartswith forces UPPER(value) in the SQL query but not on the column (due to our custom process_lhs() method on NetFieldDecoratorMixin).
We should be able to fix this by forcing all query values to lowercase. I just need to figure out how best to accomplish that.
Issue type
[ ] Feature request
[X ] Bug report
[ ] Documentation
Environment
Description
Hi, I filed this as #1680 previously. Problem appears to be related to the RESTAPI, not to pynetbox.
Seems that I can't re-open the previous ticket.
I'm bumping this again, I do not believe that the problem is related to pynetbox but with the Netbox RESTAPI. Upon upgrade 2.2.4 => 2.2.6, my manual backport of #1620 was overwritten.
This looks fine with nbshell
Same query with the API returns nothing:
curl -H "Authorization: Token $TOKEN" -H "Accept: application/json; indent=4" "http://netbox/netbox/api/ipam/ip-addresses/?q=2a12:2b48:0:1001::1/127"
{
"count": 0,
}
Looking up the prefix works fine with the API:
curl -H "Authorization: Token $TOKEN " -H "Accept: application/json; indent=4" "http://netbox/netbox/api/ipam/prefixes/?q=2a12:2b48:0:1001::1/127"
{
"count": 2,
}
By looking at the commit from #1620, this looks reasonable, istartswith seems not to work particularly well with IPv6
Trying to lookup with address__net_contains_or_equals which is used for prefix works fine:
The text was updated successfully, but these errors were encountered: