Exemplo n.º 1
0
class PlatformTable(BaseTable):
    pk = SelectColumn()
    router_count = tables.Column(
        verbose_name="Routers",
        attrs={
            "td": {
                "class": "text-center"
            },
            "th": {
                "class": "text-center"
            }
        },
    )
    buttons = ButtonsColumn(Platform, buttons=("edit", "delete"))

    class Meta(BaseTable.Meta):
        model = Platform
        fields = (
            "pk",
            "name",
            "router_count",
            "slug",
            "napalm_driver",
            "napalm_args",
            "password_algorithm",
            "description",
            "buttons",
        )
        default_columns = (
            "pk",
            "name",
            "router_count",
            "napalm_driver",
            "password_algorithm",
            "description",
            "buttons",
        )
Exemplo n.º 2
0
class BGPGroupTable(BaseTable):
    pk = SelectColumn()
    name = tables.Column(linkify=True)
    check_bgp_session_states = BooleanColumn(
        verbose_name="Poll Session States",
        attrs={"td": {"class": "text-center"}, "th": {"class": "text-center"}},
    )
    import_routing_policies = RoutingPolicyColumn(verbose_name="Import Policies")
    export_routing_policies = RoutingPolicyColumn(verbose_name="Export Policies")
    directpeeringsession_count = tables.Column(
        verbose_name="Direct Sessions",
        attrs={"td": {"class": "text-center"}, "th": {"class": "text-center"}},
    )
    tags = TagColumn(url_name="peering:bgpgroup_list")
    buttons = ButtonsColumn(BGPGroup)

    class Meta(BaseTable.Meta):
        model = BGPGroup
        fields = (
            "pk",
            "name",
            "slug",
            "check_bgp_session_states",
            "import_routing_policies",
            "export_routing_policies",
            "directpeeringsession_count",
            "tags",
            "buttons",
        )
        default_columns = (
            "pk",
            "name",
            "check_bgp_session_states",
            "directpeeringsession_count",
            "buttons",
        )
Exemplo n.º 3
0
class AutonomousSystemTable(BaseTable):
    """
    Table for AutonomousSystem lists
    """

    pk = SelectColumn()
    asn = tables.Column(verbose_name="ASN")
    name = tables.Column(linkify=True)
    irr_as_set = tables.Column(verbose_name="IRR AS-SET", orderable=False)
    ipv6_max_prefixes = tables.Column(verbose_name="IPv6 Max Prefixes")
    ipv4_max_prefixes = tables.Column(verbose_name="IPv4 Max Prefixes")
    import_routing_policies = RoutingPolicyColumn(
        verbose_name="Import Policies")
    export_routing_policies = RoutingPolicyColumn(
        verbose_name="Export Policies")
    directpeeringsession_count = tables.Column(
        verbose_name="Direct Sessions",
        attrs={
            "td": {
                "class": "text-center"
            },
            "th": {
                "class": "text-center"
            }
        },
    )
    internetexchangepeeringsession_count = tables.Column(
        verbose_name="IX Sessions",
        attrs={
            "td": {
                "class": "text-center"
            },
            "th": {
                "class": "text-center"
            }
        },
    )
    affiliated = BooleanColumn(
        verbose_name="Affiliated",
        attrs={
            "td": {
                "class": "text-center"
            },
            "th": {
                "class": "text-center"
            }
        },
    )
    tags = TagColumn(url_name="peering:autonomoussystem_list")
    buttons = ButtonsColumn(AutonomousSystem, pk_field="asn")

    class Meta(BaseTable.Meta):
        model = AutonomousSystem
        fields = (
            "pk",
            "asn",
            "name",
            "irr_as_set",
            "ipv6_max_prefixes",
            "ipv4_max_prefixes",
            "import_routing_policies",
            "export_routing_policies",
            "directpeeringsession_count",
            "internetexchangepeeringsession_count",
            "affiliated",
            "tags",
            "buttons",
        )
        default_columns = (
            "pk",
            "asn",
            "name",
            "irr_as_set",
            "directpeeringsession_count",
            "internetexchangepeeringsession_count",
            "buttons",
        )
