Exemplo n.º 1
0
class UpgradeDeviceListTable(BaseTable):
    pk = ToggleColumn()
    name = tables.TemplateColumn(order_by=('name', ),
                                 template_code=UPGRADE_DEVICE_LINK)
    t_sw = tables.TemplateColumn(
        verbose_name='Target Version',
        template_code=UPGRADE_TARGET_SOFTWARE,
        orderable=False,
    )
    c_sw = tables.TemplateColumn(
        verbose_name='Curent Version',
        template_code=UPGRADE_CURRENT_SOFTWARE,
        orderable=False,
    )
    tenant = tables.TemplateColumn(template_code=COL_TENANT)
    device_role = ColoredLabelColumn(verbose_name='Role')
    device_type = tables.LinkColumn(
        verbose_name='Device Type',
        text=lambda record: record.device_type.model)
    tags = TagColumn(url_name='dcim:device_list')

    class Meta(BaseTable.Meta):
        model = Device
        fields = ('pk', 'name', 't_sw', 'c_sw', 'tenant', 'device_role',
                  'device_type', 'tags')
class ServiceMappingListTable(BaseTable):
    pk = ToggleColumn()
    name = tables.TemplateColumn(order_by=("name", ),
                                 template_code=SERVICE_MAPPING_DEVICE_LINK,
                                 verbose_name='Device')
    service = tables.TemplateColumn(
        template_code=ATTACHED_SERVICES_LIST,
        verbose_name="Service",
        orderable=False,
    )
    tenant = tables.TemplateColumn(template_code=TenantColumn)
    device_role = ColoredLabelColumn(verbose_name="Role")
    device_type = tables.LinkColumn(
        viewname="dcim:devicetype",
        args=[Accessor("device_type.pk")],
        verbose_name="Type",
    )
    tags = TagColumn(url_name="dcim:device_list")

    status = tables.TemplateColumn(
        template_code=COMPLIANCE_STATUS,
        verbose_name="Status",
    )

    notes = tables.TemplateColumn(
        template_code=COMPLIANCE_NOTES,
        verbose_name="Notes",
        orderable=False,
    )

    class Meta(BaseTable.Meta):
        model = Device
        fields = ("pk", "name", "service", "tenant", "device_role",
                  "device_type", "tags", "status", "notes")
Exemplo n.º 3
0
class RackTable(BaseTable):
    pk = ToggleColumn()
    name = tables.LinkColumn(order_by=('_name', ))
    site = tables.LinkColumn(viewname='dcim:site',
                             args=[Accessor('site__slug')])
    tenant = tables.TemplateColumn(template_code=COL_TENANT)
    status = tables.TemplateColumn(template_code=STATUS_LABEL)
    role = ColoredLabelColumn()
    u_height = tables.TemplateColumn(template_code="{{ record.u_height }}U",
                                     verbose_name='Height')

    class Meta(BaseTable.Meta):
        model = Rack
        fields = (
            'pk',
            'name',
            'site',
            'group',
            'status',
            'facility_id',
            'tenant',
            'role',
            'serial',
            'asset_tag',
            'type',
            'width',
            'u_height',
        )
        default_columns = ('pk', 'name', 'site', 'group', 'status',
                           'facility_id', 'tenant', 'role', 'u_height')
Exemplo n.º 4
0
class RackTable(BaseTable):
    pk = ToggleColumn()
    name = tables.Column(order_by=('_name', ), linkify=True)
    location = tables.Column(linkify=True)
    site = tables.Column(linkify=True)
    tenant = TenantColumn()
    status = ChoiceFieldColumn()
    role = ColoredLabelColumn()
    u_height = tables.TemplateColumn(template_code="{{ record.u_height }}U",
                                     verbose_name='Height')

    class Meta(BaseTable.Meta):
        model = Rack
        fields = (
            'pk',
            'name',
            'site',
            'location',
            'status',
            'facility_id',
            'tenant',
            'role',
            'serial',
            'asset_tag',
            'type',
            'width',
            'u_height',
        )
        default_columns = ('pk', 'name', 'site', 'location', 'status',
                           'facility_id', 'tenant', 'role', 'u_height')
Exemplo n.º 5
0
class RackTable(BaseTable):
    pk = ToggleColumn()
    name = tables.Column(
        order_by=('_name',),
        linkify=True
    )
    location = tables.Column(
        linkify=True
    )
    site = tables.Column(
        linkify=True
    )
    tenant = TenantColumn()
    status = ChoiceFieldColumn()
    role = ColoredLabelColumn()
    u_height = tables.TemplateColumn(
        template_code="{{ record.u_height }}U",
        verbose_name='Height'
    )
    comments = MarkdownColumn()
    device_count = LinkedCountColumn(
        viewname='dcim:device_list',
        url_params={'rack_id': 'pk'},
        verbose_name='Devices'
    )
    get_utilization = UtilizationColumn(
        orderable=False,
        verbose_name='Space'
    )
    get_power_utilization = UtilizationColumn(
        orderable=False,
        verbose_name='Power'
    )
    tags = TagColumn(
        url_name='dcim:rack_list'
    )
    outer_width = tables.TemplateColumn(
        template_code="{{ record.outer_width }} {{ record.outer_unit }}",
        verbose_name='Outer Width'
    )
    outer_depth = tables.TemplateColumn(
        template_code="{{ record.outer_depth }} {{ record.outer_unit }}",
        verbose_name='Outer Depth'
    )

    class Meta(BaseTable.Meta):
        model = Rack
        fields = (
            'pk', 'id', 'name', 'site', 'location', 'status', 'facility_id', 'tenant', 'role', 'serial', 'asset_tag',
            'type', 'width', 'outer_width', 'outer_depth', 'u_height', 'comments', 'device_count', 'get_utilization',
            'get_power_utilization', 'tags', 'created', 'last_updated',
        )
        default_columns = (
            'pk', 'name', 'site', 'location', 'status', 'facility_id', 'tenant', 'role', 'u_height', 'device_count',
            'get_utilization',
        )
Exemplo n.º 6
0
class VirtualMachineTable(BaseTable):
    pk = ToggleColumn()
    name = tables.Column(linkify=True)
    status = ChoiceFieldColumn()
    cluster = tables.Column(linkify=True)
    role = ColoredLabelColumn()
    tenant = TenantColumn()

    class Meta(BaseTable.Meta):
        model = VirtualMachine
        fields = ('pk', 'name', 'status', 'cluster', 'role', 'tenant', 'vcpus',
                  'memory', 'disk')
Exemplo n.º 7
0
class VirtualMachineTable(BaseTable):
    pk = ToggleColumn()
    name = tables.LinkColumn()
    status = tables.TemplateColumn(template_code=VIRTUALMACHINE_STATUS)
    cluster = tables.Column(linkify=True)
    role = ColoredLabelColumn()
    tenant = tables.TemplateColumn(template_code=COL_TENANT)

    class Meta(BaseTable.Meta):
        model = VirtualMachine
        fields = ('pk', 'name', 'status', 'cluster', 'role', 'tenant', 'vcpus',
                  'memory', 'disk')
Exemplo n.º 8
0
class VirtualMachineTable(BaseTable):
    pk = ToggleColumn()
    name = tables.LinkColumn()
    status = tables.TemplateColumn(template_code=VIRTUALMACHINE_STATUS)
    cluster = tables.LinkColumn(viewname='virtualization:cluster',
                                args=[Accessor('cluster.pk')])
    role = ColoredLabelColumn()
    tenant = tables.TemplateColumn(template_code=COL_TENANT)

    class Meta(BaseTable.Meta):
        model = VirtualMachine
        fields = ('pk', 'name', 'status', 'cluster', 'role', 'tenant', 'vcpus',
                  'memory', 'disk')
Exemplo n.º 9
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',
        )
