Example #1
0
class VLANDetailTable(VLANTable):
    prefixes = tables.TemplateColumn(template_code=VLAN_PREFIXES,
                                     orderable=False,
                                     verbose_name='Prefixes')
    tenant = tables.TemplateColumn(template_code=COL_TENANT)
    tags = TagColumn(url_name='ipam:vlan_list')

    class Meta(VLANTable.Meta):
        fields = ('pk', 'vid', 'site', 'group', 'name', 'prefixes', 'tenant',
                  'status', 'role', 'description', 'tags')
        default_columns = ('pk', 'vid', 'site', 'group', 'name', 'prefixes',
                           'tenant', 'status', 'role', 'description')
Example #2
0
class IPAddressTable(BaseTable):
    pk = ToggleColumn()
    address = tables.TemplateColumn(
        template_code=IPADDRESS_LINK,
        verbose_name='IP Address'
    )
    vrf = tables.TemplateColumn(
        template_code=VRF_LINK,
        verbose_name='VRF'
    )
    status = ChoiceFieldColumn(
        default=AVAILABLE_LABEL
    )
    role = ChoiceFieldColumn()
    tenant = TenantColumn()
    assigned_object = tables.Column(
        linkify=True,
        orderable=False,
        verbose_name='Interface'
    )
    assigned_object_parent = tables.Column(
        accessor='assigned_object__parent_object',
        linkify=True,
        orderable=False,
        verbose_name='Device/VM'
    )
    nat_inside = tables.Column(
        linkify=True,
        orderable=False,
        verbose_name='NAT (Inside)'
    )
    assigned = BooleanColumn(
        accessor='assigned_object_id',
        linkify=True,
        verbose_name='Assigned'
    )
    tags = TagColumn(
        url_name='ipam:ipaddress_list'
    )

    class Meta(BaseTable.Meta):
        model = IPAddress
        fields = (
            'pk', 'id', 'address', 'vrf', 'status', 'role', 'tenant', 'nat_inside', 'assigned', 'dns_name', 'description',
            'tags', 'created', 'last_updated',
        )
        default_columns = (
            'pk', 'address', 'vrf', 'status', 'role', 'tenant', 'assigned', 'dns_name', 'description',
        )
        row_attrs = {
            'class': lambda record: 'success' if not isinstance(record, IPAddress) else '',
        }
Example #3
0
class CableTable(BaseTable):
    pk = ToggleColumn()
    id = tables.Column(linkify=True, verbose_name='ID')
    termination_a_parent = tables.TemplateColumn(
        template_code=CABLE_TERMINATION_PARENT,
        accessor=Accessor('termination_a'),
        orderable=False,
        verbose_name='Side A')
    termination_a = tables.LinkColumn(accessor=Accessor('termination_a'),
                                      orderable=False,
                                      verbose_name='Termination A')
    termination_b_parent = tables.TemplateColumn(
        template_code=CABLE_TERMINATION_PARENT,
        accessor=Accessor('termination_b'),
        orderable=False,
        verbose_name='Side B')
    termination_b = tables.LinkColumn(accessor=Accessor('termination_b'),
                                      orderable=False,
                                      verbose_name='Termination B')
    status = tables.TemplateColumn(template_code=STATUS_LABEL)
    length = tables.TemplateColumn(template_code=CABLE_LENGTH,
                                   order_by='_abs_length')
    color = ColorColumn()
    tags = TagColumn(url_name='dcim:cable_list')

    class Meta(BaseTable.Meta):
        model = Cable
        fields = (
            'pk',
            'id',
            'label',
            'termination_a_parent',
            'termination_a',
            'termination_b_parent',
            'termination_b',
            'status',
            'type',
            'color',
            'length',
            'tags',
        )
        default_columns = (
            'pk',
            'id',
            'label',
            'termination_a_parent',
            'termination_a',
            'termination_b_parent',
            'termination_b',
            'status',
            'type',
        )
