Skip to content

Package

intent_networking

App declaration for intent_networking.

IntentNetworkingConfig

Bases: NautobotAppConfig

App configuration for the intent_networking app.

Source code in intent_networking/__init__.py
class IntentNetworkingConfig(NautobotAppConfig):
    """App configuration for the intent_networking app."""

    name = "intent_networking"
    verbose_name = "Intent Networking"
    version = __version__
    author = "Daniel Ashton"
    description = (
        "IBNaaS intent lifecycle management — stores, resolves, deploys "
        "and continuously verifies network intents expressed as YAML."
    )
    base_url = "intent-networking"
    home_view_name = "plugins:intent_networking:dashboard"

    # ── Settings ──────────────────────────────────────────────────────────
    default_settings = {
        # VRF allocation namespace (Nautobot IPAM Namespace name)
        "vrf_namespace": "Global",
        # BGP
        "default_bgp_asn": 65000,
        # Capacity limits
        "max_vrfs_per_tenant": 50,
        "max_prefixes_per_vrf": 5000,
        # Reconciliation
        "reconciliation_interval_hours": 1,
        "auto_remediation_enabled": True,
        # Notifications — Slack (legacy)
        "slack_webhook_url": None,
        "github_api_url": None,
        "github_repo": None,
        "github_token_env_var": "GITHUB_TOKEN",
        # Webhooks / events (#8)
        "pagerduty_routing_key": None,
        "servicenow_instance": None,
        "servicenow_user": None,
        "servicenow_password": None,
        "webhook_urls": [],
        # Secrets integration (#5)
        "device_secrets_group": None,
        "nautobot_api_secrets_group": None,
    }

    # These MUST be set in nautobot_config.py — startup fails if missing
    required_settings = [
        "vrf_namespace",
        "default_bgp_asn",
    ]

    docs_view_name = "plugins:intent_networking:docs"
    searchable_models = ["intent"]

    def ready(self):
        """Import jobs/job buttons and wire post-migration setup.

        super().ready() auto-discovers jobs.py via the `jobs = "jobs.jobs"`
        attribute and calls register_jobs() at import time. Job buttons live
        in a separate module and must be imported explicitly.

        The default reconciliation schedule is created from the
        ``nautobot_database_ready`` signal rather than here, so the database is
        only queried after migrations complete (querying in ready() raises a
        Django "database access during app initialization" warning).
        """
        super().ready()
        from nautobot.core.signals import nautobot_database_ready  # noqa: PLC0415

        import intent_networking.job_buttons  # noqa: F401  pylint:disable=unused-import,import-outside-toplevel

        nautobot_database_ready.connect(_ensure_reconciliation_schedule, sender=self)

ready()

Import jobs/job buttons and wire post-migration setup.

super().ready() auto-discovers jobs.py via the jobs = "jobs.jobs" attribute and calls register_jobs() at import time. Job buttons live in a separate module and must be imported explicitly.

The default reconciliation schedule is created from the nautobot_database_ready signal rather than here, so the database is only queried after migrations complete (querying in ready() raises a Django "database access during app initialization" warning).

Source code in intent_networking/__init__.py
def ready(self):
    """Import jobs/job buttons and wire post-migration setup.

    super().ready() auto-discovers jobs.py via the `jobs = "jobs.jobs"`
    attribute and calls register_jobs() at import time. Job buttons live
    in a separate module and must be imported explicitly.

    The default reconciliation schedule is created from the
    ``nautobot_database_ready`` signal rather than here, so the database is
    only queried after migrations complete (querying in ready() raises a
    Django "database access during app initialization" warning).
    """
    super().ready()
    from nautobot.core.signals import nautobot_database_ready  # noqa: PLC0415

    import intent_networking.job_buttons  # noqa: F401  pylint:disable=unused-import,import-outside-toplevel

    nautobot_database_ready.connect(_ensure_reconciliation_schedule, sender=self)