示例#1
0
class VRFTable(BaseTable):
    pk = ToggleColumn()
    name = tables.Column(linkify=True)
    rd = tables.Column(verbose_name='RD')
    tenant = TenantColumn()
    enforce_unique = BooleanColumn(verbose_name='Unique')
    import_targets = TemplateColumn(template_code=VRF_TARGETS, orderable=False)
    export_targets = TemplateColumn(template_code=VRF_TARGETS, orderable=False)
    tags = TagColumn(url_name='ipam:vrf_list')

    class Meta(BaseTable.Meta):
        model = VRF
        fields = (
            'pk',
            'id',
            'name',
            'rd',
            'tenant',
            'enforce_unique',
            'description',
            'import_targets',
            'export_targets',
            'tags',
        )
        default_columns = ('pk', 'name', 'rd', 'tenant', 'description')
示例#2
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')
示例#3
0
class PathEndpointTable(CableTerminationTable):
    connection = TemplateColumn(
        accessor='_path__last_node',
        template_code=LINKTERMINATION,
        verbose_name='Connection',
        orderable=False
    )
示例#4
0
class CableTable(BaseTable):
    pk = ToggleColumn()
    termination_a_parent = tables.TemplateColumn(
        template_code=CABLE_TERMINATION_PARENT,
        accessor=Accessor('termination_a'),
        orderable=False,
        verbose_name='Side A')
    termination_a = tables.Column(accessor=Accessor('termination_a'),
                                  orderable=False,
                                  linkify=True,
                                  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.Column(accessor=Accessor('termination_b'),
                                  orderable=False,
                                  linkify=True,
                                  verbose_name='Termination B')
    status = ChoiceFieldColumn()
    tenant = TenantColumn()
    length = TemplateColumn(template_code=CABLE_LENGTH,
                            order_by=('_abs_length', 'length_unit'))
    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',
            'tenant',
            'color',
            'length',
            'tags',
            'created',
            'last_updated',
        )
        default_columns = (
            'pk',
            'id',
            'label',
            'termination_a_parent',
            'termination_a',
            'termination_b_parent',
            'termination_b',
            'status',
            'type',
        )
示例#5
0
class BaseInterfaceTable(BaseTable):
    enabled = BooleanColumn()
    ip_addresses = tables.TemplateColumn(template_code=INTERFACE_IPADDRESSES,
                                         orderable=False,
                                         verbose_name='IP Addresses')
    untagged_vlan = tables.Column(linkify=True)
    tagged_vlans = TemplateColumn(template_code=INTERFACE_TAGGED_VLANS,
                                  orderable=False,
                                  verbose_name='Tagged VLANs')
示例#6
0
class CableTerminationTable(BaseTable):
    cable = tables.Column(linkify=True)
    cable_color = ColorColumn(accessor='cable.color',
                              orderable=False,
                              verbose_name='Cable Color')
    link_peer = TemplateColumn(accessor='_link_peer',
                               template_code=LINKTERMINATION,
                               orderable=False,
                               verbose_name='Link Peer')
    mark_connected = BooleanColumn()
示例#7
0
class BaseInterfaceTable(BaseTable):
    enabled = BooleanColumn()
    ip_addresses = tables.TemplateColumn(template_code=INTERFACE_IPADDRESSES,
                                         orderable=False,
                                         verbose_name='IP Addresses')
    fhrp_groups = tables.TemplateColumn(
        accessor=Accessor('fhrp_group_assignments'),
        template_code=INTERFACE_FHRPGROUPS,
        orderable=False,
        verbose_name='FHRP Groups')
    untagged_vlan = tables.Column(linkify=True)
    tagged_vlans = TemplateColumn(template_code=INTERFACE_TAGGED_VLANS,
                                  orderable=False,
                                  verbose_name='Tagged VLANs')
示例#8
0
class VLANTable(BaseTable):
    pk = ToggleColumn()
    vid = tables.TemplateColumn(
        template_code=VLAN_LINK,
        verbose_name='VID'
    )
    name = tables.Column(
        linkify=True
    )
    site = tables.Column(
        linkify=True
    )
    group = tables.Column(
        linkify=True
    )
    tenant = TenantColumn()
    status = ChoiceFieldColumn(
        default=AVAILABLE_LABEL
    )
    role = tables.Column(
        linkify=True
    )
    prefixes = TemplateColumn(
        template_code=VLAN_PREFIXES,
        orderable=False,
        verbose_name='Prefixes'
    )
    tags = TagColumn(
        url_name='ipam:vlan_list'
    )

    class Meta(BaseTable.Meta):
        model = VLAN
        fields = (
            'pk', 'id', 'vid', 'name', 'site', 'group', 'prefixes', 'tenant', 'status', 'role', 'description', 'tags',
            'created', 'last_updated',
        )
        default_columns = ('pk', 'vid', 'name', 'site', 'group', 'prefixes', 'tenant', 'status', 'role', 'description')
        row_attrs = {
            'class': lambda record: 'success' if not isinstance(record, VLAN) else '',
        }