Skip to content

Commit

Permalink
Fix computation of available VLAN IDs
Browse files Browse the repository at this point in the history
  • Loading branch information
jeremystretch committed Jul 15, 2024
1 parent 9f56745 commit aaa4992
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions netbox/ipam/models/vlans.py
Original file line number Diff line number Diff line change
Expand Up @@ -118,9 +118,9 @@ def get_available_vids(self):
"""
Return all available VLANs within this group.
"""
available_vlans = {}
available_vlans = set()
for vlan_range in self.vid_ranges:
available_vlans = {vid for vid in range(vlan_range.lower, vlan_range.upper)}
available_vlans = available_vlans.union({vid for vid in range(vlan_range.lower, vlan_range.upper)})
available_vlans -= set(VLAN.objects.filter(group=self).values_list('vid', flat=True))

return sorted(available_vlans)
Expand Down

0 comments on commit aaa4992

Please sign in to comment.