Example #4
0
class PowerPanelTable(BaseTable):
    pk = ToggleColumn()
    name = tables.Column(linkify=True)
    site = tables.Column(linkify=True)
    powerfeed_count = LinkedCountColumn(viewname='dcim:powerfeed_list',
                                        url_params={'power_panel_id': 'pk'},
                                        verbose_name='Feeds')
    tags = TagColumn(url_name='dcim:powerpanel_list')

    class Meta(BaseTable.Meta):
        model = PowerPanel
        fields = ('pk', 'name', 'site', 'location', 'powerfeed_count', 'tags')
        default_columns = ('pk', 'name', 'site', 'location', 'powerfeed_count')
Example #5
0
class VRFTable(BaseTable):
    pk = ToggleColumn()
    name = tables.LinkColumn()
    rd = tables.Column(verbose_name='RD')
    tenant = tables.TemplateColumn(template_code=COL_TENANT)
    enforce_unique = BooleanColumn(verbose_name='Unique')
    tags = TagColumn(url_name='ipam:vrf_list')

    class Meta(BaseTable.Meta):
        model = VRF
        fields = ('pk', 'name', 'rd', 'tenant', 'enforce_unique',
                  'description', 'tags')
        default_columns = ('pk', 'name', 'rd', 'tenant', 'description')
Example #6
0
class VirtualChassisTable(BaseTable):
    pk = ToggleColumn()
    name = tables.Column(linkify=True)
    master = tables.Column(linkify=True)
    member_count = LinkedCountColumn(viewname='dcim:device_list',
                                     url_params={'virtual_chassis_id': 'pk'},
                                     verbose_name='Members')
    tags = TagColumn(url_name='dcim:virtualchassis_list')

    class Meta(BaseTable.Meta):
        model = VirtualChassis
        fields = ('pk', 'name', 'domain', 'master', 'member_count', 'tags')
        default_columns = ('pk', 'name', 'domain', 'master', 'member_count')
Example #7
0
class InterfaceTable(DeviceComponentTable, BaseInterfaceTable,
                     PathEndpointTable):
    device = tables.Column(linkify={
        'viewname': 'dcim:device_interfaces',
        'args': [Accessor('device_id')],
    })
    mgmt_only = BooleanColumn()
    wireless_link = tables.Column(linkify=True)
    wireless_lans = TemplateColumn(template_code=INTERFACE_WIRELESS_LANS,
                                   orderable=False,
                                   verbose_name='Wireless LANs')
    tags = TagColumn(url_name='dcim:interface_list')

    class Meta(DeviceComponentTable.Meta):
        model = Interface
        fields = (
            'pk',
            'id',
            'name',
            'device',
            'label',
            'enabled',
            'type',
            'mgmt_only',
            'mtu',
            'mode',
            'mac_address',
            'wwn',
            'rf_role',
            'rf_channel',
            'rf_channel_frequency',
            'rf_channel_width',
            'tx_power',
            'description',
            'mark_connected',
            'cable',
            'cable_color',
            'wireless_link',
            'wireless_lans',
            'link_peer',
            'connection',
            'tags',
            'ip_addresses',
            'fhrp_groups',
            'untagged_vlan',
            'tagged_vlans',
            'created',
            'last_updated',
        )
        default_columns = ('pk', 'name', 'device', 'label', 'enabled', 'type',
                           'description')
Example #8
0
class PowerFeedTable(CableTerminationTable):
    pk = ToggleColumn()
    name = tables.Column(linkify=True)
    power_panel = tables.Column(linkify=True)
    rack = tables.Column(linkify=True)
    status = ChoiceFieldColumn()
    type = ChoiceFieldColumn()
    max_utilization = tables.TemplateColumn(template_code="{{ value }}%")
    available_power = tables.Column(verbose_name='Available power (VA)')
    comments = MarkdownColumn()
    tags = TagColumn(url_name='dcim:powerfeed_list')

    class Meta(BaseTable.Meta):
        model = PowerFeed
        fields = (
            'pk',
            'id',
            'name',
            'power_panel',
            'rack',
            'status',
            'type',
            'supply',
            'voltage',
            'amperage',
            'phase',
            'max_utilization',
            'mark_connected',
            'cable',
            'cable_color',
            'cable_peer',
            'connection',
            'available_power',
            'comments',
            'tags',
        )
        default_columns = (
            'pk',
            'name',
            'power_panel',
            'rack',
            'status',
            'type',
            'supply',
            'voltage',
            'amperage',
            'phase',
            'cable',
            'cable_peer',
        )
