2021-09-17 15:37:19 -04:00
|
|
|
import django_tables2 as tables
|
|
|
|
|
|
|
|
from ipam.models import *
|
2022-01-27 15:48:05 -05:00
|
|
|
from netbox.tables import NetBoxTable, columns
|
2021-09-17 15:37:19 -04:00
|
|
|
|
|
|
|
__all__ = (
|
|
|
|
'ServiceTable',
|
2022-01-12 16:42:28 -05:00
|
|
|
'ServiceTemplateTable',
|
2021-09-17 15:37:19 -04:00
|
|
|
)
|
|
|
|
|
|
|
|
|
2022-01-27 15:48:05 -05:00
|
|
|
class ServiceTemplateTable(NetBoxTable):
|
2022-01-12 16:42:28 -05:00
|
|
|
name = tables.Column(
|
|
|
|
linkify=True
|
|
|
|
)
|
|
|
|
ports = tables.Column(
|
2022-06-05 10:31:21 +02:00
|
|
|
accessor=tables.A('port_list'),
|
|
|
|
order_by=tables.A('ports'),
|
2022-01-12 16:42:28 -05:00
|
|
|
)
|
2022-01-27 15:00:10 -05:00
|
|
|
tags = columns.TagColumn(
|
2022-01-12 16:42:28 -05:00
|
|
|
url_name='ipam:servicetemplate_list'
|
|
|
|
)
|
|
|
|
|
2022-01-27 15:48:05 -05:00
|
|
|
class Meta(NetBoxTable.Meta):
|
2022-01-12 16:42:28 -05:00
|
|
|
model = ServiceTemplate
|
|
|
|
fields = ('pk', 'id', 'name', 'protocol', 'ports', 'description', 'tags')
|
|
|
|
default_columns = ('pk', 'name', 'protocol', 'ports', 'description')
|
|
|
|
|
2021-09-17 15:37:19 -04:00
|
|
|
|
2022-01-27 15:48:05 -05:00
|
|
|
class ServiceTable(NetBoxTable):
|
2021-09-17 15:37:19 -04:00
|
|
|
name = tables.Column(
|
|
|
|
linkify=True
|
|
|
|
)
|
|
|
|
parent = tables.Column(
|
|
|
|
linkify=True,
|
|
|
|
order_by=('device', 'virtual_machine')
|
|
|
|
)
|
2022-01-12 16:42:28 -05:00
|
|
|
ports = tables.Column(
|
2022-06-05 10:31:21 +02:00
|
|
|
accessor=tables.A('port_list'),
|
|
|
|
order_by=tables.A('ports'),
|
2021-09-17 15:37:19 -04:00
|
|
|
)
|
2022-01-27 15:00:10 -05:00
|
|
|
tags = columns.TagColumn(
|
2021-09-17 15:37:19 -04:00
|
|
|
url_name='ipam:service_list'
|
|
|
|
)
|
|
|
|
|
2022-01-27 15:48:05 -05:00
|
|
|
class Meta(NetBoxTable.Meta):
|
2021-09-17 15:37:19 -04:00
|
|
|
model = Service
|
2022-01-17 11:12:54 -05:00
|
|
|
fields = (
|
|
|
|
'pk', 'id', 'name', 'parent', 'protocol', 'ports', 'ipaddresses', 'description', 'tags', 'created',
|
|
|
|
'last_updated',
|
|
|
|
)
|
2021-09-17 15:37:19 -04:00
|
|
|
default_columns = ('pk', 'name', 'parent', 'protocol', 'ports', 'description')
|