Exemplo n.º 4
0
class RouterTable(BaseTable):
    """
    Table for Router lists
    """

    pk = SelectColumn()
    local_autonomous_system = tables.Column(verbose_name="Local AS",
                                            linkify=True)
    name = tables.Column(linkify=True)
    platform = tables.Column(linkify=True)
    encrypt_passwords = BooleanColumn(
        verbose_name="Encrypt Password",
        attrs={
            "td": {
                "class": "text-center"
            },
            "th": {
                "class": "text-center"
            }
        },
    )
    configuration_template = tables.Column(linkify=True,
                                           verbose_name="Configuration")
    directpeeringsession_count = tables.Column(
        verbose_name="Direct Sessions",
        attrs={
            "td": {
                "class": "text-center"
            },
            "th": {
                "class": "text-center"
            }
        },
    )
    internetexchangepeeringsession_count = tables.Column(
        verbose_name="IX Sessions",
        attrs={
            "td": {
                "class": "text-center"
            },
            "th": {
                "class": "text-center"
            }
        },
    )
    tags = TagColumn(url_name="peering:router_list")
    buttons = ButtonsColumn(Router)

    class Meta(BaseTable.Meta):
        model = Router
        fields = (
            "pk",
            "local_autonomous_system",
            "name",
            "hostname",
            "platform",
            "encrypt_passwords",
            "configuration_template",
            "directpeeringsession_count",
            "internetexchangepeeringsession_count",
            "device_state",
            "tags",
            "buttons",
        )
        default_columns = (
            "pk",
            "name",
            "hostname",
            "platform",
            "encrypt_passwords",
            "configuration_template",
            "directpeeringsession_count",
            "internetexchangepeeringsession_count",
            "device_state",
            "buttons",
        )
Exemplo n.º 5
0
class InternetExchangePeeringSessionTable(BaseTable):
    """
    Table for InternetExchangePeeringSession lists
    """

    append_template = """
    {% load helpers %}
    {% if record.comments %}
    <button type="button" class="btn btn-xs btn-info popover-hover" data-toggle="popover" data-html="true" title="Peering Session Comments" data-content="{{ record.comments | markdown:True }}"><i class="fas fa-comment"></i></button>
    {% endif %}
    {% if record.autonomous_system.comments %}
    <button type="button" class="btn btn-xs btn-info popover-hover" data-toggle="popover" data-html="true" title="Autonomous System Comments" data-content="{{ record.autonomous_system.comments | markdown:True }}"><i class="fas fa-comments"></i></button>
    {% endif %}
    {% if record.internet_exchange.comments %}
    <button type="button" class="btn btn-xs btn-info popover-hover" data-toggle="popover" data-html="true" title="Internet Exchange Comments" data-content="{{ record.internet_exchange.comments | markdown:True }}"><i class="fas fa-comment-dots"></i></button>
    {% endif %}
    """

    pk = SelectColumn()
    autonomous_system = tables.Column(verbose_name="AS",
                                      accessor="autonomous_system",
                                      linkify=True)
    internet_exchange = tables.Column(verbose_name="IX",
                                      accessor="internet_exchange",
                                      linkify=True)
    ip_address = tables.Column(verbose_name="IP Address", linkify=True)
    is_route_server = BooleanColumn(
        verbose_name="Route Server",
        attrs={
            "td": {
                "class": "text-center"
            },
            "th": {
                "class": "text-center"
            }
        },
    )
    enabled = BooleanColumn(
        verbose_name="Enabled",
        attrs={
            "td": {
                "class": "text-center"
            },
            "th": {
                "class": "text-center"
            }
        },
    )
    import_routing_policies = RoutingPolicyColumn(
        verbose_name="Import Policies")
    export_routing_policies = RoutingPolicyColumn(
        verbose_name="Export Policies")
    state = BGPSessionStateColumn(accessor="bgp_state")
    tags = TagColumn(url_name="peering:internetexchangepeeringsession_list")
    buttons = ButtonsColumn(InternetExchangePeeringSession,
                            append_template=append_template)

    class Meta(BaseTable.Meta):
        model = InternetExchangePeeringSession
        fields = (
            "pk",
            "autonomous_system",
            "internet_exchange",
            "ip_address",
            "is_route_server",
            "enabled",
            "import_routing_policies",
            "export_routing_policies",
            "state",
            "last_established_state",
            "received_prefix_count",
            "advertised_prefix_count",
            "tags",
            "buttons",
        )
        default_columns = (
            "pk",
            "autonomous_system",
            "internet_exchange",
            "ip_address",
            "is_route_server",
            "enabled",
            "enabled",
            "buttons",
        )