Example #9
0
class RouteTargetTable(BaseTable):
    pk = ToggleColumn()
    name = tables.LinkColumn()
    tenant = tables.TemplateColumn(
        template_code=COL_TENANT
    )
    tags = TagColumn(
        url_name='ipam:vrf_list'
    )

    class Meta(BaseTable.Meta):
        model = RouteTarget
        fields = ('pk', 'name', 'tenant', 'description', 'tags')
        default_columns = ('pk', 'name', 'tenant', 'description')
Example #10
0
class ServiceTable(BaseTable):
    pk = ToggleColumn()
    name = tables.Column(linkify=True)
    parent = tables.LinkColumn(order_by=('device', 'virtual_machine'))
    ports = tables.TemplateColumn(template_code='{{ record.port_list }}',
                                  verbose_name='Ports')
    tags = TagColumn(url_name='ipam:service_list')

    class Meta(BaseTable.Meta):
        model = Service
        fields = ('pk', 'name', 'parent', 'protocol', 'ports', 'ipaddresses',
                  'description', 'tags')
        default_columns = ('pk', 'name', 'parent', 'protocol', 'ports',
                           'description')
Example #11
0
class BGPPeerGroupTable(BaseTable):
    pk = ToggleColumn()
    name = tables.LinkColumn()
    import_policies = tables.TemplateColumn(template_code=POLICIES,
                                            orderable=False)
    export_policies = tables.TemplateColumn(template_code=POLICIES,
                                            orderable=False)
    tags = TagColumn(url_name='plugins:netbox_bgp:peer_group_list')

    class Meta(BaseTable.Meta):
        model = BGPPeerGroup
        fields = ('pk', 'name', 'description', 'tags', 'import_policies',
                  'export_policies')
        default_columns = ('pk', 'name', 'description')
Example #12
0
File: vrfs.py Project: xcdr/netbox
class RouteTargetTable(BaseTable):
    pk = ToggleColumn()
    name = tables.Column(
        linkify=True
    )
    tenant = TenantColumn()
    tags = TagColumn(
        url_name='ipam:vrf_list'
    )

    class Meta(BaseTable.Meta):
        model = RouteTarget
        fields = ('pk', 'name', 'tenant', 'description', 'tags')
        default_columns = ('pk', 'name', 'tenant', 'description')
Example #13
0
class SiteGroupTable(BaseTable):
    pk = ToggleColumn()
    name = MPTTColumn(linkify=True)
    site_count = LinkedCountColumn(viewname='dcim:site_list',
                                   url_params={'group_id': 'pk'},
                                   verbose_name='Sites')
    tags = TagColumn(url_name='dcim:sitegroup_list')
    actions = ButtonsColumn(SiteGroup)

    class Meta(BaseTable.Meta):
        model = SiteGroup
        fields = ('pk', 'id', 'name', 'slug', 'site_count', 'description',
                  'tags', 'actions', 'created', 'last_updated')
        default_columns = ('pk', 'name', 'site_count', 'description',
                           'actions')
Example #14
0
class DeviceBayTable(DeviceComponentTable):
    device = tables.Column(linkify={
        'viewname': 'dcim:device_devicebays',
        'args': [Accessor('device_id')],
    })
    status = tables.TemplateColumn(template_code=DEVICEBAY_STATUS)
    installed_device = tables.Column(linkify=True)
    tags = TagColumn(url_name='dcim:devicebay_list')

    class Meta(DeviceComponentTable.Meta):
        model = DeviceBay
        fields = ('pk', 'name', 'device', 'label', 'status',
                  'installed_device', 'description', 'tags')
        default_columns = ('pk', 'name', 'device', 'label', 'status',
                           'installed_device', 'description')
