mirror of
https://github.com/netbox-community/netbox.git
synced 2025-08-26 17:26:10 -06:00
Update vlans.py
This commit is contained in:
parent
debed6a960
commit
d014cb7f7c
@ -113,6 +113,15 @@ class VLANGroup(OrganizationalModel):
|
|||||||
if available_vids:
|
if available_vids:
|
||||||
return available_vids[0]
|
return available_vids[0]
|
||||||
return None
|
return None
|
||||||
|
|
||||||
|
def get_utilization(self):
|
||||||
|
"""
|
||||||
|
Return the percentage of utilization for this vlan group.
|
||||||
|
"""
|
||||||
|
assigned_vlan = VLAN.objects.filter(group=self.id).count()
|
||||||
|
if assigned_vlan != 0:
|
||||||
|
return round(assigned_vlan / (self.max_vid - self.min_vid + 1) * 100, 2)
|
||||||
|
return 0.0
|
||||||
|
|
||||||
|
|
||||||
class VLAN(PrimaryModel):
|
class VLAN(PrimaryModel):
|
||||||
|
Loading…
Reference in New Issue
Block a user