IPAM - Available prefixes might list an existing prefix #4107

Closed
opened 2025-12-29 18:33:09 +01:00 by adam · 1 comment
Owner

Originally created by @mzbroch on GitHub (Sep 16, 2020).

Environment

  • Python version: 3.7.9
  • NetBox version: 2.9.2

Steps to Reproduce

  1. Create a container Prefix object, and an active Prefix object with the same prefix value as container's.
>>> Prefix.objects.create(prefix='192.0.2.0/24', status='container')
<Prefix: 192.0.2.0/24>

>>> Prefix.objects.get(prefix='192.0.2.0/24').get_available_prefixes()
IPSet(['192.0.2.0/24'])

>>> Prefix.objects.create(prefix='192.0.2.0/24', status='active')
<Prefix: 192.0.2.0/24>

>>> Prefix.objects.get(prefix='192.0.2.0/24', status='container').get_available_prefixes()
IPSet(['192.0.2.0/24'])

Expected Behavior

NetBox should not list container's child prefix in get_available_prefixes for cases when a child is equal to the container (filter to be used contained or equal, instead of contained only)

Observed Behavior

NetBox lists existing child prefix (which is equal to the container prefix) as a result of method get_available_prefixes

Originally created by @mzbroch on GitHub (Sep 16, 2020). ### Environment * Python version: 3.7.9 * NetBox version: 2.9.2 ### Steps to Reproduce 1. Create a container Prefix object, and an active Prefix object with the same prefix value as container's. ``` >>> Prefix.objects.create(prefix='192.0.2.0/24', status='container') <Prefix: 192.0.2.0/24> >>> Prefix.objects.get(prefix='192.0.2.0/24').get_available_prefixes() IPSet(['192.0.2.0/24']) >>> Prefix.objects.create(prefix='192.0.2.0/24', status='active') <Prefix: 192.0.2.0/24> >>> Prefix.objects.get(prefix='192.0.2.0/24', status='container').get_available_prefixes() IPSet(['192.0.2.0/24']) ``` ### Expected Behavior NetBox should not list container's child prefix in `get_available_prefixes` for cases when a child is equal to the container (filter to be used contained or equal, instead of contained only) ### Observed Behavior NetBox lists existing child prefix (which is equal to the container prefix) as a result of method `get_available_prefixes`
adam closed this issue 2025-12-29 18:33:09 +01:00
Author
Owner

@jeremystretch commented on GitHub (Sep 23, 2020):

This is expected behavior: the second prefix is not a child of the first. You've created two parallel prefixes with different statuses (which is a valid condition). NetBox will report the set of IPs available within each independently.

@jeremystretch commented on GitHub (Sep 23, 2020): This is expected behavior: the second prefix is not a child of the first. You've created two parallel prefixes with different statuses (which _is_ a valid condition). NetBox will report the set of IPs available within each independently.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/netbox#4107