Example #15
0
class AggregateDetailTable(AggregateTable):
    child_count = tables.Column(
        verbose_name='Prefixes'
    )
    utilization = tables.TemplateColumn(
        template_code=UTILIZATION_GRAPH,
        orderable=False
    )
    tags = TagColumn(
        url_name='ipam:aggregate_list'
    )

    class Meta(AggregateTable.Meta):
        fields = ('pk', 'prefix', 'rir', 'child_count', 'utilization', 'date_added', 'description', 'tags')
        default_columns = ('pk', 'prefix', 'rir', 'child_count', 'utilization', 'date_added', 'description')
Example #16
0
class PowerPanelTable(BaseTable):
    pk = ToggleColumn()
    name = tables.LinkColumn()
    site = tables.LinkColumn(viewname='dcim:site',
                             args=[Accessor('site__slug')])
    powerfeed_count = tables.TemplateColumn(
        template_code=POWERPANEL_POWERFEED_COUNT, verbose_name='Feeds')
    tags = TagColumn(url_name='dcim:powerpanel_list')

    class Meta(BaseTable.Meta):
        model = PowerPanel
        fields = ('pk', 'name', 'site', 'rack_group', 'powerfeed_count',
                  'tags')
        default_columns = ('pk', 'name', 'site', 'rack_group',
                           'powerfeed_count')
Example #17
0
class PowerOutletTable(DeviceComponentTable, PathEndpointTable):
    power_port = tables.Column(
        linkify=True
    )
    tags = TagColumn(
        url_name='dcim:poweroutlet_list'
    )

    class Meta(DeviceComponentTable.Meta):
        model = PowerOutlet
        fields = (
            'pk', 'device', 'name', 'label', 'type', 'description', 'power_port', 'feed_leg', 'cable', 'cable_peer',
            'connection', 'tags',
        )
        default_columns = ('pk', 'device', 'name', 'label', 'type', 'power_port', 'feed_leg', 'description')
Example #18
0
class SecretTable(BaseTable):
    pk = ToggleColumn()
    id = tables.Column(  # Provides a link to the secret
        linkify=True)
    assigned_object = tables.Column(linkify=True,
                                    orderable=False,
                                    verbose_name='Assigned object')
    role = tables.Column(linkify=True)
    tags = TagColumn(url_name='secrets:secret_list')

    class Meta(BaseTable.Meta):
        model = Secret
        fields = ('pk', 'id', 'assigned_object', 'role', 'name',
                  'last_updated', 'hash', 'tags')
        default_columns = ('pk', 'id', 'assigned_object', 'role', 'name',
                           'last_updated')
Example #19
0
File: ip.py Project: xcdr/netbox
class AggregateTable(BaseTable):
    pk = ToggleColumn()
    prefix = tables.Column(linkify=True, verbose_name='Aggregate')
    tenant = TenantColumn()
    date_added = tables.DateColumn(format="Y-m-d", verbose_name='Added')
    child_count = tables.Column(verbose_name='Prefixes')
    utilization = UtilizationColumn(accessor='get_utilization',
                                    orderable=False)
    tags = TagColumn(url_name='ipam:aggregate_list')

    class Meta(BaseTable.Meta):
        model = Aggregate
        fields = ('pk', 'prefix', 'rir', 'tenant', 'child_count',
                  'utilization', 'date_added', 'description', 'tags')
        default_columns = ('pk', 'prefix', 'rir', 'tenant', 'child_count',
                           'utilization', 'date_added', 'description')
Example #20
0
class PowerPanelTable(BaseTable):
    pk = ToggleColumn()
    name = tables.LinkColumn()
    site = tables.LinkColumn(viewname='dcim:site',
                             args=[Accessor('site__slug')])
    powerfeed_count = LinkedCountColumn(viewname='dcim:powerfeed_list',
                                        url_params={'power_panel_id': 'pk'},
                                        verbose_name='Feeds')
    tags = TagColumn(url_name='dcim:powerpanel_list')

    class Meta(BaseTable.Meta):
        model = PowerPanel
        fields = ('pk', 'name', 'site', 'rack_group', 'powerfeed_count',
                  'tags')
        default_columns = ('pk', 'name', 'site', 'rack_group',
                           'powerfeed_count')
Example #21
0
class VirtualMachineTable(BaseTable):
    pk = ToggleColumn()
    name = tables.Column(linkify=True)
    status = ChoiceFieldColumn()
    cluster = tables.Column(linkify=True)
    role = ColoredLabelColumn()
    tenant = TenantColumn()
    comments = MarkdownColumn()
    primary_ip4 = tables.Column(linkify=True, verbose_name='IPv4 Address')
    primary_ip6 = tables.Column(linkify=True, verbose_name='IPv6 Address')
    primary_ip = tables.Column(linkify=True,
                               order_by=PRIMARY_IP_ORDERING,
                               verbose_name='IP Address')
    tags = TagColumn(url_name='virtualization:virtualmachine_list')

    class Meta(BaseTable.Meta):
        model = VirtualMachine
        fields = (
            'pk',
            'id',
            'name',
            'status',
            'cluster',
            'role',
            'tenant',
            'platform',
            'vcpus',
            'memory',
            'disk',
            'primary_ip4',
            'primary_ip6',
            'primary_ip',
            'comments',
            'tags',
        )
        default_columns = (
            'pk',
            'name',
            'status',
            'cluster',
            'role',
            'tenant',
            'vcpus',
            'memory',
            'disk',
            'primary_ip',
        )
Example #22
0
class ProviderTable(BaseTable):
    pk = ToggleColumn()
    name = tables.LinkColumn()
    circuit_count = tables.Column(
        accessor=Accessor('count_circuits'),
        verbose_name='Circuits'
    )
    tags = TagColumn(
        url_name='circuits:provider_list'
    )

    class Meta(BaseTable.Meta):
        model = Provider
        fields = (
            'pk', 'name', 'asn', 'account', 'portal_url', 'noc_contact', 'admin_contact', 'circuit_count', 'tags',
        )
        default_columns = ('pk', 'name', 'asn', 'account', 'circuit_count')
Example #23
0
class VirtualChassisTable(BaseTable):
    pk = ToggleColumn()
    name = tables.Column(
        accessor=Accessor('master__name'),
        linkify=True
    )
    member_count = tables.Column(
        verbose_name='Members'
    )
    tags = TagColumn(
        url_name='dcim:virtualchassis_list'
    )

    class Meta(BaseTable.Meta):
        model = VirtualChassis
        fields = ('pk', 'name', 'domain', 'member_count', 'tags')
        default_columns = ('pk', 'name', 'domain', 'member_count')
Example #24
0
class ClusterTable(BaseTable):
    pk = ToggleColumn()
    name = tables.LinkColumn()
    tenant = tables.Column(linkify=True)
    site = tables.Column(linkify=True)
    device_count = tables.TemplateColumn(template_code=DEVICE_COUNT,
                                         verbose_name='Devices')
    vm_count = tables.TemplateColumn(template_code=VM_COUNT,
                                     verbose_name='VMs')
    tags = TagColumn(url_name='virtualization:cluster_list')

    class Meta(BaseTable.Meta):
        model = Cluster
        fields = ('pk', 'name', 'type', 'group', 'tenant', 'site',
                  'device_count', 'vm_count', 'tags')
        default_columns = ('pk', 'name', 'type', 'group', 'tenant', 'site',
                           'device_count', 'vm_count')
Example #25
0
class RackRoleTable(BaseTable):
    pk = ToggleColumn()
    name = tables.Column(linkify=True)
    rack_count = tables.Column(verbose_name='Racks')
    color = ColorColumn()
    tags = TagColumn(
        url_name='dcim:rackrole_list'
    )
    actions = ButtonsColumn(RackRole)

    class Meta(BaseTable.Meta):
        model = RackRole
        fields = (
            'pk', 'id', 'name', 'rack_count', 'color', 'description', 'slug', 'tags', 'actions',
            'created', 'last_updated',
        )
        default_columns = ('pk', 'name', 'rack_count', 'color', 'description', 'actions')
Example #26
0
class TenantTable(BaseTable):
    pk = ToggleColumn()
    name = tables.Column(
        linkify=True
    )
    group = tables.Column(
        linkify=True
    )
    comments = MarkdownColumn()
    tags = TagColumn(
        url_name='tenancy:tenant_list'
    )

    class Meta(BaseTable.Meta):
        model = Tenant
        fields = ('pk', 'name', 'slug', 'group', 'description', 'comments', 'tags')
        default_columns = ('pk', 'name', 'group', 'description')
Example #27
0
class ProviderNetworkTable(BaseTable):
    pk = ToggleColumn()
    name = tables.Column(
        linkify=True
    )
    provider = tables.Column(
        linkify=True
    )
    comments = MarkdownColumn()
    tags = TagColumn(
        url_name='circuits:providernetwork_list'
    )

    class Meta(BaseTable.Meta):
        model = ProviderNetwork
        fields = ('pk', 'id', 'name', 'provider', 'description', 'comments', 'tags', 'created', 'last_updated',)
        default_columns = ('pk', 'name', 'provider', 'description')
Example #28
0
class CircuitTypeTable(BaseTable):
    pk = ToggleColumn()
    name = tables.Column(
        linkify=True
    )
    tags = TagColumn(
        url_name='circuits:circuittype_list'
    )
    circuit_count = tables.Column(
        verbose_name='Circuits'
    )
    actions = ButtonsColumn(CircuitType)

    class Meta(BaseTable.Meta):
        model = CircuitType
        fields = ('pk', 'id', 'name', 'circuit_count', 'description', 'slug', 'tags', 'actions', 'created', 'last_updated',)
        default_columns = ('pk', 'name', 'circuit_count', 'description', 'slug', 'actions')
Example #29
0
class InventoryItemTable(DeviceComponentTable):
    manufacturer = tables.Column(
        linkify=True
    )
    discovered = BooleanColumn()
    tags = TagColumn(
        url_name='dcim:inventoryitem_list'
    )
    cable = None  # Override DeviceComponentTable

    class Meta(DeviceComponentTable.Meta):
        model = InventoryItem
        fields = (
            'pk', 'device', 'name', 'label', 'manufacturer', 'part_id', 'serial', 'asset_tag', 'description',
            'discovered', 'tags',
        )
        default_columns = ('pk', 'device', 'name', 'label', 'manufacturer', 'part_id', 'serial', 'asset_tag')
Example #30
0
class RackDetailTable(RackTable):
    device_count = LinkedCountColumn(viewname='dcim:device_list',
                                     url_params={'rack_id': 'pk'},
                                     verbose_name='Devices')
    get_utilization = tables.TemplateColumn(template_code=UTILIZATION_GRAPH,
                                            orderable=False,
                                            verbose_name='Space')
    get_power_utilization = tables.TemplateColumn(
        template_code=UTILIZATION_GRAPH, orderable=False, verbose_name='Power')
    tags = TagColumn(url_name='dcim:rack_list')

    class Meta(RackTable.Meta):
        fields = (
            'pk',
            'name',
            'site',
            'group',
            'status',
            'facility_id',
            'tenant',
            'role',
            'serial',
            'asset_tag',
            'type',
            'width',
            'u_height',
            'device_count',
            'get_utilization',
            'get_power_utilization',
            'tags',
        )
        default_columns = (
            'pk',
            'name',
            'site',
            'group',
            'status',
            'facility_id',
            'tenant',
            'role',
            'u_height',
            'device_count',
            'get_utilization',
            'get_power_utilization',
        )