-
Notifications
You must be signed in to change notification settings - Fork 263
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
::1/128
is not a valid prefix
#969
Comments
I dug into this and I don't know the solution, but what I can tell is that this is due to the It will store the value in the DB for the IPv6 address as I get it to work for prefixes by adding the following to the @property
def cidr_str(self):
if self.prefix_length is not None and self.prefix_length > 32 and "." in self.network:
ip_address = netaddr.IPAddress(self.network)
return "%s/%s" % (ip_address.ipv6(True), self.prefix_length)
if self.network is not None and self.prefix_length is not None:
return "%s/%s" % (self.network, self.prefix_length) This resolves the whole loading bug that we were getting, but the utilization is now 100% which is different than the It also still renders >>> from nautobot.ipam.models import Prefix
>>> p = Prefix.objects.first()
>>> p
<Prefix: ::1/128>
>>> p.prefix.size
1
>>> p.get_child_ips()
<IPAddressQuerySet [<IPAddress: 0.0.0.1/32>]>
>>> Prefix.STATUS_CONTAINER
<Status: Container>
>>> p.vrf
>>> from nautobot.ipam.models import IPAddress
>>> p.prefix
IPNetwork('::1/128')
>>> IPAddress.objects.net_host_contained(p.prefix).filter(vrf=None)
<IPAddressQuerySet [<IPAddress: 0.0.0.1/32>]>
>>> p.prefix.broadcast
IPAddress('::1')
>>> p.network
'0.0.0.1'
>>> p.prefix.network Hopefully this helps a little bit, but I don't know the best way to handle this in the long run. It would be great if we could determine within the |
Thanks for the report and the investigation! I'm looking into this as well. |
…rectly when loading from DB (#975)
Environment
When trying to create the prefix
::1/128
I get the following error:Both Python netaddr and ipaddress modules see this as a valid IPNetwork.
Steps to Reproduce
::1/128
Expected Behavior
Prefix created
Observed Behavior
The text was updated successfully, but these errors were encountered: