|
|
@@ -4,7 +4,7 @@ from django_tables2.utils import Accessor
|
|
|
|
|
|
from ipam.models import *
|
|
|
from netbox.tables import NetBoxTable, columns
|
|
|
-from tenancy.tables import TenantColumn
|
|
|
+from tenancy.tables import TenancyColumnsMixin, TenantColumn
|
|
|
|
|
|
__all__ = (
|
|
|
'AggregateTable',
|
|
|
@@ -99,7 +99,7 @@ class RIRTable(NetBoxTable):
|
|
|
# ASNs
|
|
|
#
|
|
|
|
|
|
-class ASNTable(NetBoxTable):
|
|
|
+class ASNTable(TenancyColumnsMixin, NetBoxTable):
|
|
|
asn = tables.Column(
|
|
|
linkify=True
|
|
|
)
|
|
|
@@ -122,7 +122,6 @@ class ASNTable(NetBoxTable):
|
|
|
linkify_item=True,
|
|
|
verbose_name='Sites'
|
|
|
)
|
|
|
- tenant = TenantColumn()
|
|
|
tags = columns.TagColumn(
|
|
|
url_name='ipam:asn_list'
|
|
|
)
|
|
|
@@ -130,7 +129,7 @@ class ASNTable(NetBoxTable):
|
|
|
class Meta(NetBoxTable.Meta):
|
|
|
model = ASN
|
|
|
fields = (
|
|
|
- 'pk', 'asn', 'asn_asdot', 'rir', 'site_count', 'provider_count', 'tenant', 'description', 'sites', 'tags',
|
|
|
+ 'pk', 'asn', 'asn_asdot', 'rir', 'site_count', 'provider_count', 'tenant', 'tenant_group', 'description', 'sites', 'tags',
|
|
|
'created', 'last_updated', 'actions',
|
|
|
)
|
|
|
default_columns = ('pk', 'asn', 'rir', 'site_count', 'provider_count', 'sites', 'description', 'tenant')
|
|
|
@@ -140,12 +139,11 @@ class ASNTable(NetBoxTable):
|
|
|
# Aggregates
|
|
|
#
|
|
|
|
|
|
-class AggregateTable(NetBoxTable):
|
|
|
+class AggregateTable(TenancyColumnsMixin, NetBoxTable):
|
|
|
prefix = tables.Column(
|
|
|
linkify=True,
|
|
|
verbose_name='Aggregate'
|
|
|
)
|
|
|
- tenant = TenantColumn()
|
|
|
date_added = tables.DateColumn(
|
|
|
format="Y-m-d",
|
|
|
verbose_name='Added'
|
|
|
@@ -164,7 +162,7 @@ class AggregateTable(NetBoxTable):
|
|
|
class Meta(NetBoxTable.Meta):
|
|
|
model = Aggregate
|
|
|
fields = (
|
|
|
- 'pk', 'id', 'prefix', 'rir', 'tenant', 'child_count', 'utilization', 'date_added', 'description', 'tags',
|
|
|
+ 'pk', 'id', 'prefix', 'rir', 'tenant', 'tenant_group', 'child_count', 'utilization', 'date_added', 'description', 'tags',
|
|
|
'created', 'last_updated',
|
|
|
)
|
|
|
default_columns = ('pk', 'prefix', 'rir', 'tenant', 'child_count', 'utilization', 'date_added', 'description')
|
|
|
@@ -225,7 +223,7 @@ class PrefixUtilizationColumn(columns.UtilizationColumn):
|
|
|
"""
|
|
|
|
|
|
|
|
|
-class PrefixTable(NetBoxTable):
|
|
|
+class PrefixTable(TenancyColumnsMixin, NetBoxTable):
|
|
|
prefix = columns.TemplateColumn(
|
|
|
template_code=PREFIX_LINK,
|
|
|
export_raw=True,
|
|
|
@@ -256,7 +254,6 @@ class PrefixTable(NetBoxTable):
|
|
|
template_code=VRF_LINK,
|
|
|
verbose_name='VRF'
|
|
|
)
|
|
|
- tenant = TenantColumn()
|
|
|
site = tables.Column(
|
|
|
linkify=True
|
|
|
)
|
|
|
@@ -289,7 +286,7 @@ class PrefixTable(NetBoxTable):
|
|
|
class Meta(NetBoxTable.Meta):
|
|
|
model = Prefix
|
|
|
fields = (
|
|
|
- 'pk', 'id', 'prefix', 'prefix_flat', 'status', 'children', 'vrf', 'utilization', 'tenant', 'site',
|
|
|
+ 'pk', 'id', 'prefix', 'prefix_flat', 'status', 'children', 'vrf', 'utilization', 'tenant', 'tenant_group', 'site',
|
|
|
'vlan_group', 'vlan', 'role', 'is_pool', 'mark_utilized', 'description', 'tags', 'created', 'last_updated',
|
|
|
)
|
|
|
default_columns = (
|
|
|
@@ -303,7 +300,7 @@ class PrefixTable(NetBoxTable):
|
|
|
#
|
|
|
# IP ranges
|
|
|
#
|
|
|
-class IPRangeTable(NetBoxTable):
|
|
|
+class IPRangeTable(TenancyColumnsMixin, NetBoxTable):
|
|
|
start_address = tables.Column(
|
|
|
linkify=True
|
|
|
)
|
|
|
@@ -317,7 +314,6 @@ class IPRangeTable(NetBoxTable):
|
|
|
role = tables.Column(
|
|
|
linkify=True
|
|
|
)
|
|
|
- tenant = TenantColumn()
|
|
|
utilization = columns.UtilizationColumn(
|
|
|
accessor='utilization',
|
|
|
orderable=False
|
|
|
@@ -329,7 +325,7 @@ class IPRangeTable(NetBoxTable):
|
|
|
class Meta(NetBoxTable.Meta):
|
|
|
model = IPRange
|
|
|
fields = (
|
|
|
- 'pk', 'id', 'start_address', 'end_address', 'size', 'vrf', 'status', 'role', 'tenant', 'description',
|
|
|
+ 'pk', 'id', 'start_address', 'end_address', 'size', 'vrf', 'status', 'role', 'tenant', 'tenant_group', 'description',
|
|
|
'utilization', 'tags', 'created', 'last_updated',
|
|
|
)
|
|
|
default_columns = (
|
|
|
@@ -344,7 +340,7 @@ class IPRangeTable(NetBoxTable):
|
|
|
# IPAddresses
|
|
|
#
|
|
|
|
|
|
-class IPAddressTable(NetBoxTable):
|
|
|
+class IPAddressTable(TenancyColumnsMixin, NetBoxTable):
|
|
|
address = tables.TemplateColumn(
|
|
|
template_code=IPADDRESS_LINK,
|
|
|
verbose_name='IP Address'
|
|
|
@@ -357,7 +353,6 @@ class IPAddressTable(NetBoxTable):
|
|
|
default=AVAILABLE_LABEL
|
|
|
)
|
|
|
role = columns.ChoiceFieldColumn()
|
|
|
- tenant = TenantColumn()
|
|
|
assigned_object = tables.Column(
|
|
|
linkify=True,
|
|
|
orderable=False,
|
|
|
@@ -386,7 +381,7 @@ class IPAddressTable(NetBoxTable):
|
|
|
class Meta(NetBoxTable.Meta):
|
|
|
model = IPAddress
|
|
|
fields = (
|
|
|
- 'pk', 'id', 'address', 'vrf', 'status', 'role', 'tenant', 'nat_inside', 'assigned', 'dns_name', 'description',
|
|
|
+ 'pk', 'id', 'address', 'vrf', 'status', 'role', 'tenant', 'tenant_group', 'nat_inside', 'assigned', 'dns_name', 'description',
|
|
|
'tags', 'created', 'last_updated',
|
|
|
)
|
|
|
default_columns = (
|