Ejemplo n.º 1
0
class AutonomousSystemForm(BootstrapMixin, forms.ModelForm):
    irr_as_set_peeringdb_sync = YesNoField(required=False, label="IRR AS-SET")
    ipv6_max_prefixes_peeringdb_sync = YesNoField(required=False,
                                                  label="IPv6 Max Prefixes")
    ipv4_max_prefixes_peeringdb_sync = YesNoField(required=False,
                                                  label="IPv4 Max Prefixes")
    comment = CommentField()

    class Meta:
        model = AutonomousSystem
        fields = (
            "asn",
            "name",
            "irr_as_set",
            "irr_as_set_peeringdb_sync",
            "ipv6_max_prefixes",
            "ipv6_max_prefixes_peeringdb_sync",
            "ipv4_max_prefixes",
            "ipv4_max_prefixes_peeringdb_sync",
            "comment",
        )
        labels = {
            "asn": "ASN",
            "irr_as_set": "IRR AS-SET",
            "ipv6_max_prefixes": "IPv6 Max Prefixes",
            "ipv4_max_prefixes": "IPv4 Max Prefixes",
            "comment": "Comments",
        }
        help_texts = {
            "asn": "BGP autonomous system number (32-bit capable)",
            "name": "Full name of the AS",
        }
Ejemplo n.º 2
0
class AutonomousSystemForm(BootstrapMixin, forms.ModelForm):
    irr_as_set_peeringdb_sync = YesNoField(required=False, label='IRR AS-SET')
    ipv6_max_prefixes_peeringdb_sync = YesNoField(required=False,
                                                  label='IPv6 Max Prefixes')
    ipv4_max_prefixes_peeringdb_sync = YesNoField(required=False,
                                                  label='IPv4 Max Prefixes')
    comment = CommentField()

    class Meta:
        model = AutonomousSystem
        fields = (
            'asn',
            'name',
            'irr_as_set',
            'irr_as_set_peeringdb_sync',
            'ipv6_max_prefixes',
            'ipv6_max_prefixes_peeringdb_sync',
            'ipv4_max_prefixes',
            'ipv4_max_prefixes_peeringdb_sync',
            'comment',
        )
        labels = {
            'asn': 'ASN',
            'irr_as_set': 'IRR AS-SET',
            'ipv6_max_prefixes': 'IPv6 Max Prefixes',
            'ipv4_max_prefixes': 'IPv4 Max Prefixes',
            'comment': 'Comments',
        }
        help_texts = {
            'asn': 'BGP autonomous system number (32-bit capable)',
            'name': 'Full name of the AS',
        }
Ejemplo n.º 3
0
class InternetExchangePeeringSessionFilterFormForIX(BootstrapMixin, forms.Form):
    model = InternetExchangePeeringSession
    q = forms.CharField(required=False, label="Search")
    autonomous_system__asn = forms.IntegerField(required=False, label="ASN")
    autonomous_system__name = forms.CharField(required=False, label="AS Name")
    ip_address = forms.CharField(required=False, label="IP Address")
    ip_version = forms.IntegerField(
        required=False,
        label="IP Version",
        widget=forms.Select(choices=[(0, "---------"), (6, "IPv6"), (4, "IPv4")]),
    )
    is_route_server = YesNoField(required=False, label="Route Server")
    enabled = YesNoField(required=False, label="Enabled")
Ejemplo n.º 4
0
class InternetExchangePeeringSessionFilterFormForAS(BootstrapMixin, forms.Form):
    model = InternetExchangePeeringSession
    q = forms.CharField(required=False, label="Search")
    ip_address = forms.CharField(required=False, label="IP Address")
    ip_version = forms.IntegerField(
        required=False,
        label="IP Version",
        widget=forms.Select(choices=[(0, "---------"), (6, "IPv6"), (4, "IPv4")]),
    )
    is_route_server = YesNoField(required=False, label="Route Server")
    enabled = YesNoField(required=False, label="Enabled")
    internet_exchange__slug = FilterChoiceField(
        queryset=InternetExchange.objects.all(),
        to_field_name="slug",
        label="Internet Exchange",
    )
Ejemplo n.º 5
0
class PeeringSessionForm(BootstrapMixin, forms.ModelForm):
    comment = CommentField()
    password = PasswordField(required=False, render_value=True)
    enabled = YesNoField(required=False, label='Enabled')

    class Meta:
        model = PeeringSession
        fields = (
            'autonomous_system',
            'internet_exchange',
            'ip_address',
            'password',
            'enabled',
            'comment',
        )
        labels = {
            'autonomous_system': 'AS',
            'internet_exchange': 'IX',
            'ip_address': 'IP Address',
            'enabled': 'Enabled',
            'comment': 'Comments',
        }
        help_texts = {
            'ip_address': 'IPv6 or IPv4 address',
            'enabled': 'Should this session be enabled?'
        }
Ejemplo n.º 6
0
class InternetExchangePeeringSessionBulkEditForm(BootstrapMixin, BulkEditForm):
    pk = FilterChoiceField(
        queryset=InternetExchangePeeringSession.objects.all(),
        widget=forms.MultipleHiddenInput,
    )
    is_route_server = YesNoField(required=False, label="Route Server")
    enabled = YesNoField(required=False, label="Enable")
    import_routing_policies = FilterChoiceField(
        required=False,
        queryset=RoutingPolicy.objects.filter(type=ROUTING_POLICY_TYPE_IMPORT),
    )
    export_routing_policies = FilterChoiceField(
        required=False,
        queryset=RoutingPolicy.objects.filter(type=ROUTING_POLICY_TYPE_EXPORT),
    )
    comment = CommentField(widget=SmallTextarea)

    class Meta:
        nullable_fields = ["comment"]
