示例#1
0
class InterfaceVLANTable(StatusTableMixin, BaseTable):
    """
    List VLANs assigned to a specific Interface.
    """

    vid = tables.LinkColumn(viewname="ipam:vlan",
                            args=[Accessor("pk")],
                            verbose_name="ID")
    tagged = BooleanColumn()
    site = tables.Column(linkify=True)
    group = tables.Column(accessor=Accessor("group__name"),
                          verbose_name="Group")
    tenant = TenantColumn()
    role = tables.TemplateColumn(template_code=VLAN_ROLE_LINK)

    class Meta(BaseTable.Meta):
        model = VLAN
        fields = (
            "vid",
            "tagged",
            "site",
            "group",
            "name",
            "tenant",
            "status",
            "role",
            "description",
        )

    def __init__(self, interface, *args, **kwargs):
        self.interface = interface
        super().__init__(*args, **kwargs)
示例#2
0
class VRFTable(BaseTable):
    pk = ToggleColumn()
    name = tables.LinkColumn()
    rd = tables.Column(verbose_name="RD")
    tenant = TenantColumn()
    enforce_unique = BooleanColumn(verbose_name="Unique")
    import_targets = tables.TemplateColumn(template_code=VRF_TARGETS,
                                           orderable=False)
    export_targets = tables.TemplateColumn(template_code=VRF_TARGETS,
                                           orderable=False)
    tags = TagColumn(url_name="ipam:vrf_list")

    class Meta(BaseTable.Meta):
        model = VRF
        fields = (
            "pk",
            "name",
            "rd",
            "tenant",
            "enforce_unique",
            "description",
            "import_targets",
            "export_targets",
            "tags",
        )
        default_columns = ("pk", "name", "rd", "tenant", "description")
示例#3
0
class VLANDetailTable(VLANTable):
    prefixes = tables.TemplateColumn(template_code=VLAN_PREFIXES,
                                     orderable=False,
                                     verbose_name="Prefixes")
    tenant = TenantColumn()
    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",
        )
示例#4
0
class IPAddressDetailTable(IPAddressTable):
    nat_inside = tables.Column(linkify=True,
                               orderable=False,
                               verbose_name="NAT (Inside)")
    tenant = TenantColumn()
    assigned = BooleanColumn(accessor="assigned_object_id",
                             verbose_name="Assigned")
    tags = TagColumn(url_name="ipam:ipaddress_list")

    class Meta(IPAddressTable.Meta):
        fields = (
            "pk",
            "address",
            "vrf",
            "status",
            "role",
            "tenant",
            "nat_inside",
            "assigned",
            "dns_name",
            "description",
            "tags",
        )
        default_columns = (
            "pk",
            "address",
            "vrf",
            "status",
            "role",
            "tenant",
            "assigned",
            "dns_name",
            "description",
        )
示例#5
0
class PrefixDetailTable(PrefixTable):
    utilization = tables.TemplateColumn(template_code=UTILIZATION_GRAPH,
                                        orderable=False)
    tenant = TenantColumn()
    tags = TagColumn(url_name="ipam:prefix_list")

    class Meta(PrefixTable.Meta):
        fields = (
            "pk",
            "prefix",
            "status",
            "children",
            "vrf",
            "utilization",
            "tenant",
            "site",
            "vlan",
            "role",
            "is_pool",
            "description",
            "tags",
        )
        default_columns = (
            "pk",
            "prefix",
            "status",
            "children",
            "vrf",
            "utilization",
            "tenant",
            "site",
            "vlan",
            "role",
            "description",
        )
示例#6
0
class RackReservationTable(BaseTable):
    pk = ToggleColumn()
    reservation = tables.Column(accessor="pk", linkify=True)
    site = tables.Column(accessor=Accessor("rack__site"), linkify=True)
    tenant = TenantColumn()
    rack = tables.Column(linkify=True)
    unit_list = tables.Column(orderable=False, verbose_name="Units")
    tags = TagColumn(url_name="dcim:rackreservation_list")
    actions = ButtonsColumn(RackReservation)

    class Meta(BaseTable.Meta):
        model = RackReservation
        fields = (
            "pk",
            "reservation",
            "site",
            "rack",
            "unit_list",
            "user",
            "created",
            "tenant",
            "description",
            "tags",
            "actions",
        )
        default_columns = (
            "pk",
            "reservation",
            "site",
            "rack",
            "unit_list",
            "user",
            "description",
            "actions",
        )
