mirror of
https://github.com/netbox-community/netbox.git
synced 2024-05-10 07:54:54 +00:00
Adding asdot notation to ASN views
Adds custom property to asn model to compute asdot notation if required. Updates asn view to show asdot notation if one exists in the format xxxxx (yyy.yyy) Adds a custom column renderer to asn table to display asdot notation if one exists
This commit is contained in:
@@ -130,6 +130,14 @@ class ASN(PrimaryModel):
|
||||
def get_absolute_url(self):
|
||||
return reverse('ipam:asn', args=[self.pk])
|
||||
|
||||
@property
|
||||
def asdot_notation(self):
|
||||
# Return asdot notation for an ASN larger than 65535
|
||||
if self.asn > 65535:
|
||||
return '{}.{}'.format(self.asn // 65536, self.asn % 65536)
|
||||
else:
|
||||
return None
|
||||
|
||||
|
||||
@extras_features('custom_fields', 'custom_links', 'export_templates', 'tags', 'webhooks')
|
||||
class Aggregate(GetAvailablePrefixesMixin, PrimaryModel):
|
||||
|
Reference in New Issue
Block a user