Exemplo n.º 1
0
class InternetExchangeCSVForm(forms.ModelForm):
    slug = SlugField()

    class Meta:
        model = InternetExchange
        fields = (
            'name',
            'slug',
            'ipv6_address',
            'ipv4_address',
            'configuration_template',
            'router',
            'check_bgp_session_states',
            'comment',
        )
        help_texts = {
            'name':
            'Full name of the Internet Exchange point',
            'ipv6_address':
            'IPv6 Address used to peer',
            'ipv4_address':
            'IPv4 Address used to peer',
            'configuration_template':
            'Template for configuration generation',
            'router':
            'Router connected to the Internet Exchange point',
            'check_bgp_session_states':
            'If enabled, with a usable router, the state of peering sessions will be updated.',
        }
Exemplo n.º 2
0
class InternetExchangeCSVForm(forms.ModelForm):
    slug = SlugField()

    class Meta:
        model = InternetExchange
        fields = (
            "name",
            "slug",
            "ipv6_address",
            "ipv4_address",
            "import_routing_policies",
            "export_routing_policies",
            "configuration_template",
            "router",
            "check_bgp_session_states",
            "comment",
        )
        help_texts = {
            "name":
            "Full name of the Internet Exchange point",
            "ipv6_address":
            "IPv6 Address used to peer",
            "ipv4_address":
            "IPv4 Address used to peer",
            "configuration_template":
            "Template for configuration generation",
            "router":
            "Router connected to the Internet Exchange point",
            "check_bgp_session_states":
            "If enabled, with a usable router, the state of peering sessions will be updated.",
        }
Exemplo n.º 3
0
class InternetExchangePeeringDBForm(BootstrapMixin, forms.ModelForm):
    slug = SlugField()

    def __init__(self, *args, **kwargs):
        kwargs.setdefault('label_suffix', '')
        super(InternetExchangePeeringDBForm, self).__init__(*args, **kwargs)
        self.fields['peeringdb_id'].widget = forms.HiddenInput()

    class Meta:
        model = InternetExchange
        fields = (
            'peeringdb_id',
            'name',
            'slug',
            'ipv6_address',
            'ipv4_address',
        )
        labels = {
            'ipv6_address': 'IPv6 Address',
            'ipv4_address': 'IPv4 Address',
        }
        help_texts = {
            'name': 'Full name of the Internet Exchange point',
            'ipv6_address': 'IPv6 Address used to peer',
            'ipv4_address': 'IPv4 Address used to peer',
        }
Exemplo n.º 4
0
class InternetExchangeCSVForm(forms.ModelForm):
    slug = SlugField()

    class Meta:
        model = InternetExchange
        fields = (
            'name',
            'slug',
            'ipv6_address',
            'ipv4_address',
            'configuration_template',
            'router',
            'comment',
        )
        labels = {
            'ipv6_address': 'IPv6 Address',
            'ipv4_address': 'IPv4 Address',
            'comment': 'Comments',
        }
        help_texts = {
            'name': 'Full name of the Internet Exchange point',
            'ipv6_address': 'IPv6 Address used to peer',
            'ipv4_address': 'IPv4 Address used to peer',
            'configuration_template': 'Template for configuration generation',
            'router': 'Router connected to the Internet Exchange point',
        }
Exemplo n.º 5
0
class RoutingPolicyForm(BootstrapMixin, forms.ModelForm):
    slug = SlugField()
    comment = CommentField()

    class Meta:
        model = RoutingPolicy

        fields = ("name", "slug", "type", "comment")
        labels = {"comment": "Comments"}
Exemplo n.º 6
0
class RoutingPolicyForm(BootstrapMixin, forms.ModelForm):
    slug = SlugField(max_length=255)
    type = forms.ChoiceField(choices=ROUTING_POLICY_TYPE_CHOICES, widget=StaticSelect)
    comment = CommentField()

    class Meta:
        model = RoutingPolicy

        fields = ("name", "slug", "type", "weight", "address_family", "comment")
        labels = {"comment": "Comments"}
Exemplo n.º 7
0
class InternetExchangeForm(BootstrapMixin, forms.ModelForm):
    slug = SlugField()
    import_routing_policies = FilterChoiceField(
        required=False,
        queryset=RoutingPolicy.objects.filter(
            Q(type=ROUTING_POLICY_TYPE_IMPORT)
            | Q(type=ROUTING_POLICY_TYPE_IMPORT_EXPORT)),
    )
    export_routing_policies = FilterChoiceField(
        required=False,
        queryset=RoutingPolicy.objects.filter(
            Q(type=ROUTING_POLICY_TYPE_EXPORT)
            | Q(type=ROUTING_POLICY_TYPE_IMPORT_EXPORT)),
    )
    comment = CommentField()

    class Meta:
        model = InternetExchange
        fields = (
            "peeringdb_id",
            "name",
            "slug",
            "ipv6_address",
            "ipv4_address",
            "import_routing_policies",
            "export_routing_policies",
            "configuration_template",
            "router",
            "check_bgp_session_states",
            "comment",
        )
        labels = {
            "peeringdb_id": "PeeringDB ID",
            "ipv6_address": "IPv6 Address",
            "ipv4_address": "IPv4 Address",
            "check_bgp_session_states": "Check Peering Session States",
            "comment": "Comments",
        }
        help_texts = {
            "peeringdb_id":
            "The PeeringDB ID for the IX connection (can be left empty)",
            "name":
            "Full name of the Internet Exchange point",
            "ipv6_address":
            "IPv6 Address used to peer",
            "ipv4_address":
            "IPv4 Address used to peer",
            "configuration_template":
            "Template for configuration generation",
            "router":
            "Router connected to the Internet Exchange point",
            "check_bgp_session_states":
            "If enabled, with a usable router, the state of peering sessions will be updated.",
        }