示例#7
0
class VLANTable(StatusTableMixin, BaseTable):
    pk = ToggleColumn()
    vid = tables.TemplateColumn(template_code=VLAN_LINK, verbose_name="ID")
    site = tables.LinkColumn(viewname="dcim:site",
                             args=[Accessor("site__slug")])
    group = tables.LinkColumn(viewname="ipam:vlangroup",
                              args=[Accessor("group__pk")])
    tenant = TenantColumn()
    role = tables.TemplateColumn(template_code=VLAN_ROLE_LINK)

    class Meta(BaseTable.Meta):
        model = VLAN
        fields = (
            "pk",
            "vid",
            "site",
            "group",
            "name",
            "tenant",
            "status",
            "role",
            "description",
        )
        row_attrs = {
            "class":
            lambda record: "success" if not isinstance(record, VLAN) else "",
        }
示例#8
0
class AggregateTable(BaseTable):
    pk = ToggleColumn()
    prefix = tables.LinkColumn(verbose_name="Aggregate",
                               order_by=("network", "prefix_length"))
    tenant = TenantColumn()
    date_added = tables.DateColumn(format="Y-m-d", verbose_name="Added")

    class Meta(BaseTable.Meta):
        model = Aggregate
        fields = ("pk", "prefix", "rir", "tenant", "date_added", "description")
示例#9
0
class RouteTargetTable(BaseTable):
    pk = ToggleColumn()
    name = tables.LinkColumn()
    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")
示例#10
0
class InterfaceIPAddressTable(StatusTableMixin, BaseTable):
    """
    List IP addresses assigned to a specific Interface.
    """

    address = tables.LinkColumn(verbose_name="IP Address")
    vrf = tables.TemplateColumn(template_code=VRF_LINK, verbose_name="VRF")
    tenant = TenantColumn()

    class Meta(BaseTable.Meta):
        model = IPAddress
        fields = ("address", "vrf", "status", "role", "tenant", "description")
示例#11
0
class CircuitTable(StatusTableMixin, BaseTable):
    pk = ToggleColumn()
    cid = tables.LinkColumn(verbose_name="ID")
    provider = tables.LinkColumn(viewname="circuits:provider",
                                 args=[Accessor("provider__slug")])
    tenant = TenantColumn()
    tags = TagColumn(url_name="circuits:circuit_list")

    termination_a = tables.TemplateColumn(
        template_code=CIRCUIT_TERMINATION_PARENT,
        accessor=Accessor("termination_a"),
        orderable=False,
        verbose_name="Side A",
    )
    termination_z = tables.TemplateColumn(
        template_code=CIRCUIT_TERMINATION_PARENT,
        accessor=Accessor("termination_z"),
        orderable=False,
        verbose_name="Side Z",
    )

    class Meta(BaseTable.Meta):
        model = Circuit
        fields = (
            "pk",
            "cid",
            "provider",
            "type",
            "status",
            "tenant",
            "termination_a",
            "termination_z",
            "install_date",
            "commit_rate",
            "description",
            "tags",
        )
        default_columns = (
            "pk",
            "cid",
            "provider",
            "type",
            "status",
            "tenant",
            "termination_a",
            "termination_z",
            "description",
        )
示例#12
0
class PrefixTable(StatusTableMixin, BaseTable):
    pk = ToggleColumn()
    prefix = tables.TemplateColumn(template_code=PREFIX_LINK,
                                   attrs={"td": {
                                       "class": "text-nowrap"
                                   }},
                                   order_by=("network", "prefix_length"))
    vrf = tables.TemplateColumn(template_code=VRF_LINK, verbose_name="VRF")
    tenant = TenantColumn()
    site = tables.Column(linkify=True)
    vlan = tables.Column(linkify=True, verbose_name="VLAN")
    role = tables.TemplateColumn(template_code=PREFIX_ROLE_LINK)
    is_pool = BooleanColumn(verbose_name="Pool")

    class Meta(BaseTable.Meta):
        model = Prefix
        fields = (
            "pk",
            "prefix",
            "status",
            "children",
            "vrf",
            "tenant",
            "site",
            "vlan",
            "role",
            "is_pool",
            "description",
        )
        default_columns = (
            "pk",
            "prefix",
            "status",
            "vrf",
            "tenant",
            "site",
            "vlan",
            "role",
            "description",
        )
        row_attrs = {
            "class":
            lambda record: "success" if not record.present_in_database else "",
        }