Exemplo n.º 10
0
class DeviceTable(BaseTable):
    pk = ToggleColumn()
    name = tables.TemplateColumn(order_by=('_name', ),
                                 template_code=DEVICE_LINK)
    status = ChoiceFieldColumn()
    tenant = TenantColumn()
    site = tables.Column(linkify=True)
    location = tables.Column(linkify=True)
    rack = tables.Column(linkify=True)
    device_role = ColoredLabelColumn(verbose_name='Role')
    manufacturer = tables.Column(
        accessor=Accessor('device_type__manufacturer'), linkify=True)
    device_type = tables.Column(linkify=True, verbose_name='Type')
    if settings.PREFER_IPV4:
        primary_ip = tables.Column(linkify=True,
                                   order_by=('primary_ip4', 'primary_ip6'),
                                   verbose_name='IP Address')
    else:
        primary_ip = tables.Column(linkify=True,
                                   order_by=('primary_ip6', 'primary_ip4'),
                                   verbose_name='IP Address')
    primary_ip4 = tables.Column(linkify=True, verbose_name='IPv4 Address')
    primary_ip6 = tables.Column(linkify=True, verbose_name='IPv6 Address')
    cluster = tables.Column(linkify=True)
    virtual_chassis = tables.Column(linkify=True)
    vc_position = tables.Column(verbose_name='VC Position')
    vc_priority = tables.Column(verbose_name='VC Priority')
    comments = MarkdownColumn()
    tags = TagColumn(url_name='dcim:device_list')

    class Meta(BaseTable.Meta):
        model = Device
        fields = (
            'pk',
            'name',
            'status',
            'tenant',
            'device_role',
            'manufacturer',
            'device_type',
            'platform',
            'serial',
            'asset_tag',
            'site',
            'location',
            'rack',
            'position',
            'face',
            'primary_ip',
            'primary_ip4',
            'primary_ip6',
            'cluster',
            'virtual_chassis',
            'vc_position',
            'vc_priority',
            'comments',
            'tags',
        )
        default_columns = (
            'pk',
            'name',
            'status',
            'tenant',
            'site',
            'location',
            'rack',
            'device_role',
            'manufacturer',
            'device_type',
            'primary_ip',
        )
Exemplo n.º 11
0
class DeviceTable(BaseTable):
    pk = ToggleColumn()
    name = tables.TemplateColumn(order_by=('_name', ),
                                 template_code=DEVICE_LINK)
    status = tables.TemplateColumn(template_code=STATUS_LABEL)
    tenant = tables.TemplateColumn(template_code=COL_TENANT)
    site = tables.Column(linkify=True)
    rack = tables.Column(linkify=True)
    device_role = ColoredLabelColumn(verbose_name='Role')
    device_type = tables.LinkColumn(
        viewname='dcim:devicetype',
        args=[Accessor('device_type__pk')],
        verbose_name='Type',
        text=lambda record: record.device_type.display_name)
    primary_ip = tables.TemplateColumn(template_code=DEVICE_PRIMARY_IP,
                                       orderable=False,
                                       verbose_name='IP Address')
    primary_ip4 = tables.Column(linkify=True, verbose_name='IPv4 Address')
    primary_ip6 = tables.Column(linkify=True, verbose_name='IPv6 Address')
    cluster = tables.LinkColumn(viewname='virtualization:cluster',
                                args=[Accessor('cluster__pk')])
    virtual_chassis = tables.LinkColumn(viewname='dcim:virtualchassis',
                                        args=[Accessor('virtual_chassis__pk')])
    vc_position = tables.Column(verbose_name='VC Position')
    vc_priority = tables.Column(verbose_name='VC Priority')
    tags = TagColumn(url_name='dcim:device_list')

    class Meta(BaseTable.Meta):
        model = Device
        fields = (
            'pk',
            'name',
            'status',
            'tenant',
            'device_role',
            'device_type',
            'platform',
            'serial',
            'asset_tag',
            'site',
            'rack',
            'position',
            'face',
            'primary_ip',
            'primary_ip4',
            'primary_ip6',
            'cluster',
            'virtual_chassis',
            'vc_position',
            'vc_priority',
            'tags',
        )
        default_columns = (
            'pk',
            'name',
            'status',
            'tenant',
            'site',
            'rack',
            'device_role',
            'device_type',
            'primary_ip',
        )