Exemplo n.º 8
0
class InternetExchangePeeringDBForm(BootstrapMixin, forms.ModelForm):
    slug = SlugField(max_length=255)

    def __init__(self, *args, **kwargs):
        kwargs.setdefault("label_suffix", "")
        super().__init__(*args, **kwargs)
        self.fields["peeringdb_id"].widget = forms.HiddenInput()

    class Meta:
        model = InternetExchange
        fields = ("peeringdb_id", "name", "slug", "ipv6_address", "ipv4_address")
        labels = {"ipv6_address": "IPv6 Address", "ipv4_address": "IPv4 Address"}
        help_texts = {
            "name": "Full name of the Internet Exchange point",
            "ipv6_address": "IPv6 Address used to peer",
            "ipv4_address": "IPv4 Address used to peer",
        }
Exemplo n.º 9
0
class BGPGroupForm(BootstrapMixin, forms.ModelForm):
    slug = SlugField(max_length=255)
    comment = CommentField()
    import_routing_policies = FilterChoiceField(
        required=False,
        queryset=RoutingPolicy.objects.all(),
        widget=APISelectMultiple(
            api_url="/api/peering/routing-policies/",
            query_filters={"type": "import-policy"},
        ),
    )
    export_routing_policies = FilterChoiceField(
        required=False,
        queryset=RoutingPolicy.objects.all(),
        widget=APISelectMultiple(
            api_url="/api/peering/routing-policies/",
            query_filters={"type": "export-policy"},
        ),
    )
    communities = FilterChoiceField(
        required=False,
        queryset=Community.objects.all(),
        widget=APISelectMultiple(api_url="/api/peering/communities/"),
    )

    class Meta:
        model = BGPGroup
        fields = (
            "name",
            "slug",
            "comment",
            "import_routing_policies",
            "export_routing_policies",
            "communities",
            "check_bgp_session_states",
        )
        labels = {
            "check_bgp_session_states": "Poll Peering Session States",
            "comment": "Comments",
        }
        help_texts = {
            "name": "Full name of the BGP group",
            "check_bgp_session_states": "If enabled, the state of peering sessions will be polled.",
        }
Exemplo n.º 10
0
class InternetExchangeForm(BootstrapMixin, forms.ModelForm):
    slug = SlugField()
    check_bgp_session_states = forms.ChoiceField(
        required=False,
        label='Check For Peering Session States',
        help_text=
        'If enabled, with a usable router, the state of peering sessions will be updated.',
        choices=(
            (True, 'Yes'),
            (False, 'No'),
        ),
        widget=forms.Select())
    comment = CommentField()

    class Meta:
        model = InternetExchange
        fields = (
            'peeringdb_id',
            'name',
            'slug',
            'ipv6_address',
            'ipv4_address',
            'configuration_template',
            'router',
            'check_bgp_session_states',
            'comment',
        )
        labels = {
            'peeringdb_id': 'PeeringDB ID',
            'ipv6_address': 'IPv6 Address',
            'ipv4_address': 'IPv4 Address',
            'comment': 'Comments',
        }
        help_texts = {
            'peeringdb_id':
            'The PeeringDB ID for the IX connection (can be left empty)',
            'name': 'Full name of the Internet Exchange point',
            'ipv6_address': 'IPv6 Address used to peer',
            'ipv4_address': 'IPv4 Address used to peer',
            'configuration_template': 'Template for configuration generation',
            'router': 'Router connected to the Internet Exchange point',
        }
Exemplo n.º 11
0
class InternetExchangeForm(BootstrapMixin, forms.ModelForm):
    slug = SlugField(max_length=255)
    import_routing_policies = FilterChoiceField(
        required=False,
        queryset=RoutingPolicy.objects.all(),
        widget=APISelectMultiple(
            api_url="/api/peering/routing-policies/",
            query_filters={"type": "import-policy"},
        ),
    )
    export_routing_policies = FilterChoiceField(
        required=False,
        queryset=RoutingPolicy.objects.all(),
        widget=APISelectMultiple(
            api_url="/api/peering/routing-policies/",
            query_filters={"type": "export-policy"},
        ),
    )
    communities = FilterChoiceField(
        required=False,
        queryset=Community.objects.all(),
        widget=APISelectMultiple(api_url="/api/peering/communities/"),
    )
    comment = CommentField()

    class Meta:
        model = InternetExchange
        fields = (
            "peeringdb_id",
            "name",
            "slug",
            "ipv6_address",
            "ipv4_address",
            "communities",
            "import_routing_policies",
            "export_routing_policies",
            "configuration_template",
            "router",
            "check_bgp_session_states",
            "comment",
        )
        labels = {
            "peeringdb_id": "PeeringDB ID",
            "ipv6_address": "IPv6 Address",
            "ipv4_address": "IPv4 Address",
            "check_bgp_session_states": "Poll Peering Session States",
            "comment": "Comments",
        }
        help_texts = {
            "peeringdb_id": "The PeeringDB ID for the IX connection (can be left empty)",
            "name": "Full name of the Internet Exchange point",
            "ipv6_address": "IPv6 Address used to peer",
            "ipv4_address": "IPv4 Address used to peer",
            "configuration_template": "Template for configuration generation",
            "router": "Router connected to the Internet Exchange point",
            "check_bgp_session_states": "If enabled, with a usable router, the state of peering sessions will be polled.",
        }
        widgets = {
            "configuration_template": APISelect(api_url="/api/peering/templates/"),
            "router": APISelect(api_url="/api/peering/routers/"),
        }