示例#13
0
class VirtualMachineTable(StatusTableMixin, BaseTable):
    pk = ToggleColumn()
    name = tables.LinkColumn()
    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",
        )
示例#14
0
文件: sites.py 项目: whitej6/nautobot
class SiteTable(StatusTableMixin, BaseTable):
    pk = ToggleColumn()
    name = tables.LinkColumn(order_by=("_name", ))
    region = tables.Column(linkify=True)
    tenant = TenantColumn()
    tags = TagColumn(url_name="dcim:site_list")

    class Meta(BaseTable.Meta):
        model = Site
        fields = (
            "pk",
            "name",
            "slug",
            "status",
            "facility",
            "region",
            "tenant",
            "asn",
            "time_zone",
            "description",
            "physical_address",
            "shipping_address",
            "latitude",
            "longitude",
            "contact_name",
            "contact_phone",
            "contact_email",
            "tags",
        )
        default_columns = (
            "pk",
            "name",
            "status",
            "facility",
            "region",
            "tenant",
            "asn",
            "description",
        )
示例#15
0
class DeviceImportTable(BaseTable):
    name = tables.TemplateColumn(template_code=DEVICE_LINK)
    status = ColoredLabelColumn()
    tenant = TenantColumn()
    site = tables.Column(linkify=True)
    rack = tables.Column(linkify=True)
    device_role = tables.Column(verbose_name="Role")
    device_type = tables.Column(verbose_name="Type")

    class Meta(BaseTable.Meta):
        model = Device
        fields = (
            "name",
            "status",
            "tenant",
            "site",
            "rack",
            "position",
            "device_role",
            "device_type",
        )
        empty_text = False
示例#16
0
class RackTable(StatusTableMixin, BaseTable):
    pk = ToggleColumn()
    name = tables.Column(order_by=("_name", ), linkify=True)
    group = tables.Column(linkify=True)
    site = tables.Column(linkify=True)
    tenant = TenantColumn()
    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",
        )
示例#17
0
class CircuitTable(StatusTableMixin, BaseTable):
    pk = ToggleColumn()
    cid = tables.LinkColumn(verbose_name="ID")
    provider = tables.LinkColumn(viewname="circuits:provider",
                                 args=[Accessor("provider__slug")])
    tenant = TenantColumn()
    a_side = tables.Column(verbose_name="A Side")
    z_side = tables.Column(verbose_name="Z Side")
    tags = TagColumn(url_name="circuits:circuit_list")

    class Meta(BaseTable.Meta):
        model = Circuit
        fields = (
            "pk",
            "cid",
            "provider",
            "type",
            "status",
            "tenant",
            "a_side",
            "z_side",
            "install_date",
            "commit_rate",
            "description",
            "tags",
        )
        default_columns = (
            "pk",
            "cid",
            "provider",
            "type",
            "status",
            "tenant",
            "a_side",
            "z_side",
            "description",
        )
示例#18
0
class IPAddressTable(StatusTableMixin, BaseTable):
    pk = ToggleColumn()
    address = tables.TemplateColumn(template_code=IPADDRESS_LINK,
                                    verbose_name="IP Address",
                                    order_by=("host", "prefix_length"))
    vrf = tables.TemplateColumn(template_code=VRF_LINK, verbose_name="VRF")
    role = ChoiceFieldColumn()
    tenant = TenantColumn()
    assigned_object = tables.Column(linkify=True,
                                    orderable=False,
                                    verbose_name="Interface")
    assigned_object_parent = tables.Column(
        accessor="assigned_object__parent",
        linkify=True,
        orderable=False,
        verbose_name="Interface Parent",
    )

    class Meta(BaseTable.Meta):
        model = IPAddress
        fields = (
            "pk",
            "address",
            "vrf",
            "status",
            "role",
            "tenant",
            "assigned_object",
            "assigned_object_parent",
            "dns_name",
            "description",
        )
        row_attrs = {
            "class":
            lambda record: "success"
            if not isinstance(record, IPAddress) else "",
        }
示例#19
0
class DeviceTable(StatusTableMixin, BaseTable):
    pk = ToggleColumn()
    name = tables.TemplateColumn(order_by=("_name", ),
                                 template_code=DEVICE_LINK)
    tenant = TenantColumn()
    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,
    )
    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.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")
    secrets_group = tables.Column(linkify=True)
    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",
            "secrets_group",
            "tags",
        )
        default_columns = (
            "pk",
            "name",
            "status",
            "tenant",
            "site",
            "rack",
            "device_role",
            "device_type",
            "primary_ip",
        )