Exemplo n.º 6
0
class InternetExchangeTable(BaseTable):
    """
    Table for InternetExchange lists
    """

    pk = SelectColumn()
    local_autonomous_system = tables.Column(verbose_name="Local AS",
                                            linkify=True)
    name = tables.Column(linkify=True)
    ipv6_address = tables.Column(verbose_name="IPv6 Address")
    ipv4_address = tables.Column(verbose_name="IPv4 Address")
    router = tables.Column(verbose_name="Router",
                           accessor="router",
                           linkify=True)
    check_bgp_session_states = BooleanColumn(
        verbose_name="Check Sessions",
        attrs={
            "td": {
                "class": "text-center"
            },
            "th": {
                "class": "text-center"
            }
        },
    )
    bgp_session_states_update = tables.Column(
        verbose_name="Last Sessions Check")
    import_routing_policies = RoutingPolicyColumn(
        verbose_name="Import Policies")
    export_routing_policies = RoutingPolicyColumn(
        verbose_name="Export Policies")
    internetexchangepeeringsession_count = tables.Column(
        verbose_name="Sessions",
        attrs={
            "td": {
                "class": "text-center"
            },
            "th": {
                "class": "text-center"
            }
        },
    )
    tags = TagColumn(url_name="peering:internetexchange_list")
    buttons = ButtonsColumn(InternetExchange, pk_field="slug")

    class Meta(BaseTable.Meta):
        model = InternetExchange
        fields = (
            "pk",
            "local_autonomous_system",
            "name",
            "slug",
            "ipv6_address",
            "ipv4_address",
            "import_routing_policies",
            "export_routing_policies",
            "router",
            "check_bgp_session_states",
            "bgp_session_states_update",
            "internetexchangepeeringsession_count",
            "tags",
            "buttons",
        )
        default_columns = (
            "pk",
            "name",
            "ipv6_address",
            "ipv4_address",
            "router",
            "internetexchangepeeringsession_count",
            "buttons",
        )
Exemplo n.º 7
0
class DirectPeeringSessionTable(BaseTable):
    """
    Table for DirectPeeringSession lists
    """

    append_template = """
    {% load helpers %}
    {% if record.comments %}
    <button type="button" class="btn btn-xs btn-info popover-hover" data-toggle="popover" data-html="true" title="Peering Session Comments" data-content="{{ record.comments | markdown:True }}"><i class="fas fa-comment"></i></button>
    {% endif %}
    {% if record.autonomous_system.comments %}
    <button type="button" class="btn btn-xs btn-info popover-hover" data-toggle="popover" data-html="true" title="Autonomous System Comments" data-content="{{ record.autonomous_system.comments | markdown:True }}"><i class="fas fa-comments"></i></button>
    {% endif %}
    """

    pk = SelectColumn()
    local_autonomous_system = tables.Column(verbose_name="Local AS",
                                            linkify=True)
    autonomous_system = tables.Column(verbose_name="AS", linkify=True)
    ip_address = tables.Column(verbose_name="IP Address", linkify=True)
    bgp_group = tables.Column(verbose_name="BGP Group",
                              accessor="bgp_group",
                              linkify=True)
    relationship = tables.TemplateColumn(verbose_name="Relationship",
                                         template_code=BGP_RELATIONSHIP)
    enabled = BooleanColumn(
        verbose_name="Status",
        attrs={
            "td": {
                "class": "text-center"
            },
            "th": {
                "class": "text-center"
            }
        },
    )
    import_routing_policies = RoutingPolicyColumn(
        verbose_name="Import Policies")
    export_routing_policies = RoutingPolicyColumn(
        verbose_name="Export Policies")
    state = BGPSessionStateColumn(accessor="bgp_state")
    router = tables.Column(verbose_name="Router",
                           accessor="router",
                           linkify=True)
    tags = TagColumn(url_name="peering:directpeeringsession_list")
    buttons = ButtonsColumn(DirectPeeringSession,
                            append_template=append_template)

    class Meta(BaseTable.Meta):
        model = DirectPeeringSession
        fields = (
            "pk",
            "local_autonomous_system",
            "autonomous_system",
            "ip_address",
            "bgp_group",
            "relationship",
            "enabled",
            "import_routing_policies",
            "export_routing_policies",
            "state",
            "last_established_state",
            "received_prefix_count",
            "advertised_prefix_count",
            "router",
            "tags",
            "buttons",
        )
        default_columns = (
            "pk",
            "local_autonomous_system",
            "autonomous_system",
            "ip_address",
            "bgp_group",
            "relationship",
            "enabled",
            "router",
            "buttons",
        )