Ejemplo n.º 7
0
class InternetExchangePeeringSessionForm(BootstrapMixin, forms.ModelForm):
    password = PasswordField(required=False, render_value=True)
    is_route_server = YesNoField(
        required=False,
        label="Route Server",
        help_text="Define if this session is with a route server",
    )
    enabled = YesNoField(required=False,
                         help_text="Set this session as enabled")
    import_routing_policies = FilterChoiceField(
        required=False,
        queryset=RoutingPolicy.objects.filter(type=ROUTING_POLICY_TYPE_IMPORT),
    )
    export_routing_policies = FilterChoiceField(
        required=False,
        queryset=RoutingPolicy.objects.filter(type=ROUTING_POLICY_TYPE_EXPORT),
    )
    comment = CommentField()

    def __init__(self, *args, **kwargs):
        super().__init__(*args, **kwargs)
        self.fields["autonomous_system"].widget.attrs[
            "data-live-search"] = "true"

    class Meta:
        model = InternetExchangePeeringSession
        fields = (
            "autonomous_system",
            "internet_exchange",
            "ip_address",
            "password",
            "is_route_server",
            "enabled",
            "import_routing_policies",
            "export_routing_policies",
            "comment",
        )
        labels = {
            "autonomous_system": "AS",
            "internet_exchange": "IX",
            "ip_address": "IP Address",
        }
        help_texts = {"ip_address": "IPv6 or IPv4 address"}
Ejemplo n.º 8
0
class DirectPeeringSessionBulkEditForm(BootstrapMixin, BulkEditForm):
    pk = FilterChoiceField(queryset=DirectPeeringSession.objects.all(),
                           widget=forms.MultipleHiddenInput)
    enabled = YesNoField(required=False, label="Enable")
    import_routing_policies = FilterChoiceField(
        required=False,
        queryset=RoutingPolicy.objects.filter(type=ROUTING_POLICY_TYPE_IMPORT),
    )
    export_routing_policies = FilterChoiceField(
        required=False,
        queryset=RoutingPolicy.objects.filter(type=ROUTING_POLICY_TYPE_EXPORT),
    )
    comment = CommentField()
Ejemplo n.º 9
0
class DirectPeeringSessionFilterForm(BootstrapMixin, forms.Form):
    model = DirectPeeringSession
    q = forms.CharField(required=False, label="Search")
    local_asn = forms.IntegerField(required=False, label="Local ASN")
    ip_address = forms.CharField(required=False, label="IP Address")
    ip_version = forms.IntegerField(
        required=False,
        label="IP Version",
        widget=forms.Select(choices=[(0, "---------"), (6, "IPv6"), (4,
                                                                     "IPv4")]),
    )
    enabled = YesNoField(required=False, label="Enabled")
    relationship = forms.MultipleChoiceField(choices=BGP_RELATIONSHIP_CHOICES,
                                             required=False)
Ejemplo n.º 10
0
class PeeringSessionFilterFormForIX(BootstrapMixin, forms.Form):
    model = PeeringSession
    q = forms.CharField(required=False, label='Search')
    autonomous_system__asn = forms.IntegerField(required=False, label='ASN')
    autonomous_system__name = forms.CharField(required=False, label='AS Name')
    ip_address = forms.CharField(required=False, label='IP Address')
    ip_version = forms.IntegerField(required=False,
                                    label='IP Version',
                                    widget=forms.Select(choices=[
                                        (0, '---------'),
                                        (6, 'IPv6'),
                                        (4, 'IPv4'),
                                    ]))
    enabled = YesNoField(required=False, label='Enabled')
Ejemplo n.º 11
0
class DirectPeeringSessionForm(BootstrapMixin, forms.ModelForm):
    import_routing_policies = FilterChoiceField(
        required=False,
        queryset=RoutingPolicy.objects.filter(type=ROUTING_POLICY_TYPE_IMPORT),
    )
    export_routing_policies = FilterChoiceField(
        required=False,
        queryset=RoutingPolicy.objects.filter(type=ROUTING_POLICY_TYPE_EXPORT),
    )
    password = PasswordField(required=False, render_value=True)
    enabled = YesNoField(required=False, label="Enabled")
    comment = CommentField()

    def __init__(self, *args, **kwargs):
        super().__init__(*args, **kwargs)
        self.fields["autonomous_system"].widget.attrs[
            "data-live-search"] = "true"

    class Meta:
        model = DirectPeeringSession
        fields = (
            "local_asn",
            "autonomous_system",
            "relationship",
            "ip_address",
            "password",
            "enabled",
            "router",
            "import_routing_policies",
            "export_routing_policies",
            "comment",
        )
        labels = {
            "local_asn": "Local ASN",
            "autonomous_system": "AS",
            "ip_address": "IP Address",
            "comment": "Comments",
        }
        help_texts = {
            "local_asn":
            "ASN to be used locally, defaults to {}".format(settings.MY_ASN),
            "ip_address":
            "IPv6 or IPv4 address",
            "enabled":
            "Should this session be enabled?",
            "router":
            "Router on which this session is configured",
        }
Ejemplo n.º 12
0
class PeeringSessionFilterFormForAS(BootstrapMixin, forms.Form):
    model = PeeringSession
    q = forms.CharField(required=False, label='Search')
    ip_address = forms.CharField(required=False, label='IP Address')
    ip_version = forms.IntegerField(required=False,
                                    label='IP Version',
                                    widget=forms.Select(choices=[
                                        (0, '---------'),
                                        (6, 'IPv6'),
                                        (4, 'IPv4'),
                                    ]))
    enabled = YesNoField(required=False, label='Enabled')
    internet_exchange__slug = FilterChoiceField(
        queryset=InternetExchange.objects.all(),
        to_field_name='slug',
        label='Internet Exchange')